diff options
Diffstat (limited to 'libao2')
-rw-r--r-- | libao2/ao_alsa1x.c | 34 | ||||
-rw-r--r-- | libao2/ao_alsa5.c | 2 | ||||
-rw-r--r-- | libao2/ao_alsa9.c | 34 | ||||
-rw-r--r-- | libao2/ao_oss.c | 2 | ||||
-rw-r--r-- | libao2/ao_sdl.c | 22 | ||||
-rw-r--r-- | libao2/ao_sun.c | 14 |
6 files changed, 52 insertions, 56 deletions
diff --git a/libao2/ao_alsa1x.c b/libao2/ao_alsa1x.c index 5990009ccf..0d53ea7262 100644 --- a/libao2/ao_alsa1x.c +++ b/libao2/ao_alsa1x.c @@ -212,7 +212,7 @@ static int init(int rate_hz, int channels, int format, int flags) alsa_handler = NULL; - if (verbose) + if (verbose>0) printf("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); if ((err = snd_card_next(&cards)) < 0 || cards < 0) @@ -357,7 +357,7 @@ static int init(int rate_hz, int channels, int format, int flags) sprintf(devstr, "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x", s[0], s[1], s[2], s[3]); - if (verbose) + if (verbose>0) printf("alsa-spdif-init: playing AC3, %i channels\n", channels); break; case 4: @@ -404,7 +404,7 @@ static int init(int rate_hz, int channels, int format, int flags) return(0); } - if (verbose) + if (verbose>0) printf("alsa-init: got device=%i, subdevice=%i\n", tmp_device, tmp_subdevice); if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0) @@ -446,7 +446,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 1: alsa_fragcount = 16; chunk_size = 512; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 8192\n"); printf("alsa-init: chunksize set manually to 512\n"); } @@ -454,7 +454,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 2: alsa_fragcount = 8; chunk_size = 1024; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 8192\n"); printf("alsa-init: chunksize set manually to 1024\n"); } @@ -462,7 +462,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 3: alsa_fragcount = 32; chunk_size = 512; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 16384\n"); printf("alsa-init: chunksize set manually to 512\n"); } @@ -470,7 +470,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 4: alsa_fragcount = 16; chunk_size = 1024; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 16384\n"); printf("alsa-init: chunksize set manually to 1024\n"); } @@ -507,7 +507,7 @@ static int init(int rate_hz, int channels, int format, int flags) if ((err = snd_pcm_nonblock(alsa_handler, set_block_mode)) < 0) { printf("alsa-init: error set block-mode %s\n", snd_strerror(err)); } - else if (verbose) { + else if (verbose>0) { printf("alsa-init: pcm opend in %s\n", str_block_mode); } @@ -580,7 +580,7 @@ static int init(int rate_hz, int channels, int format, int flags) snd_strerror(err)); return(0); } - if (verbose) + if (verbose>0) printf("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, err); } #endif @@ -593,7 +593,7 @@ static int init(int rate_hz, int channels, int format, int flags) printf("alsa-init: unable to set periodsize: %s\n", snd_strerror(err)); return(0); } - else if (verbose) { + else if (verbose>0) { printf("alsa-init: chunksize set to %i\n", chunk_size); } @@ -602,7 +602,7 @@ static int init(int rate_hz, int channels, int format, int flags) alsa_fragcount = period_val; } - if (verbose) + if (verbose>0) printf("alsa-init: current val=%i, fragcount=%i\n", period_val, alsa_fragcount); if ((err = snd_pcm_hw_params_set_periods(alsa_handler, alsa_hwparams, alsa_fragcount, 0)) < 0) { @@ -629,7 +629,7 @@ static int init(int rate_hz, int channels, int format, int flags) } else { ao_data.buffersize = err; - if (verbose) + if (verbose>0) printf("alsa-init: got buffersize=%i\n", ao_data.buffersize); } @@ -661,7 +661,7 @@ static int init(int rate_hz, int channels, int format, int flags) bits_per_frame = bits_per_sample * channels; chunk_bytes = chunk_size * bits_per_frame / 8; - if (verbose) { + if (verbose>0) { printf("alsa-init: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes);} }//end swparams @@ -725,7 +725,7 @@ static void audio_pause() } } else { - if (verbose) + if (verbose>0) printf("alsa-pause: paused nonblock\n"); return; @@ -762,7 +762,7 @@ static void reset() return; } } else { - if (verbose) + if (verbose>0) printf("alsa-reset: reset nonblocked"); return; } @@ -1051,7 +1051,7 @@ static int get_space() str_status = "running"; break; case SND_PCM_STATE_PAUSED: - if (verbose) printf("alsa-space: paused"); + if (verbose>0) printf("alsa-space: paused"); str_status = "paused"; ret = 0; break; @@ -1069,7 +1069,7 @@ static int get_space() } } - if (verbose && str_status != "running") + if (verbose>0 && str_status != "running") printf("alsa-space: free space = %i, status=%i, %s --\n", ret, status, str_status); snd_pcm_status_free(status); diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c index b85a5edb9c..8560091a15 100644 --- a/libao2/ao_alsa5.c +++ b/libao2/ao_alsa5.c @@ -17,8 +17,6 @@ #include "../mp_msg.h" -extern int verbose; - static ao_info_t info = { "ALSA-0.5.x audio output", diff --git a/libao2/ao_alsa9.c b/libao2/ao_alsa9.c index 5990009ccf..0d53ea7262 100644 --- a/libao2/ao_alsa9.c +++ b/libao2/ao_alsa9.c @@ -212,7 +212,7 @@ static int init(int rate_hz, int channels, int format, int flags) alsa_handler = NULL; - if (verbose) + if (verbose>0) printf("alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); if ((err = snd_card_next(&cards)) < 0 || cards < 0) @@ -357,7 +357,7 @@ static int init(int rate_hz, int channels, int format, int flags) sprintf(devstr, "iec958:AES0=0x%x,AES1=0x%x,AES2=0x%x,AES3=0x%x", s[0], s[1], s[2], s[3]); - if (verbose) + if (verbose>0) printf("alsa-spdif-init: playing AC3, %i channels\n", channels); break; case 4: @@ -404,7 +404,7 @@ static int init(int rate_hz, int channels, int format, int flags) return(0); } - if (verbose) + if (verbose>0) printf("alsa-init: got device=%i, subdevice=%i\n", tmp_device, tmp_subdevice); if ((err = snprintf(alsa_device, ALSA_DEVICE_SIZE, "hw:%1d,%1d", tmp_device, tmp_subdevice)) <= 0) @@ -446,7 +446,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 1: alsa_fragcount = 16; chunk_size = 512; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 8192\n"); printf("alsa-init: chunksize set manually to 512\n"); } @@ -454,7 +454,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 2: alsa_fragcount = 8; chunk_size = 1024; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 8192\n"); printf("alsa-init: chunksize set manually to 1024\n"); } @@ -462,7 +462,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 3: alsa_fragcount = 32; chunk_size = 512; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 16384\n"); printf("alsa-init: chunksize set manually to 512\n"); } @@ -470,7 +470,7 @@ static int init(int rate_hz, int channels, int format, int flags) case 4: alsa_fragcount = 16; chunk_size = 1024; - if (verbose) { + if (verbose>0) { printf("alsa-init: buffersize set manually to 16384\n"); printf("alsa-init: chunksize set manually to 1024\n"); } @@ -507,7 +507,7 @@ static int init(int rate_hz, int channels, int format, int flags) if ((err = snd_pcm_nonblock(alsa_handler, set_block_mode)) < 0) { printf("alsa-init: error set block-mode %s\n", snd_strerror(err)); } - else if (verbose) { + else if (verbose>0) { printf("alsa-init: pcm opend in %s\n", str_block_mode); } @@ -580,7 +580,7 @@ static int init(int rate_hz, int channels, int format, int flags) snd_strerror(err)); return(0); } - if (verbose) + if (verbose>0) printf("alsa-init: buffer_time: %d, period_time :%d\n",alsa_buffer_time, err); } #endif @@ -593,7 +593,7 @@ static int init(int rate_hz, int channels, int format, int flags) printf("alsa-init: unable to set periodsize: %s\n", snd_strerror(err)); return(0); } - else if (verbose) { + else if (verbose>0) { printf("alsa-init: chunksize set to %i\n", chunk_size); } @@ -602,7 +602,7 @@ static int init(int rate_hz, int channels, int format, int flags) alsa_fragcount = period_val; } - if (verbose) + if (verbose>0) printf("alsa-init: current val=%i, fragcount=%i\n", period_val, alsa_fragcount); if ((err = snd_pcm_hw_params_set_periods(alsa_handler, alsa_hwparams, alsa_fragcount, 0)) < 0) { @@ -629,7 +629,7 @@ static int init(int rate_hz, int channels, int format, int flags) } else { ao_data.buffersize = err; - if (verbose) + if (verbose>0) printf("alsa-init: got buffersize=%i\n", ao_data.buffersize); } @@ -661,7 +661,7 @@ static int init(int rate_hz, int channels, int format, int flags) bits_per_frame = bits_per_sample * channels; chunk_bytes = chunk_size * bits_per_frame / 8; - if (verbose) { + if (verbose>0) { printf("alsa-init: bits per sample (bps)=%i, bits per frame (bpf)=%i, chunk_bytes=%i\n",bits_per_sample,bits_per_frame,chunk_bytes);} }//end swparams @@ -725,7 +725,7 @@ static void audio_pause() } } else { - if (verbose) + if (verbose>0) printf("alsa-pause: paused nonblock\n"); return; @@ -762,7 +762,7 @@ static void reset() return; } } else { - if (verbose) + if (verbose>0) printf("alsa-reset: reset nonblocked"); return; } @@ -1051,7 +1051,7 @@ static int get_space() str_status = "running"; break; case SND_PCM_STATE_PAUSED: - if (verbose) printf("alsa-space: paused"); + if (verbose>0) printf("alsa-space: paused"); str_status = "paused"; ret = 0; break; @@ -1069,7 +1069,7 @@ static int get_space() } } - if (verbose && str_status != "running") + if (verbose>0 && str_status != "running") printf("alsa-space: free space = %i, status=%i, %s --\n", ret, status, str_status); snd_pcm_status_free(status); diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 506f9a84b4..2dff9725a2 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -20,8 +20,6 @@ #include "audio_out.h" #include "audio_out_internal.h" -extern int verbose; - static ao_info_t info = { "OSS/ioctl audio output", diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index 37bfe1e1cc..2c7a699b61 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -13,6 +13,9 @@ #include <stdio.h> #include <stdlib.h> +#include "../config.h" +#include "../mp_msg.h" + #include "audio_out.h" #include "audio_out_internal.h" #include "afmt.h" @@ -30,9 +33,6 @@ static ao_info_t info = LIBAO_EXTERN(sdl) - -extern int verbose; - // Samplesize used by the SDLlib AudioSpec struct #define SAMPLESIZE 1024 @@ -153,11 +153,11 @@ static int init(int rate,int channels,int format,int flags){ /* Allocate ring-buffer memory */ for(i=0;i<NUM_BUFS;i++) buffer[i]=(unsigned char *) malloc(BUFFSIZE); - printf("SDL: Samplerate: %iHz Channels: %s Format %s\n", rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); + mp_msg(MSGT_AO,MSGL_INFO,"SDL: Samplerate: %iHz Channels: %s Format %s\n", rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); if(ao_subdevice) { setenv("SDL_AUDIODRIVER", ao_subdevice, 1); - printf("SDL: using %s audio driver\n", ao_subdevice); + mp_msg(MSGT_AO,MSGL_INFO,"SDL: using %s audio driver\n", ao_subdevice); } ao_data.channels=channels; @@ -189,7 +189,7 @@ static int init(int rate,int channels,int format,int flags){ aspec.format = AUDIO_U16MSB; break; default: - printf("SDL: Unsupported audio format: 0x%x.\n", format); + mp_msg(MSGT_AO,MSGL_WARN,"SDL: Unsupported audio format: 0x%x.\n", format); return 0; } @@ -211,13 +211,13 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s /* initialize the SDL Audio system */ if (SDL_Init (SDL_INIT_AUDIO/*|SDL_INIT_NOPARACHUTE*/)) { - printf("SDL: Initializing of SDL Audio failed: %s.\n", SDL_GetError()); + mp_msg(MSGT_AO,MSGL_ERR,"SDL: Initializing of SDL Audio failed: %s.\n", SDL_GetError()); return 0; } /* Open the audio device and start playing sound! */ if(SDL_OpenAudio(&aspec, &obtained) < 0) { - printf("SDL: Unable to open audio: %s\n", SDL_GetError()); + mp_msg(MSGT_AO,MSGL_ERR,"SDL: Unable to open audio: %s\n", SDL_GetError()); return(0); } @@ -245,11 +245,11 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s ao_data.format = AFMT_U16_BE; break; default: - printf("SDL: Unsupported SDL audio format: 0x%x.\n", obtained.format); + mp_msg(MSGT_AO,MSGL_WARN,"SDL: Unsupported SDL audio format: 0x%x.\n", obtained.format); return 0; } - if(verbose) printf("SDL: buf size = %d\n",obtained.size); + mp_msg(MSGT_AO,MSGL_V,"SDL: buf size = %d\n",obtained.size); ao_data.buffersize=obtained.size; /* unsilence audio, if callback is ready */ @@ -260,7 +260,7 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s // close audio device static void uninit(){ - if(verbose) printf("SDL: Audio Subsystem shutting down!\n"); + mp_msg(MSGT_AO,MSGL_V,"SDL: Audio Subsystem shutting down!\n"); SDL_CloseAudio(); SDL_QuitSubSystem(SDL_INIT_AUDIO); } diff --git a/libao2/ao_sun.c b/libao2/ao_sun.c index f82b3a9ac9..ef437394da 100644 --- a/libao2/ao_sun.c +++ b/libao2/ao_sun.c @@ -125,19 +125,19 @@ static int realtime_samplecounter_available(char *dev) info.play.encoding = AUDIO_ENCODING_LINEAR; info.play.samples = 0; if (ioctl(fd, AUDIO_SETINFO, &info)) { - if (verbose) + if (verbose>0) printf("rtsc: SETINFO failed\n"); goto error; } if (write(fd, silence, len) != len) { - if (verbose) + if (verbose>0) printf("rtsc: write failed"); goto error; } if (ioctl(fd, AUDIO_GETINFO, &info)) { - if (verbose) + if (verbose>0) perror("rtsc: GETINFO1"); goto error; } @@ -159,18 +159,18 @@ static int realtime_samplecounter_available(char *dev) break; if (ioctl(fd, AUDIO_GETINFO, &info)) { - if (verbose) + if (verbose>0) perror("rtsc: GETINFO2 failed"); goto error; } if (info.play.samples < last_samplecnt) { - if (verbose) + if (verbose>0) printf("rtsc: %d > %d?\n", last_samplecnt, info.play.samples); goto error; } if ((increment = info.play.samples - last_samplecnt) > 0) { - if (verbose) + if (verbose>0) printf("ao_sun: sample counter increment: %d\n", increment); if (increment < min_increment) { min_increment = increment; @@ -193,7 +193,7 @@ static int realtime_samplecounter_available(char *dev) if (min_increment < 2000) rtsc_ok = RTSC_ENABLED; - if (verbose) + if (verbose>0) printf("ao_sun: minimum sample counter increment per 10msec interval: %d\n" "\t%susing sample counter based timing code\n", min_increment, rtsc_ok == RTSC_ENABLED ? "" : "not "); |