[Ffmpeg-devel] [PATCH] Fix DTS in WAV file playback.
Mon May 8 01:26:22 CEST 2006
Benjamin Zores <ben at geexbox.org> writes:
> On Sun, 19 Feb 2006 00:52:20 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
>> On Sun, Feb 19, 2006 at 12:30:25AM +0100, Benjamin Zores wrote:
>> > On Sat, 18 Feb 2006 22:36:27 +0100
>> > Michael Niedermayer <michaelni at gmx.at> wrote:
>> > > iam not too happy eith this patch, but i cant think of a better
>> > > way to do it so its ok and can be applied
>> > I don't like the hack much myself but as you've said, i can't see
>> > a 'less worse' way. Anyhow, please consider this revised version
>> > then. It provides a better (and sure) way to handle DTS header.
>> is it possible to require more then 1 dts header for detection? this would
>> reduce the chance of false detections ...
>> having 4bytes matching will happen approximately once in 2^32 cases
>> but if you search 16384 cases then its down to once in 2^18 cases
> Here's a revised patch. It checks for 4 valid DTS frame signatures
> before concluding it's DTS codec and not PCM.
> "My life, and by extension everyone else's is meaningless."
> Bender, Futurama
> Index: libavformat/wav.c
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/wav.c,v
> retrieving revision 1.60
> diff -u -r1.60 wav.c
> --- libavformat/wav.c 12 Jan 2006 22:43:26 -0000 1.60
> +++ libavformat/wav.c 24 Feb 2006 11:17:06 -0000
> @@ -292,6 +292,44 @@
> return 0;
> +/* Most WAV files with DTS audio are broken and use 0x01 (PCM) as format
> + ID instead of 0x2001 (DTS). If the format found is 0x01, check the first
> + bytes after 'data' for a valid DTS header. */
> +static void find_dts_header (ByteIOContext *pb, AVCodecContext *codec)
> + unsigned int i, dts_frames = 0;
> + unsigned char *buf = pb->buf_ptr;
> + for (i = 0; i < 16384; i += 2) /* vlc uses 16384*4 (4 DTS frames) */
Shouldn't there be some check of the buffer size here, or am I
mru at inprovide.com
More information about the ffmpeg-devel