# HG changeset patch # User alex # Date 1104171030 0 # Node ID 8f59f661f317222106ad821e1faf118cc744b7df # Parent 92a2b97ccc4f8f4d19cf487af47f8fc8c2faf642 hopefully final fix diff -r 92a2b97ccc4f -r 8f59f661f317 libao2/ao_alsa.c --- a/libao2/ao_alsa.c Mon Dec 27 17:55:06 2004 +0000 +++ b/libao2/ao_alsa.c Mon Dec 27 18:10:30 2004 +0000 @@ -256,8 +256,8 @@ // make sure alsa_device is null-terminated even when using strncpy etc. memset(alsa_device, 0, ALSA_DEVICE_SIZE + 1); - mp_msg(MSGT_AO,MSGL_V,"alsa-init: requested format: %d Hz, %d channels, %s\n", rate_hz, - channels, audio_out_format_name(format)); + mp_msg(MSGT_AO,MSGL_V,"alsa-init: requested format: %d Hz, %d channels, %x\n", rate_hz, + channels, format); alsa_handler = NULL; mp_msg(MSGT_AO,MSGL_V,"alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR); @@ -334,8 +334,7 @@ ao_data.bps *= 4; break; case -1: - mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: invalid format (%s) requested - output disabled\n", - audio_out_format_name(format)); + mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: invalid format (%x) requested - output disabled\n",format); return(0); break; default: @@ -587,8 +586,7 @@ alsa_format)) < 0) { mp_msg(MSGT_AO,MSGL_INFO, - "alsa-init: format %s are not supported by hardware, trying default\n", - audio_out_format_name(format)); + "alsa-init: format %x are not supported by hardware, trying default\n", format); alsa_format = SND_PCM_FORMAT_S16_LE; ao_data.format = AF_FORMAT_S16_LE; ao_data.bps = channels * rate_hz * 2; diff -r 92a2b97ccc4f -r 8f59f661f317 libao2/ao_alsa5.c --- a/libao2/ao_alsa5.c Mon Dec 27 17:55:06 2004 +0000 +++ b/libao2/ao_alsa5.c Mon Dec 27 18:10:30 2004 +0000 @@ -50,9 +50,10 @@ snd_pcm_channel_setup_t setup; snd_pcm_info_t info; snd_pcm_channel_info_t chninfo; + char buf[128]; mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ALSA5_InitInfo, rate_hz, - channels, audio_out_format_name(format)); + channels, af_fmt2str(format)); alsa_handler = NULL; @@ -111,8 +112,7 @@ ao_data.bps *= 2; break; case -1: - mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq, - audio_out_format_name(format)); + mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq,af_fmt2str(format,&buf,128)); return(0); default: break; diff -r 92a2b97ccc4f -r 8f59f661f317 libao2/ao_dsound.c --- a/libao2/ao_dsound.c Mon Dec 27 17:55:06 2004 +0000 +++ b/libao2/ao_dsound.c Mon Dec 27 18:10:30 2004 +0000 @@ -274,7 +274,7 @@ int i, j; int numsamp,sampsize; - sampsize = audio_out_format_bits(ao_data.format)>>3; // bytes per sample + sampsize = af_fmt2bits(ao_data.format)>>3; // bytes per sample numsamp = dwBytes1 / (ao_data.channels * sampsize); // number of samples for each channel in this buffer for( i = 0; i < numsamp; i++ ) for( j = 0; j < ao_data.channels; j++ ) { @@ -372,16 +372,16 @@ case AF_FORMAT_S8: break; default: - mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",audio_out_format_name(format)); + mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %x not supported defaulting to Signed 16-bit Little-Endian\n",format); format=AF_FORMAT_S16_LE; } //fill global ao_data ao_data.channels = channels; ao_data.samplerate = rate; ao_data.format = format; - ao_data.bps = channels * rate * (audio_out_format_bits(format)>>3); + ao_data.bps = channels * rate * (af_fmt2bits(format)>>3); if(ao_data.buffersize==-1) ao_data.buffersize = ao_data.bps; // space for 1 sec - mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Samplerate:%iHz Channels:%i Format:%s\n", rate, channels, audio_out_format_name(format)); + mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Samplerate:%iHz Channels:%i Format:%x\n", rate, channels, format); mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Buffersize:%d bytes (%d msec)\n", ao_data.buffersize, ao_data.buffersize / ao_data.bps * 1000); //fill waveformatex @@ -395,7 +395,7 @@ wformat.Format.nBlockAlign = 4; } else { wformat.Format.wFormatTag = (channels > 2) ? WAVE_FORMAT_EXTENSIBLE : WAVE_FORMAT_PCM; - wformat.Format.wBitsPerSample = audio_out_format_bits(format); + wformat.Format.wBitsPerSample = af_fmt2bits(format); wformat.Format.nBlockAlign = wformat.Format.nChannels * (wformat.Format.wBitsPerSample >> 3); } diff -r 92a2b97ccc4f -r 8f59f661f317 libao2/ao_sgi.c --- a/libao2/ao_sgi.c Mon Dec 27 17:55:06 2004 +0000 +++ b/libao2/ao_sgi.c Mon Dec 27 18:10:30 2004 +0000 @@ -41,8 +41,9 @@ // open & setup audio device // return: 1=success 0=fail static int init(int rate, int channels, int format, int flags) { - - mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format)); + + char buf[128]; + mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str(format, &buf, 128)); { /* from /usr/share/src/dmedia/audio/setrate.c */ diff -r 92a2b97ccc4f -r 8f59f661f317 libao2/ao_sun.c --- a/libao2/ao_sun.c Mon Dec 27 17:55:06 2004 +0000 +++ b/libao2/ao_sun.c Mon Dec 27 18:10:30 2004 +0000 @@ -457,6 +457,7 @@ audio_info_t info; int pass; int ok; + char buf[128]; setup_device_paths(); @@ -479,7 +480,7 @@ for (ok = pass = 0; pass <= 5; pass++) { /* pass 6&7 not useful */ AUDIO_INITINFO(&info); - info.play.encoding = oss2sunfmt(ao_data.format = format); + info.play.encoding = af2sunfmt(ao_data.format = format); info.play.precision = (format==AF_FORMAT_S16_LE || format==AF_FORMAT_S16_BE ? AUDIO_PRECISION_16 @@ -545,7 +546,7 @@ if (!ok) { mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_UnsupSampleRate, - channels, audio_out_format_name(format), rate); + channels, af_fmt2str(format, &buf, 128), rate); return 0; } @@ -625,7 +626,7 @@ ioctl(audio_fd, AUDIO_DRAIN, 0); AUDIO_INITINFO(&info); - info.play.encoding = oss2sunfmt(ao_data.format); + info.play.encoding = af2sunfmt(ao_data.format); info.play.precision = (ao_data.format==AF_FORMAT_S16_LE || ao_data.format==AF_FORMAT_S16_BE ? AUDIO_PRECISION_16 diff -r 92a2b97ccc4f -r 8f59f661f317 libao2/ao_win32.c --- a/libao2/ao_win32.c Mon Dec 27 17:55:06 2004 +0000 +++ b/libao2/ao_win32.c Mon Dec 27 18:10:30 2004 +0000 @@ -147,6 +147,7 @@ MMRESULT result; unsigned char* buffer; int i; + char buf[128]; switch(format){ case AF_FORMAT_AC3: @@ -155,7 +156,7 @@ case AF_FORMAT_S8: break; default: - mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",audio_out_format_name(format)); + mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str(format, &buf, 128)); format=AF_FORMAT_S16_LE; } //fill global ao_data