[Ffmpeg-devel] [PATCH] Fix DTS in WAV file playback.

Michael Niedermayer michaelni
Fri Feb 24 12:50:49 CET 2006


Hi

On Fri, Feb 24, 2006 at 12:22:42PM +0100, Benjamin Zores wrote:
> On Sun, 19 Feb 2006 00:52:20 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > Hi
> > 
> > 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.

ok, now upon taking a closer look i see you access the internal io buffer
directly this is not ok, use get_*()

a clean & simple way to implement this would be something like:

uint64_t state=0;
for(i=0; i<16384; i+=2){
    state= (state<<16) + get_be16(pb);
    if(  (state & 0xFFFFFFFF) == 0xF00BA900
       ||(state & 0xFFFFFFFF) == 0x0BF000A9
       ||(...
        dts_frames++
}
url_fseek(pb, -i, SEEK_CUR);
return dts_frames > 3;

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list