[MPlayer-dev-eng] [PATCH] make -format to work with -ao pcm:nowaveheader

Giacomo Comes comes at naic.edu
Mon Aug 14 20:22:30 CEST 2006


On Mon, Aug 14, 2006 at 02:21:30PM -0400, Giacomo Comes wrote:
> On Sun, Aug 13, 2006 at 09:16:36PM +0200, Reimar Döffinger wrote:
> > Hello,
> > On Wed, Aug 09, 2006 at 10:48:04AM -0400, Giacomo Comes wrote:
> > > +	} else {
> > > +            bits=(((format >> 3) & 7) + 1) * 8;
> > > +	}
> > 
> > I think there is a macro for this in af_format.h or so.
> > 
> > Greetings,
> > Reimar Döffinger
> 
> New patch using af_fmt2bits.
> I have also changed the info if -ao pcm:nowaveheader is used
> from:
> [AO PCM] Info: Use -format to set the format of RAW PCM files (default: s16be)
> to:
> [AO PCM] Info: Use -format to set the format of RAW PCM files
> 
> because the default format is the one of the input audio stream.
> 
> Giacomo

Patch attached!

Giacomo
-------------- next part --------------
diff -Nraub mplayer.ori/help/help_mp-en.h mplayer/help/help_mp-en.h
--- mplayer.ori/help/help_mp-en.h	2006-08-07 10:13:55.000000000 -0400
+++ mplayer/help/help_mp-en.h	2006-08-14 14:11:55.000000000 -0400
@@ -1092,7 +1092,8 @@
 // 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_FileInfo "[AO PCM] File: %s (%s)\nPCM: Samplerate: %iHz Channels: %s Format: %s\n"
+#define MSGTR_AO_PCM_RawInfo "[AO PCM] Info: Use -format to set the format of RAW PCM files\n"
 #define MSGTR_AO_PCM_HintInfo "[AO PCM] Info: Faster dumping is achieved with -vc null -vo null -ao pcm:fast\n[AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).\n"
 #define MSGTR_AO_PCM_CantOpenOutputFile "[AO PCM] Failed to open %s for writing!\n"
 
diff -Nraub mplayer.ori/libao2/ao_pcm.c mplayer/libao2/ao_pcm.c
--- mplayer.ori/libao2/ao_pcm.c	2006-06-05 15:46:03.000000000 -0400
+++ mplayer/libao2/ao_pcm.c	2006-08-14 14:12:16.000000000 -0400
@@ -102,6 +102,7 @@
 	   this means that the following "if" is a kludge and should
 	   really be a switch to be correct in all cases */
 
+	if(ao_pcm_waveheader) {
 	bits=8;
 	switch(format){
 	case AF_FORMAT_S8:
@@ -113,6 +114,9 @@
 	    bits=16;
 	    break;
 	}
+	} else {
+            af_fmt2bits(format);
+	}
 
 	ao_data.outburst = 65536;
 	ao_data.buffersize= 2*65536;
@@ -133,6 +137,8 @@
 	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));
+	if(!ao_pcm_waveheader)
+	    mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_RawInfo);
 	mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintInfo);
 
 	fp = fopen(ao_outputfilename, "wb");


More information about the MPlayer-dev-eng mailing list