[FFmpeg-devel] [PATCH]Do not detect mpegts-in-mov as mov

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Oct 23 10:47:53 CEST 2012


On Tuesday 23 October 2012 02:45:54 am Michael Niedermayer wrote:

> >          case MKTAG('f','t','y','p'):
> > -            score  = AVPROBE_SCORE_MAX;
> > +            if (AV_RB32(p->buf+offset) >= 8) {
> > +                score = AVPROBE_SCORE_MAX;
> > +            } else {
> > +                score = FFMAX(score, AVPROBE_SCORE_MAX - 50);
> > +            }
>
> size == 1 indicates a 64bit sized atom
> the 64bit size has to be checked too in that case

Definitely.
New patch attached.

Thank you, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/mov.c b/libavformat/mov.c
index ce4865d..d9c509b 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2879,7 +2879,14 @@ static int mov_probe(AVProbeData *p)
         case MKTAG('p','n','o','t'): /* detect movs with preview pics like ew.mov and april.mov */
         case MKTAG('u','d','t','a'): /* Packet Video PVAuthor adds this and a lot of more junk */
         case MKTAG('f','t','y','p'):
-            score  = AVPROBE_SCORE_MAX;
+            if (AV_RB32(p->buf+offset) < 8 &&
+                (AV_RB32(p->buf+offset) != 1 ||
+                 offset + 12 > (unsigned int)p->buf_size ||
+                 AV_RB64(p->buf+offset + 8) == 0)) {
+                score = FFMAX(score, AVPROBE_SCORE_MAX - 50);
+            } else {
+                score = AVPROBE_SCORE_MAX;
+            }
             offset = FFMAX(4, AV_RB32(p->buf+offset)) + offset;
             break;
         /* those are more common words, so rate then a bit less */


More information about the ffmpeg-devel mailing list