[Ffmpeg-devel] [PATCH] read multiple frames in ac3_probe

Michael Niedermayer michaelni
Sun Mar 18 03:44:14 CET 2007


Hi

On Sat, Mar 17, 2007 at 06:39:45PM -0500, Justin Ruggles wrote:
> Hello,
> 
> Here is a patch to make ac3_probe() work like mp3_read_probe().  It
> reads as many frames as are in the probe buffer and scores based on how
> many valid frames are found at the start of the buffer and overall.
> 
> The one thing I don't like so much is that it must call ac3_common_init.
>  So for AC-3 decoding or encoding, it means that function will get
> called at least 3 times: probe, parse, decode/encode.  It might be worth
> it to go back to hardcoding that AC-3 framesize table to avoid this.
> What do you think?

yes, i think hardcoding this 228 byte table is the simplest solution



[...]
> +    while(buf < end) {
> +        buf2 = buf;
> +
> +        for(frames = 0; buf2 < end; frames++) {
> +            if(ff_ac3_parse_header(buf2, &hdr) < 0)
> +                break;
> +            buf2 += hdr.frame_size;
> +        }
> +        max_frames = FFMAX(max_frames, frames);
> +        if(buf == p->buf)
> +            first_frames = frames;
> +
> +        if(!frames)
> +            buf++;
> +        else

> +            buf = buf2;

why?


>      }
> -
> -    return score;
> +    if   (first_frames>=3) return AVPROBE_SCORE_MAX * 3 / 4;

> +    else if(max_frames>=3) return AVPROBE_SCORE_MAX / 2 + 10;

theres a possible problem with this, mpeg-ps generally returns
AVPROBE_SCORE_MAX/2+2
this returns more and mpeg-ps can contain several ac3 frames with no
intervening mpeg-ps headers ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The educated differ from the uneducated as much as the living from the
dead. -- Aristotle 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070318/577f95e7/attachment.pgp>



More information about the ffmpeg-devel mailing list