[MPlayer-dev-eng] [PATCH] ao_pcm is unable to output raw PCM audio

Giacomo Comes comes at naic.edu
Thu Mar 29 22:43:57 CEST 2007


On Tue, Mar 27, 2007 at 05:01:50PM +0200, Reimar Döffinger wrote:
> Hello,
> On Tue, Mar 27, 2007 at 09:55:11AM -0400, Calvin Walton wrote:
> > On 3/27/07, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> 
> > wrote:
> > >On Tue, Mar 27, 2007 at 01:36:58AM -0400, Calvin Walton wrote:
> > >> I noticed that due to the way suboptions are parsed, there is
> > >> currently no way to disable wave output on ao_pcm - boolean options to
> > >> not support negation, and the waveheader option is on by default.
> > >
> > >????
> > >Did you try nowaveheader??
> > 
> > I'm afraid I did have a little, um misunderstanding there, and my
> > problem was unrelated, please ignore this patch.
> 
> If the documentation is unclear somewhere improvements are welcome.
> Actually I changing the help message to give an example how to get raw
> PCM probably is a good idea instead of showing how to get the default
> behaviour which is somewhat pointless...
> 
What about the attached patch?
It is my old patch to use -format with raw pcm and I have included
some output info about waveheader/nowaveheader
WARNING: patch contains a cosmetic.

Ciao
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	2007-03-23 11:24:42.000000000 -0400
+++ mplayer/help/help_mp-en.h	2007-03-29 16:39:58.000000000 -0400
@@ -1125,8 +1125,11 @@
 // 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: 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_FileInfo "[AO PCM] File: %s (%s)\nPCM: Samplerate: %iHz Channels: %s Format: %s\n"
+#define MSGTR_AO_PCM_HintInfo "[AO PCM] Info: Faster dumping is achieved with -vc null -vo null -ao pcm:fast\n"
+#define MSGTR_AO_PCM_HintWave "[AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default)\n"
+#define MSGTR_AO_PCM_HintRaw "[AO PCM] Info: To write RAW files use -ao pcm:nowaveheader\n"
+#define MSGTR_AO_PCM_RawInfo "[AO PCM] Info: Use -format to set the format of RAW PCM files\n"
 #define MSGTR_AO_PCM_CantOpenOutputFile "[AO PCM] Failed to open %s for writing!\n"
 
 // ao_sdl.c
diff -Nraub mplayer.ori/libao2/ao_pcm.c mplayer/libao2/ao_pcm.c
--- mplayer.ori/libao2/ao_pcm.c	2006-12-11 14:35:25.000000000 -0400
+++ mplayer/libao2/ao_pcm.c	2007-03-29 16:27:01.000000000 -0400
@@ -88,6 +88,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:
@@ -99,6 +100,9 @@
 	    bits=16;
 	    break;
 	}
+	} else {
+            bits=af_fmt2bits(format);
+	}
 
 	ao_data.outburst = 65536;
 	ao_data.buffersize= 2*65536;
@@ -126,6 +130,12 @@
 	       (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);
+	if(!ao_pcm_waveheader) {
+			mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_RawInfo);
+			mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintWave);
+		}
+        else
+		mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintRaw);
 
 	fp = fopen(ao_outputfilename, "wb");
 	if(fp) {


More information about the MPlayer-dev-eng mailing list