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

Michael Niedermayer michaelni
Sun Mar 18 14:25:22 CET 2007


Hi

On Sat, Mar 17, 2007 at 10:31:31PM -0500, Justin Ruggles wrote:
[...]
> > [...]
> > 
> >>+    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?
> 
> If any frames are found, buf2 is increased to skip them.  why look again
> for ac3 frames inside other ac3 frames?

well, the problem is you dont know if its really a ac3 frame or just random
data, if you where sure its a ac3 frame you wouldnt need the search for more
than 1
and speedwise theres no gain either as in random data there will be little
skipped ...


> 
> > 
> >>     }
> >>-
> >>-    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 ...
> 
> OK.  I was having issues with a couple AC-3 files being misdetected as
> MPEG-PS...but I'll go ahead and change it to AVPROBE_SCORE_MAX / 2.

are these files available somewhere?

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

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- 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/a3680b75/attachment.pgp>



More information about the ffmpeg-devel mailing list