[MPlayer-dev-eng] [PATCH] wav max filesize should be 4G, not 2G

Rob McMullen robm at users.sourceforge.net
Tue Apr 27 00:26:33 CEST 2010


On a 3h40m file, creating a .wav file using:

mplayer -vc null -vo null -ao pcm:fast:file=test.wav -aid 128 test.vob

resulted in a 2.6G file, but the .wav header reported the data size of
just under 2G: 0x7ffff000.  The RIFF file header is defined as a DWORD
in the Microsoft docs -- a 32 bit unsigned integer, so the max
filesize in the generated .wav header should be 0xfffff000.

References:

http://oreilly.com/www/centers/gff/formats/micriff/
http://msdn.microsoft.com/en-us/library/dd757929%28VS.85%29.aspx#overview
-------------- next part --------------
Index: libao2/ao_pcm.c
===================================================================
--- libao2/ao_pcm.c	(revision 31027)
+++ libao2/ao_pcm.c	(working copy)
@@ -189,7 +189,7 @@
     fp = fopen(ao_outputfilename, "wb");
     if(fp) {
         if(ao_pcm_waveheader){ /* Reserve space for wave header */
-            write_wave_header(fp, 0x7ffff000);
+            write_wave_header(fp, 0xfffff000);
         }
         return 1;
     }
@@ -210,7 +210,7 @@
 #endif
         if (broken_seek || fseek(fp, 0, SEEK_SET) != 0)
             mp_msg(MSGT_AO, MSGL_ERR, "Could not seek to start, WAV size headers not updated!\n");
-        else if (data_length > 0x7ffff000)
+        else if (data_length > 0xfffff000)
             mp_msg(MSGT_AO, MSGL_ERR, "File larger than allowed for WAV files, may play truncated!\n");
         else {
             write_wave_header(fp, data_length);


More information about the MPlayer-dev-eng mailing list