[FFmpeg-devel] [PATCH] improve DV probe score

Reimar Döffinger Reimar.Doeffinger
Sun Sep 13 23:35:35 CEST 2009


Hello,
this is a suggestion for fixing issue1382.
It returns the rather high probe value of 3/4 of max only when multiple
DV-typical bit patterns were found (ca. 128 bit worth), otherwise only
1/3 of max.
Though I think with the improved mp3 probe it might make sense to
increase its values a bit, too...

Index: libavformat/dv.c
===================================================================
--- libavformat/dv.c    (revision 19824)
+++ libavformat/dv.c    (working copy)
@@ -488,6 +488,7 @@
 {
     unsigned state, marker_pos = 0;
     int i;
+    int matches = 0;
 
     if (p->buf_size < 5)
         return 0;
@@ -495,14 +496,18 @@
     state = AV_RB32(p->buf);
     for (i = 4; i < p->buf_size; i++) {
         if ((state & 0xffffff7f) == 0x1f07003f)
-            return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match
+            matches++;
         if (state == 0x003f0700 || state == 0xff3f0700)
             marker_pos = i;
         if (state == 0xff3f0701 && i - marker_pos == 80)
-            return AVPROBE_SCORE_MAX/4;
+            matches++;
         state = (state << 8) | p->buf[i];
     }
 
+    if (matches > 3)
+        return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match
+    else if (matches)
+        return AVPROBE_SCORE_MAX/3;
     return 0;
 }
 




More information about the ffmpeg-devel mailing list