[FFmpeg-devel] [PATCH] ACT demuxer

Michael Niedermayer michaelni
Mon Feb 25 13:41:59 CET 2008


On Mon, Feb 25, 2008 at 01:16:48PM +0600, Vladimir Voroshilov wrote:
> Hi, Michael
> 
> On Mon, Feb 25, 2008 at 12:36 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > [...]
> 
> >  > +{
> >  > +    int score=0;
> >
> > > +
> >  > +    if ((AV_RL32(&p->buf[0]) != RIFF_TAG) ||
> >  > +        (AV_RL32(&p->buf[8]) != WAVE_TAG) ||
> >  > +        (AV_RL32(&p->buf[16]) != 16))
> >  > +    return 0;
> >  > +
> >
> >  > +    if(match_ext(p->filename, "act"))
> >  > +        score=AVPROBE_SCORE_MAX/4;
> >
> >  iam against this, if detection is done based on the filename
> >  then theres no need for act_probe()
> >
> >
> >  > +
> >  > +    if(p->buf_size>256 && p->buf[256]==0x84)
> >  > +        score=AVPROBE_SCORE_MAX;
> >
> >  Please use more than 1 byte + the 1 byte fmt size to detect act
> >  this seperates it from riff wave only by <16bit.
> >
> >
> 
> Well.
> What do i know  about ACT ?
> 1. it usually has .ACT extension (not reliable)

> 2. First 44 bytes are regular WAV header with 0x01 PCM tag (not reliable)

Well you could check a few bytes from the header.


> 3. bytes 44-256 and 264-511 are filled by zero (not reliable too)

Do you have an act file which contains non zero bytes there? If not these
could be checked as well.


> 4. the rest are 512 bytes long chunks with 2 of 6 zero-filled padding
> data at the end (unable to differ from WAV data).
> 
> So there is no reliable method for format detection.
> We always can create correct WAV file which will look like ACT

Yes, but luckily we dont need a 100% reliable check, we just need one
which is sufficiently reliable, checking 2 bytes where one (the size) has
a very high chance of matching a valid wav, could easily lead to 
1 misdetectionsin in 1000.
Checking 10 bytes would if half of them are random give better than
1 misdetection in 2^40.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080225/66c430eb/attachment.pgp>



More information about the ffmpeg-devel mailing list