changeset 14264:cb5fbade8a5c

af_fmt2str_short
author alex
date Tue, 28 Dec 2004 19:11:14 +0000
parents bc80d39d19e8
children bc8152b52771
files libao2/ao_alsa.c libao2/ao_alsa5.c libao2/ao_dsound.c libao2/ao_nas.c libao2/ao_oss.c libao2/ao_pcm.c libao2/ao_sdl.c libao2/ao_sgi.c libao2/ao_sun.c libao2/ao_win32.c
diffstat 10 files changed, 24 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_alsa.c	Tue Dec 28 19:11:14 2004 +0000
@@ -334,7 +334,7 @@
 	ao_data.bps *= 4;
 	break;
       case -1:
-	mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: invalid format (%x) requested - output disabled\n",format);
+	mp_msg(MSGT_AO,MSGL_ERR,"alsa-init: invalid format (%s) requested - output disabled\n",af_fmt2str_short(format));
 	return(0);
 	break;
       default:
@@ -586,7 +586,7 @@
                                              alsa_format)) < 0)
       {
          mp_msg(MSGT_AO,MSGL_INFO,
-		"alsa-init: format %x are not supported by hardware, trying default\n", format);
+		"alsa-init: format %s are not supported by hardware, trying default\n", af_fmt2str_short(format));
          alsa_format = SND_PCM_FORMAT_S16_LE;
          ao_data.format = AF_FORMAT_S16_LE;
          ao_data.bps = channels * rate_hz * 2;
--- a/libao2/ao_alsa5.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_alsa5.c	Tue Dec 28 19:11:14 2004 +0000
@@ -50,10 +50,9 @@
     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, af_fmt2str(format, buf, 128));
+	channels, af_fmt2str_short(format));
 
     alsa_handler = NULL;
 
@@ -112,7 +111,7 @@
 	    ao_data.bps *= 2;
 	    break;
 	case -1:
-	    mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq,af_fmt2str(format,buf,128));
+	    mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq,af_fmt2str_short(format));
 	    return(0);
 	default:
 	    break;
--- a/libao2/ao_dsound.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_dsound.c	Tue Dec 28 19:11:14 2004 +0000
@@ -372,7 +372,7 @@
 		case AF_FORMAT_S8:
 			break;
 		default:
-			mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %x not supported defaulting to Signed 16-bit Little-Endian\n",format);
+			mp_msg(MSGT_AO, MSGL_V,"ao_dsound: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str_short(format));
 			format=AF_FORMAT_S16_LE;
 	}   	
 	//fill global ao_data
@@ -381,7 +381,7 @@
 	ao_data.format = format;
 	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:%x\n", rate, channels, format);
+	mp_msg(MSGT_AO, MSGL_V,"ao_dsound: Samplerate:%iHz Channels:%i Format:%s\n", rate, channels, af_fmt2str_short(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
--- a/libao2/ao_nas.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_nas.c	Tue Dec 28 19:11:14 2004 +0000
@@ -387,13 +387,12 @@
 	int bytes_per_sample = channels * AuSizeofFormat(auformat);
 	int buffer_size;
 	char *server;
-	char buf[128];
 
 	nas_data=malloc(sizeof(struct ao_nas_data));
 	memset(nas_data, 0, sizeof(struct ao_nas_data));
 
 	mp_msg(MSGT_AO, MSGL_V, "ao2: %d Hz  %d chans  %s\n",rate,channels,
-		af_fmt2str(format,buf,128));
+		af_fmt2str_short(format));
 
 	ao_data.format = format;
 	ao_data.samplerate = rate;
--- a/libao2/ao_oss.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_oss.c	Tue Dec 28 19:11:14 2004 +0000
@@ -184,8 +184,8 @@
   char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
   int oss_format;
 
-//  mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz  %d chans  %s\n",rate,channels,
-//    audio_out_format_name(format));
+  mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz  %d chans  %s\n",rate,channels,
+    af_fmt2str_short(format));
 
   if (ao_subdevice)
     dsp = ao_subdevice;
@@ -275,8 +275,6 @@
 #endif
     goto ac3_retry;
   }
-//  mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n",
-//    audio_out_format_name(ao_data.format), audio_out_format_name(format));
 #if 0
   if(oss_format!=format2oss(format))
 	mp_msg(MSGT_AO,MSGL_WARN,"WARNING! Your soundcard does NOT support %s sample format! Broken audio or bad playback speed are possible! Try with '-aop list=format'\n",audio_out_format_name(format));
@@ -284,6 +282,9 @@
 
   ao_data.format = oss2format(oss_format);
   if (ao_data.format == -1) return 0;
+
+  mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n",
+    af_fmt2str_short(ao_data.format), af_fmt2str_short(format));
   
   ao_data.channels = channels;
   if(format != AF_FORMAT_AC3) {
--- a/libao2/ao_pcm.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_pcm.c	Tue Dec 28 19:11:14 2004 +0000
@@ -114,9 +114,9 @@
 	wavhdr.data_length=le2me_32(0x7ffff000);
 	wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
 
-//	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));
+	mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_FileInfo, ao_outputfilename, 
+	       (ao_pcm_waveheader?"WAVE":"RAW PCM"), rate, 
+	       (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
 	mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintInfo);
 
 	fp = fopen(ao_outputfilename, "wb");
--- a/libao2/ao_sdl.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_sdl.c	Tue Dec 28 19:11:14 2004 +0000
@@ -181,7 +181,7 @@
 	/* Allocate ring-buffer memory */
 	buffer = (unsigned char *) malloc(BUFFSIZE);
 
-//	mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", audio_out_format_name(format));
+	mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
 
 	if(ao_subdevice) {
 		setenv("SDL_AUDIODRIVER", ao_subdevice, 1);
--- a/libao2/ao_sgi.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_sgi.c	Tue Dec 28 19:11:14 2004 +0000
@@ -42,8 +42,7 @@
 // return: 1=success 0=fail
 static int init(int rate, int channels, int format, int flags) {
 
-  char buf[128];  
-  mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str(format, buf, 128));
+  mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
   
   { /* from /usr/share/src/dmedia/audio/setrate.c */
   
--- a/libao2/ao_sun.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_sun.c	Tue Dec 28 19:11:14 2004 +0000
@@ -466,8 +466,8 @@
 	enable_sample_timing = realtime_samplecounter_available(audio_dev);
     }
 
-//    printf("ao2: %d Hz  %d chans  %s [0x%X]\n",
-//	   rate,channels,audio_out_format_name(format),format);
+    printf("ao2: %d Hz  %d chans  %s [0x%X]\n",
+	   rate,channels,af_fmt2str_short(format),format);
 
     audio_fd=open(audio_dev, O_WRONLY);
     if(audio_fd<0){
--- a/libao2/ao_win32.c	Tue Dec 28 18:13:09 2004 +0000
+++ b/libao2/ao_win32.c	Tue Dec 28 19:11:14 2004 +0000
@@ -147,7 +147,6 @@
 	MMRESULT result;
 	unsigned char* buffer;
 	int i;
-	char buf[128];
    
 	switch(format){
 		case AF_FORMAT_AC3:
@@ -156,7 +155,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",af_fmt2str(format, &buf, 128));
+			mp_msg(MSGT_AO, MSGL_V,"ao_win32: format %s not supported defaulting to Signed 16-bit Little-Endian\n",af_fmt2str_short(format));
 			format=AF_FORMAT_S16_LE;
 	}   
 	//fill global ao_data 
@@ -168,11 +167,11 @@
 	  ao_data.bps*=2;
 	if(ao_data.buffersize==-1)
 	{
-		ao_data.buffersize=audio_out_format_bits(format)/8;
+		ao_data.buffersize=af_fmt2bits(format)/8;
         ao_data.buffersize*= channels;
 		ao_data.buffersize*= SAMPLESIZE;
 	}
-	mp_msg(MSGT_AO, MSGL_V,"ao_win32: Samplerate:%iHz Channels:%i Format:%s\n",rate, channels, audio_out_format_name(format));
+	mp_msg(MSGT_AO, MSGL_V,"ao_win32: Samplerate:%iHz Channels:%i Format:%s\n",rate, channels, af_fmt2str_short(format));
     mp_msg(MSGT_AO, MSGL_V,"ao_win32: Buffersize:%d\n",ao_data.buffersize);
 	
 	//fill waveformatex
@@ -189,14 +188,14 @@
     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);
     }
 	if(channels>2)
 	{
         wformat.dwChannelMask = channel_mask[channels-3];
         wformat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
-	    wformat.Samples.wValidBitsPerSample=audio_out_format_bits(format);
+	    wformat.Samples.wValidBitsPerSample=af_fmt2bits(format);
     }
   
     wformat.Format.nAvgBytesPerSec = wformat.Format.nSamplesPerSec * wformat.Format.nBlockAlign;