From 0f9f4caba49ab9330e9b3836612a07cde1508354 Mon Sep 17 00:00:00 2001 From: ivo Date: Sat, 18 Sep 2004 20:31:28 +0000 Subject: [PATCH] mp_msg transition of unmaintained audio output drivers. Patch by Reynaldo H. Verdejo Pinochet git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13384 b3059339-0415-0410-9bf9-f77b7e298cf2 --- AUTHORS | 1 + help/help_mp-en.h | 98 +++++++++++++++++++++++++++++++++++++++++++++ libao2/ao_alsa5.c | 47 +++++++++++----------- libao2/ao_arts.c | 13 +++--- libao2/ao_dxr2.c | 4 +- libao2/ao_esd.c | 13 +++--- libao2/ao_mpegpes.c | 5 ++- libao2/ao_null.c | 6 --- libao2/ao_oss.c | 24 +++++------ libao2/ao_pcm.c | 15 +++---- libao2/ao_sdl.c | 13 +++--- libao2/ao_sgi.c | 31 +++++++------- libao2/ao_sun.c | 15 +++---- 13 files changed, 191 insertions(+), 94 deletions(-) diff --git a/AUTHORS b/AUTHORS index 57e8cc85a2..a71e0f0109 100644 --- a/AUTHORS +++ b/AUTHORS @@ -671,6 +671,7 @@ Vajna, Mikl Verdejo Pinochet, Reynaldo H. (reynaldo) * improved EDL support + * mp_msg transition on unmantained libao2 drivers Wigren, Per * bmovl - Bitmap Overlay video filter diff --git a/help/help_mp-en.h b/help/help_mp-en.h index afd08c168a..7c7aa29f99 100644 --- a/help/help_mp-en.h +++ b/help/help_mp-en.h @@ -781,3 +781,101 @@ static char help_text[]= #define MSGTR_VO_JPEG_BaselineJPEG "Baseline JPEG enabled." #define MSGTR_VO_JPEG_NoBaselineJPEG "Baseline JPEG disabled." +// ======================= AO Audio Output drivers ======================== + +// libao2 + +// ao_oss.c +#define MSGTR_AO_OSS_CantOpenMixer "[AO OSS] audio_setup: Can't open mixer device %s: %s\n" +#define MSGTR_AO_OSS_ChanNotFound "[AO OSS] audio_setup: Audio card mixer does not have channel '%s' using default.\n" +#define MSGTR_AO_OSS_CantOpenDev "[AO OSS] audio_setup: Can't open audio device %s: %s\n" +#define MSGTR_AO_OSS_CantMakeFd "[AO OSS] audio_setup: Can't make filedescriptor blocking: %s\n" +#define MSGTR_AO_OSS_CantSetAC3 "[AO OSS] Can't set audio device %s to AC3 output, trying S16...\n" +#define MSGTR_AO_OSS_CantSetChans "[AO OSS] audio_setup: Failed to set audio device to %d channels.\n" +#define MSGTR_AO_OSS_CantUseGetospace "[AO OSS] audio_setup: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n" +#define MSGTR_AO_OSS_CantUseSelect "[AO OSS]\n *** Your audio driver DOES NOT support select() ***\n Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n" +#define MSGTR_AO_OSS_CantReopen "[AO OSS]\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n" + +// ao_arts.c +#define MSGTR_AO_ARTS_CantInit "[AO ARTS] %s\n" +#define MSGTR_AO_ARTS_ServerConnect "[AO ARTS] Connected to sound server.\n" +#define MSGTR_AO_ARTS_CantOpenStream "[AO ARTS] Unable to open a stream.\n" +#define MSGTR_AO_ARTS_StreamOpen "[AO ARTS] Stream opened.\n" +#define MSGTR_AO_ARTS_BufferSize "[AO ARTS] buffer size: %d\n" + +// ao_dxr2.c +#define MSGTR_AO_DXR2_SetVolFailed "[AO DXR2] Setting volume to %d failed.\n" +#define MSGTR_AO_DXR2_UnsupSamplerate "[AO DXR2] dxr2: %d Hz not supported, try \"-aop list=resample\"\n" + +// ao_esd.c +#define MSGTR_AO_ESD_CantOpenSound "[AO ESD] esd_open_sound failed: %s\n" +#define MSGTR_AO_ESD_LatencyInfo "[AO ESD] latency: [server: %0.2fs, net: %0.2fs] (adjust %0.2fs)\n" +#define MSGTR_AO_ESD_CantOpenPBStream "[AO ESD] failed to open esd playback stream: %s\n" + +// ao_mpegpes.c +#define MSGTR_AO_MPEGPES_CantSetMixer "[AO MPEGPES] DVB audio set mixer failed: %s\n" +#define MSGTR_AO_MPEGPES_UnsupSamplerate "[AO MPEGPES] %d Hz not supported, try to resample...\n" + +// ao_null.c +// This one desn't even have any mp_msg nor printf's?? [CHECK] + +// ao_pcm.c +#define MSGTR_AO_PCM_FileInfo "[AO PCM] File: %s (%s)\nPCM: Samplerate: %iHz Channels: %s Format %s\n" +#define MSGTR_AO_PCM_HintInfo "[AO PCM] Info: fastest dumping is achieved with -vc dummy -vo null\nPCM: Info: to write WAVE files use -waveheader (default)." +#define MSGTR_AO_PCM_CantOpenOutputFile "[AO PCM] Failed to open %s for writing!\n" + +// ao_sdl.c +#define MSGTR_AO_SDL_INFO "[AO SDL] Samplerate: %iHz Channels: %s Format %s\n" +#define MSGTR_AO_SDL_DriverInfo "[AO SDL] using %s audio driver.\n" +#define MSGTR_AO_SDL_UnsupportedAudioFmt "[AO SDL] Unsupported audio format: 0x%x.\n" +#define MSGTR_AO_SDL_CantInit "[AO SDL] Initializing of SDL Audio failed: %s\n" +#define MSGTR_AO_SDL_CantOpenAudio "[AO SDL] Unable to open audio: %s\n" + +// ao_sgi.c +#define MSGTR_AO_SGI_INFO "[AO SGI] control.\n" +#define MSGTR_AO_SGI_InitInfo "[AO SGI] init: Samplerate: %iHz Channels: %s Format %s\n" +#define MSGTR_AO_SGI_InvalidDevice "[AO SGI] play: invalid device.\n" +#define MSGTR_AO_SGI_CantSetParms_Samplerate "[AO SGI] init: setparams failed: %s\nCould not set desired samplerate.\n" +#define MSGTR_AO_SGI_CantSetAlRate "[AO SGI] init: AL_RATE was not accepted on the given resource.\n" +#define MSGTR_AO_SGI_CantGetParms "[AO SGI] init: getparams failed: %s\n" +#define MSGTR_AO_SGI_SampleRateInfo "[AO SGI] init: samplerate is now %lf (desired rate is %lf)\n" +#define MSGTR_AO_SGI_InitConfigError "[AO SGI] init: %s\n" +#define MSGTR_AO_SGI_InitOpenAudioFailed "[AO SGI] init: Unable to open audio channel: %s\n" +#define MSGTR_AO_SGI_Uninit "[AO SGI] uninit: ...\n" +#define MSGTR_AO_SGI_Reset "[AO SGI] reset: ...\n" +#define MSGTR_AO_SGI_PauseInfo "[AO SGI] audio_pause: ...\n" +#define MSGTR_AO_SGI_ResumeInfo "[AO SGI] audio_resume: ...\n" + +// ao_sun.c +#define MSGTR_AO_SUN_RtscSetinfoFailed "[AO SUN] rtsc: SETINFO failed.\n" +#define MSGTR_AO_SUN_RtscWriteFailed "[AO SUN] rtsc: write failed." +#define MSGTR_AO_SUN_CantOpenAudioDev "[AO SUN] Can't open audio device %s, %s -> nosound.\n" +#define MSGTR_AO_SUN_UnsupSampleRate "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n" +#define MSGTR_AO_SUN_CantUseSelect "[AO SUN]\n *** Your audio driver DOES NOT support select() ***\nRecompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n" +#define MSGTR_AO_SUN_CantReopenReset "[AO SUN]\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE (%s) ***\n" + +// ao_alsa5.c +#define MSGTR_AO_ALSA5_InitInfo "[AO ALSA5] alsa-init: requested format: %d Hz, %d channels, %s\n" +#define MSGTR_AO_ALSA5_SoundCardNotFound "[AO ALSA5] alsa-init: no soundcards found.\n" +#define MSGTR_AO_ALSA5_InvalidFormatReq "[AO ALSA5] alsa-init: invalid format (%s) requested - output disabled.\n" +#define MSGTR_AO_ALSA5_PlayBackError "[AO ALSA5] alsa-init: playback open error: %s\n" +#define MSGTR_AO_ALSA5_PcmInfoError "[AO ALSA5] alsa-init: pcm info error: %s\n" +#define MSGTR_AO_ALSA5_SoundcardsFound "[AO ALSA5] alsa-init: %d soundcard(s) found, using: %s\n" +#define MSGTR_AO_ALSA5_PcmChanInfoError "[AO ALSA5] alsa-init: pcm channel info error: %s\n" +#define MSGTR_AO_ALSA5_CantSetParms "[AO ALSA5] alsa-init: error setting parameters: %s\n" +#define MSGTR_AO_ALSA5_CantSetChan "[AO ALSA5] alsa-init: error setting up channel: %s\n" +#define MSGTR_AO_ALSA5_ChanPrepareError "[AO ALSA5] alsa-init: channel prepare error: %s\n" +#define MSGTR_AO_ALSA5_DrainError "[AO ALSA5] alsa-uninit: playback drain error: %s\n" +#define MSGTR_AO_ALSA5_FlushError "[AO ALSA5] alsa-uninit: playback flush error: %s\n" +#define MSGTR_AO_ALSA5_PcmCloseError "[AO ALSA5] alsa-uninit: pcm close error: %s\n" +#define MSGTR_AO_ALSA5_ResetDrainError "[AO ALSA5] alsa-reset: playback drain error: %s\n" +#define MSGTR_AO_ALSA5_ResetFlushError "[AO ALSA5] alsa-reset: playback flush error: %s\n" +#define MSGTR_AO_ALSA5_ResetChanPrepareError "[AO ALSA5] alsa-reset: channel prepare error: %s\n" +#define MSGTR_AO_ALSA5_PauseDrainError "[AO ALSA5] alsa-pause: playback drain error: %s\n" +#define MSGTR_AO_ALSA5_PauseFlushError "[AO ALSA5] alsa-pause: playback flush error: %s\n" +#define MSGTR_AO_ALSA5_ResumePrepareError "[AO ALSA5] alsa-resume: channel prepare error: %s\n" +#define MSGTR_AO_ALSA5_Underrun "[AO ALSA5] alsa-play: alsa underrun, resetting stream.\n" +#define MSGTR_AO_ALSA5_PlaybackPrepareError "[AO ALSA5] alsa-play: playback prepare error: %s\n" +#define MSGTR_AO_ALSA5_WriteErrorAfterReset "[AO ALSA5] alsa-play: write error after reset: %s - giving up.\n" +#define MSGTR_AO_ALSA5_OutPutError "[AO ALSA5] alsa-play: output error: %s\n" + diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c index 2a7799fab9..cc515396c3 100644 --- a/libao2/ao_alsa5.c +++ b/libao2/ao_alsa5.c @@ -16,6 +16,7 @@ #include "afmt.h" #include "../mp_msg.h" +#include "../help_mp.h" static ao_info_t info = { @@ -50,7 +51,7 @@ static int init(int rate_hz, int channels, int format, int flags) snd_pcm_info_t info; snd_pcm_channel_info_t chninfo; - mp_msg(MSGT_AO, MSGL_INFO, "alsa-init: requested format: %d Hz, %d channels, %s\n", rate_hz, + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ALSA5_InitInfo, rate_hz, channels, audio_out_format_name(format)); alsa_handler = NULL; @@ -60,7 +61,7 @@ static int init(int rate_hz, int channels, int format, int flags) if ((cards = snd_cards()) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: no soundcards found\n"); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_SoundCardNotFound); return(0); } @@ -110,7 +111,7 @@ static int init(int rate_hz, int channels, int format, int flags) ao_data.bps *= 2; break; case -1: - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: invalid format (%s) requested - output disabled\n", + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq, audio_out_format_name(format)); return(0); default: @@ -163,17 +164,17 @@ static int init(int rate_hz, int channels, int format, int flags) if ((err = snd_pcm_open(&alsa_handler, 0, 0, SND_PCM_OPEN_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: playback open error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PlayBackError, snd_strerror(err)); return(0); } if ((err = snd_pcm_info(alsa_handler, &info)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: pcm info error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PcmInfoError, snd_strerror(err)); return(0); } - mp_msg(MSGT_AO, MSGL_INFO, "alsa-init: %d soundcard(s) found, using: %s\n", + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ALSA5_SoundcardsFound, cards, info.name); if (info.flags & SND_PCM_INFO_PLAYBACK) @@ -182,7 +183,7 @@ static int init(int rate_hz, int channels, int format, int flags) chninfo.channel = SND_PCM_CHANNEL_PLAYBACK; if ((err = snd_pcm_channel_info(alsa_handler, &chninfo)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: pcm channel info error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PcmChanInfoError, snd_strerror(err)); return(0); } @@ -206,7 +207,7 @@ static int init(int rate_hz, int channels, int format, int flags) if ((err = snd_pcm_channel_params(alsa_handler, ¶ms)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: error setting parameters: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_CantSetParms, snd_strerror(err)); return(0); } @@ -219,13 +220,13 @@ static int init(int rate_hz, int channels, int format, int flags) if ((err = snd_pcm_channel_setup(alsa_handler, &setup)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: error setting up channel: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_CantSetChan, snd_strerror(err)); return(0); } if ((err = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-init: channel prepare error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ChanPrepareError, snd_strerror(err)); return(0); } @@ -242,19 +243,19 @@ static void uninit(int immed) if ((err = snd_pcm_playback_drain(alsa_handler)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-uninit: playback drain error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_DrainError, snd_strerror(err)); return; } if ((err = snd_pcm_channel_flush(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-uninit: playback flush error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_FlushError, snd_strerror(err)); return; } if ((err = snd_pcm_close(alsa_handler)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-uninit: pcm close error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PcmCloseError, snd_strerror(err)); return; } } @@ -266,19 +267,19 @@ static void reset() if ((err = snd_pcm_playback_drain(alsa_handler)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-reset: playback drain error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResetDrainError, snd_strerror(err)); return; } if ((err = snd_pcm_channel_flush(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-reset: playback flush error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResetFlushError, snd_strerror(err)); return; } if ((err = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-reset: channel prepare error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResetChanPrepareError, snd_strerror(err)); return; } } @@ -290,13 +291,13 @@ static void audio_pause() if ((err = snd_pcm_playback_drain(alsa_handler)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-pause: playback drain error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PauseDrainError, snd_strerror(err)); return; } if ((err = snd_pcm_channel_flush(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-pause: playback flush error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PauseFlushError, snd_strerror(err)); return; } } @@ -307,7 +308,7 @@ static void audio_resume() int err; if ((err = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-resume: channel prepare error: %s\n", snd_strerror(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResumePrepareError, snd_strerror(err)); return; } } @@ -327,21 +328,21 @@ static int play(void* data, int len, int flags) { if (got_len == -EPIPE) /* underrun? */ { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-play: alsa underrun, resetting stream\n"); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_Underrun); if ((got_len = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-play: playback prepare error: %s\n", snd_strerror(got_len)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PlaybackPrepareError, snd_strerror(got_len)); return(0); } if ((got_len = snd_pcm_write(alsa_handler, data, len)) < 0) { - mp_msg(MSGT_AO, MSGL_ERR, "alsa-play: write error after reset: %s - giving up\n", + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_WriteErrorAfterReset, snd_strerror(got_len)); return(0); } return(got_len); /* 2nd write was ok */ } - mp_msg(MSGT_AO, MSGL_ERR, "alsa-play: output error: %s\n", snd_strerror(got_len)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_OutPutError, snd_strerror(got_len)); return(0); } return(got_len); diff --git a/libao2/ao_arts.c b/libao2/ao_arts.c index 85f5cef30d..2f539b9e8a 100644 --- a/libao2/ao_arts.c +++ b/libao2/ao_arts.c @@ -15,6 +15,7 @@ #include "afmt.h" #include "../config.h" #include "../mp_msg.h" +#include "../help_mp.h" #define OBTAIN_BITRATE(a) (((a != AFMT_U8) && (a != AFMT_S8)) ? 16 : 8) @@ -45,10 +46,10 @@ static int init(int rate_hz, int channels, int format, int flags) int frag_spec; if( (err=arts_init()) ) { - mp_msg(MSGT_AO, MSGL_ERR, "AO: [arts] %s\n", arts_error_text(err)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ARTS_CantInit, arts_error_text(err)); return 0; } - mp_msg(MSGT_AO, MSGL_INFO, "AO: [arts] Connected to sound server\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_ServerConnect); /* * arts supports 8bit unsigned and 16bit signed sample formats @@ -79,7 +80,7 @@ static int init(int rate_hz, int channels, int format, int flags) stream=arts_play_stream(rate_hz, OBTAIN_BITRATE(format), channels, "MPlayer"); if(stream == NULL) { - mp_msg(MSGT_AO, MSGL_ERR, "AO: [arts] Unable to open a stream\n"); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ARTS_CantOpenStream); arts_free(); return 0; } @@ -90,11 +91,11 @@ static int init(int rate_hz, int channels, int format, int flags) frag_spec = ARTS_PACKET_SIZE_LOG2 | ARTS_PACKETS << 16; arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); ao_data.buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); - mp_msg(MSGT_AO, MSGL_INFO, "AO: [arts] Stream opened\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_StreamOpen); - mp_msg(MSGT_AO, MSGL_INFO,"AO: [arts] buffer size: %d\n", + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_BufferSize, ao_data.buffersize); - mp_msg(MSGT_AO, MSGL_INFO,"AO: [arts] packet size: %d\n", + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_BufferSize, arts_stream_get(stream, ARTS_P_PACKET_SIZE)); return 1; diff --git a/libao2/ao_dxr2.c b/libao2/ao_dxr2.c index 9f996fdce8..c2ed656ce7 100644 --- a/libao2/ao_dxr2.c +++ b/libao2/ao_dxr2.c @@ -50,7 +50,7 @@ static int control(int cmd,void *arg){ if(v.arg != volume) { volume = v.arg; if( ioctl(dxr2_fd,DXR2_IOC_SET_AUDIO_VOLUME,&v) < 0) { - mp_msg(MSGT_AO,MSGL_ERR,"DXR2 : Setting volume to %d failed\n",volume); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_DXR2_SetVolFailed,volume); return CONTROL_ERROR; } } @@ -110,7 +110,7 @@ static int init(int rate,int channels,int format,int flags){ break; #endif default: - mp_msg(MSGT_AO,MSGL_ERR,"[AO] dxr2: %d Hz not supported, try \"-aop list=resample\"\n",rate); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_DXR2_UnsupSamplerate,rate); return 0; } diff --git a/libao2/ao_esd.c b/libao2/ao_esd.c index 807a639679..5cca049731 100644 --- a/libao2/ao_esd.c +++ b/libao2/ao_esd.c @@ -37,6 +37,7 @@ #include "afmt.h" #include "../config.h" #include "../mp_msg.h" +#include "../help_mp.h" #undef ESD_DEBUG @@ -152,8 +153,7 @@ static int init(int rate_hz, int channels, int format, int flags) if (esd_fd < 0) { esd_fd = esd_open_sound(server); if (esd_fd < 0) { - mp_msg(MSGT_AO, MSGL_ERR, - "AO: [esd] esd_open_sound failed: %s\n", + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ESD_CantOpenSound, strerror(errno)); return 0; } @@ -230,17 +230,14 @@ static int init(int rate_hz, int channels, int format, int flags) lag_serv = (esd_latency * 4.0f) / (bytes_per_sample * rate_hz); lag_seconds = lag_net + lag_serv; audio_delay += lag_seconds; - mp_msg(MSGT_AO, MSGL_INFO, - "AO: [esd] latency: [server: %0.2fs, net: %0.2fs] " - "(adjust %0.2fs)\n", lag_serv, lag_net, lag_seconds); + mp_msg(MSGT_AO, MSGL_INFO,MSGTR_AO_ESD_LatencyInfo, + lag_serv, lag_net, lag_seconds); } esd_play_fd = esd_play_stream_fallback(esd_fmt, rate_hz, server, ESD_CLIENT_NAME); if (esd_play_fd < 0) { - mp_msg(MSGT_AO, MSGL_ERR, - "AO: [esd] failed to open esd playback stream: %s\n", - strerror(errno)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ESD_CantOpenPBStream, strerror(errno)); return 0; } diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c index d26336e27a..b8e7b16406 100644 --- a/libao2/ao_mpegpes.c +++ b/libao2/ao_mpegpes.c @@ -18,6 +18,7 @@ #include "afmt.h" #include "../mp_msg.h" +#include "../help_mp.h" #ifdef HAVE_DVB #ifndef HAVE_DVB_HEAD @@ -67,7 +68,7 @@ static int control(int cmd,void *arg){ if(dvb_mixer.volume_right>255) dvb_mixer.volume_right=255; // printf("Setting DVB volume: %d ; %d \n",dvb_mixer.volume_left,dvb_mixer.volume_right); if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MIXER, &dvb_mixer) < 0)){ - mp_msg(MSGT_AO, MSGL_ERR, "DVB audio set mixer failed: %s\n", + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_CantSetMixer, strerror(errno)); return CONTROL_ERROR; } @@ -112,7 +113,7 @@ retry: case 44100: freq_id=2;break; case 32000: freq_id=3;break; default: - mp_msg(MSGT_AO, MSGL_ERR, "ao_mpegpes: %d Hz not supported, try to resample...\n",rate); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_UnsupSamplerate, rate); #if 0 if(rate>48000) rate=96000; else if(rate>44100) rate=48000; else diff --git a/libao2/ao_null.c b/libao2/ao_null.c index 17f4fe8bad..59d115a400 100644 --- a/libao2/ao_null.c +++ b/libao2/ao_null.c @@ -110,9 +110,3 @@ static float get_delay(){ drain(); return (float) buffer / (float) ao_data.bps; } - - - - - - diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 236a054e9f..ccca1cd9e8 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -14,6 +14,7 @@ #include "../config.h" #include "../mp_msg.h" #include "../mixer.h" +#include "../help_mp.h" #include "afmt.h" @@ -108,7 +109,7 @@ static int init(int rate,int channels,int format,int flags){ int fd, devs, i; if ((fd = open(oss_mixer_device, O_RDONLY)) == -1){ - mp_msg(MSGT_AO,MSGL_ERR,"audio_setup: Can't open mixer device %s: %s\n", + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantOpenMixer, oss_mixer_device, strerror(errno)); }else{ ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs); @@ -117,7 +118,7 @@ static int init(int rate,int channels,int format,int flags){ for (i=0; i 2) { if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &ao_data.channels) == -1 || ao_data.channels != channels ) { - mp_msg(MSGT_AO,MSGL_ERR,"audio_setup: Failed to set audio device to %d channels\n", channels); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantSetChans, channels); return 0; } } else { int c = ao_data.channels-1; if (ioctl (audio_fd, SNDCTL_DSP_STEREO, &c) == -1) { - mp_msg(MSGT_AO,MSGL_ERR,"audio_setup: Failed to set audio device to %d channels\n", ao_data.channels); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantSetChans, ao_data.channels); return 0; } ao_data.channels=c+1; @@ -214,7 +215,7 @@ ac3_retry: if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)==-1){ int r=0; - mp_msg(MSGT_AO,MSGL_WARN,"audio_setup: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n"); + mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_OSS_CantUseGetospace); if(ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &r)==-1){ mp_msg(MSGT_AO,MSGL_V,"audio_setup: %d bytes/frag (config.h)\n",ao_data.outburst); } else { @@ -245,8 +246,7 @@ ac3_retry: } free(data); if(ao_data.buffersize==0){ - mp_msg(MSGT_AO,MSGL_ERR,"\n *** Your audio driver DOES NOT support select() ***\n" - "Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n"); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantUseSelect); return 0; } #endif @@ -283,7 +283,7 @@ static void reset(){ uninit(1); audio_fd=open(dsp, O_WRONLY); if(audio_fd < 0){ - mp_msg(MSGT_AO,MSGL_ERR,"\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno)); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantReopen, strerror(errno)); return; } diff --git a/libao2/ao_pcm.c b/libao2/ao_pcm.c index e3484fa871..35fac018a8 100644 --- a/libao2/ao_pcm.c +++ b/libao2/ao_pcm.c @@ -8,6 +8,9 @@ #include "afmt.h" #include "audio_out.h" #include "audio_out_internal.h" +#include "../mp_msg.h" +#include "../help_mp.h" + static ao_info_t info = { @@ -111,13 +114,10 @@ static int init(int rate,int channels,int format,int flags){ wavhdr.data_length=le2me_32(0x7ffff000); wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8; - printf("PCM: File: %s (%s)\n" - "PCM: Samplerate: %iHz Channels: %s Format %s\n", - ao_outputfilename, (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate, + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_FileInfo, ao_outputfilename, + (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); - printf("PCM: Info: fastest dumping is achieved with -vc dummy -vo null\n" - "PCM: Info: to write WAVE files use -waveheader (default); " - "for RAW PCM -nowaveheader.\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintInfo); fp = fopen(ao_outputfilename, "wb"); if(fp) { @@ -127,7 +127,8 @@ static int init(int rate,int channels,int format,int flags){ } return 1; } - printf("PCM: Failed to open %s for writing!\n", ao_outputfilename); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_PCM_CantOpenOutputFile, + ao_outputfilename); return 0; } diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c index 27393b4dd7..a321035ab8 100644 --- a/libao2/ao_sdl.c +++ b/libao2/ao_sdl.c @@ -16,6 +16,7 @@ #include "../config.h" #include "../mp_msg.h" +#include "../help_mp.h" #include "audio_out.h" #include "audio_out_internal.h" @@ -171,11 +172,11 @@ static int init(int rate,int channels,int format,int flags){ /* Allocate ring-buffer memory */ for(i=0;i 1) ? "Stereo" : "Mono", audio_out_format_name(format)); + mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); if(ao_subdevice) { setenv("SDL_AUDIODRIVER", ao_subdevice, 1); - mp_msg(MSGT_AO,MSGL_INFO,"SDL: using %s audio driver\n", ao_subdevice); + mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_DriverInfo, ao_subdevice); } ao_data.channels=channels; @@ -209,7 +210,7 @@ static int init(int rate,int channels,int format,int flags){ default: aspec.format = AUDIO_S16LSB; ao_data.format = AFMT_S16_LE; - mp_msg(MSGT_AO,MSGL_WARN,"SDL: Unsupported audio format: 0x%x.\n", format); + mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, format); } /* The desired audio frequency in samples-per-second. */ @@ -230,13 +231,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*/)) { - mp_msg(MSGT_AO,MSGL_ERR,"SDL: Initializing of SDL Audio failed: %s.\n", SDL_GetError()); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_SDL_CantInit, SDL_GetError()); return 0; } /* Open the audio device and start playing sound! */ if(SDL_OpenAudio(&aspec, &obtained) < 0) { - mp_msg(MSGT_AO,MSGL_ERR,"SDL: Unable to open audio: %s\n", SDL_GetError()); + mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_SDL_CantOpenAudio, SDL_GetError()); return(0); } @@ -264,7 +265,7 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s ao_data.format = AFMT_U16_BE; break; default: - mp_msg(MSGT_AO,MSGL_WARN,"SDL: Unsupported SDL audio format: 0x%x.\n", obtained.format); + mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, obtained.format); return 0; } diff --git a/libao2/ao_sgi.c b/libao2/ao_sgi.c index 3c08b10eb9..a2f050ce16 100644 --- a/libao2/ao_sgi.c +++ b/libao2/ao_sgi.c @@ -11,6 +11,8 @@ #include "audio_out.h" #include "audio_out_internal.h" +#include "../mp_msg.h" +#include "../help_mp.h" static ao_info_t info = { @@ -31,7 +33,7 @@ static int queue_size; // to set/get/query special features/parameters static int control(int cmd, void *arg){ - printf("ao_sgi, control\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_INFO); return -1; } @@ -40,7 +42,7 @@ static int control(int cmd, void *arg){ // return: 1=success 0=fail static int init(int rate, int channels, int format, int flags) { - printf("ao_sgi, init: Samplerate: %iHz Channels: %s Format %s\n", rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); { /* from /usr/share/src/dmedia/audio/setrate.c */ @@ -51,7 +53,7 @@ static int init(int rate, int channels, int format, int flags) { rv = alGetResourceByName(AL_SYSTEM, "out.analog", AL_DEVICE_TYPE); if (!rv) { - printf("ao_sgi, play: invalid device\n"); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InvalidDevice); return 0; } @@ -63,20 +65,19 @@ static int init(int rate, int channels, int format, int flags) { x[1].value.i = AL_CRYSTAL_MCLK_TYPE; if (alSetParams(rv,x, 2)<0) { - printf("ao_sgi, init: setparams failed: %s\n", alGetErrorString(oserror())); - printf("ao_sgi, init: could not set desired samplerate\n"); + mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantSetParms_Samplerate, alGetErrorString(oserror())); } if (x[0].sizeOut < 0) { - printf("ao_sgi, init: AL_RATE was not accepted on the given resource\n"); + mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantSetAlRate); } if (alGetParams(rv,x, 1)<0) { - printf("ao_sgi, init: getparams failed: %s\n", alGetErrorString(oserror())); + mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantGetParms, alGetErrorString(oserror())); } if (frate != alFixedToDouble(x[0].value.ll)) { - printf("ao_sgi, init: samplerate is now %lf (desired rate is %lf)\n", alFixedToDouble(x[0].value.ll), frate); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_SampleRateInfo, alFixedToDouble(x[0].value.ll), frate); } sample_rate = (int)frate; } @@ -88,7 +89,7 @@ static int init(int rate, int channels, int format, int flags) { ao_config = alNewConfig(); if (!ao_config) { - printf("ao_sgi, init: %s\n", alGetErrorString(oserror())); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitConfigError, alGetErrorString(oserror())); return 0; } @@ -100,14 +101,14 @@ static int init(int rate, int channels, int format, int flags) { alSetQueueSize(ao_config, 48000); if (alSetDevice(ao_config, AL_DEFAULT_OUTPUT) < 0) { - printf("ao_sgi, init: %s\n", alGetErrorString(oserror())); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitConfigError, alGetErrorString(oserror())); return 0; } ao_port = alOpenPort("mplayer", "w", ao_config); if (!ao_port) { - printf("ao_sgi, init: Unable to open audio channel: %s\n", alGetErrorString(oserror())); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitOpenAudioFailed, alGetErrorString(oserror())); return 0; } @@ -122,7 +123,7 @@ static void uninit(int immed) { /* TODO: samplerate should be set back to the value before mplayer was started! */ - printf("ao_sgi, uninit: ...\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_Uninit); if (ao_port) { while(alGetFilled(ao_port) > 0) sginap(1); @@ -135,21 +136,21 @@ static void uninit(int immed) { // stop playing and empty buffers (for seeking/pause) static void reset() { - printf("ao_sgi, reset: ...\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_Reset); } // stop playing, keep buffers (for pause) static void audio_pause() { - printf("ao_sgi, audio_pause: ...\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_PauseInfo); } // resume playing, after audio_pause() static void audio_resume() { - printf("ao_sgi, audio_resume: ...\n"); + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_ResumeInfo); } diff --git a/libao2/ao_sun.c b/libao2/ao_sun.c index ca757660c3..eb5dc5be1c 100644 --- a/libao2/ao_sun.c +++ b/libao2/ao_sun.c @@ -26,6 +26,8 @@ #include "audio_out.h" #include "audio_out_internal.h" #include "afmt.h" +#include "../mp_msg.h" +#include "../help_mp.h" static ao_info_t info = { @@ -126,13 +128,13 @@ static int realtime_samplecounter_available(char *dev) info.play.samples = 0; if (ioctl(fd, AUDIO_SETINFO, &info)) { if (verbose>0) - printf("rtsc: SETINFO failed\n"); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_RtscSetinfoFailed); goto error; } if (write(fd, silence, len) != len) { if (verbose>0) - printf("rtsc: write failed"); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_RtscWriteFailed); goto error; } @@ -482,7 +484,7 @@ static int init(int rate,int channels,int format,int flags){ audio_fd=open(audio_dev, O_WRONLY); if(audio_fd<0){ - printf("Can't open audio device %s, %s -> nosound\n", audio_dev, strerror(errno)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_CantOpenAudioDev, audio_dev, strerror(errno)); return 0; } @@ -556,7 +558,7 @@ static int init(int rate,int channels,int format,int flags){ } if (!ok) { - printf("audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate\n", + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_UnsupSampleRate, channels, audio_out_format_name(format), rate); return 0; } @@ -588,8 +590,7 @@ static int init(int rate,int channels,int format,int flags){ } free(data); if(ao_data.buffersize==0){ - printf("\n *** Your audio driver DOES NOT support select() ***\n"); - printf("Recompile mplayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n"); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_CantUseSelect); return 0; } #ifdef __svr4__ @@ -631,7 +632,7 @@ static void reset(){ uninit(1); audio_fd=open(audio_dev, O_WRONLY); if(audio_fd<0){ - printf("\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE (%s) ***\n", strerror(errno)); + mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_SUN_CantReopenReset, strerror(errno)); return; }