[MPlayer-dev-eng] PATCH: ao_pcm

Tobias Diedrich td at informatik.uni-hannover.de
Sat Mar 2 01:23:18 CET 2002


Here's a small patch agains ao_pcm.c.
I wanted to dump the audio stream of an avi, but the sync code seems
to be doing strange things (Video & Audio getting more and more out of
sync). Maybe there's a better fix than this one.

-- 
Tobias								PGP: 0x9AC7E0BC
-------------- next part --------------
Index: main/libao2/ao_pcm.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_pcm.c,v
retrieving revision 1.4
diff -u -r1.4 ao_pcm.c
--- main/libao2/ao_pcm.c	24 Nov 2001 05:21:22 -0000	1.4
+++ main/libao2/ao_pcm.c	2 Mar 2002 00:32:12 -0000
@@ -14,6 +14,8 @@
 
 LIBAO_EXTERN(pcm)
 
+extern int vo_pts;
+
 char *ao_outputfilename = NULL;
 int ao_pcm_waveheader = 1;
 
@@ -82,7 +84,7 @@
 	printf("PCM: Info - to write WAVE files use -waveheader (default), for RAW PCM -nowaveheader.\n");
 	fp = fopen(ao_outputfilename, "wb");
 
-	ao_data.outburst = 4096;
+	ao_data.outburst = 65536;
 
 
 	if(fp) {
@@ -98,7 +100,7 @@
 static void uninit(){
 	
 	if(ao_pcm_waveheader){ /* Write wave header */
-		wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr);
+		wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
 		fseek(fp, 0, SEEK_SET);
 		fwrite(&wavhdr,sizeof(wavhdr),1,fp);
 	}
@@ -126,7 +128,7 @@
 // return: how many bytes can be played without blocking
 static int get_space(){
 
-    return ao_data.outburst;
+    return ao_data.pts < vo_pts ? ao_data.outburst : 0;
 }
 
 // plays 'len' bytes of 'data'


More information about the MPlayer-dev-eng mailing list