[FFmpeg-devel] [PATCH]Decode some invalid wav files

Daniel Verkamp daniel
Tue Feb 2 02:03:21 CET 2010


On Mon, Feb 1, 2010 at 5:50 PM, Carl Eugen Hoyos
<cehoyos at rainbow.studorg.tuwien.ac.at> wrote:
> Hi!
>
> wav files that are produced with ffmpeg -i input -f wav - (as in issue 1721)
> cannot be decoded with ffmpeg, but with mplayer (at least with -ac +pcm).
> Attached patch is just a guess how these files could be decoded (tested with
> the sample from issue 1721).
>

>--- libavformat/wav.c	(revision 21600)
>+++ libavformat/wav.c	(working copy)
>@@ -223,7 +223,7 @@
>     av_set_pts_info(st, 64, 1, st->codec->sample_rate);
>
>     size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));
>-    if (rf64)
>+    if (rf64 || !size)
>         size = data_size;
>     if (size < 0)
>         return -1;

This doesn't look right - data_size is only set in the rf64 case (read
from a special rf64-only header), so it is some random value at this
point for a non-rf64 file.  This probably works by accident (on my
system, it currently happens to get initialized to a large positive
value).

-- Daniel Verkamp



More information about the ffmpeg-devel mailing list