[SCM] libav/experimental: Try harder to avoid false positives for DV probe. Require at least one signature match per provided 1MB of probe data, and if there is only a single match, return at most MAX/4. Fixes issue1382 but could/should probably still be improved.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:51:07 UTC 2013


The following commit has been merged in the experimental branch:
commit 6377de611a778273f307dfe43e43b4f9f0401186
Author: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
Date:   Mon Sep 14 22:03:07 2009 +0000

    Try harder to avoid false positives for DV probe.
    Require at least one signature match per provided 1MB of probe data,
    and if there is only a single match, return at most MAX/4.
    Fixes issue1382 but could/should probably still be improved.
    
    Originally committed as revision 19848 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/dv.c b/libavformat/dv.c
index a75b4a6..1623953 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -488,6 +488,7 @@ static int dv_probe(AVProbeData *p)
 {
     unsigned state, marker_pos = 0;
     int i;
+    int matches = 0;
 
     if (p->buf_size < 5)
         return 0;
@@ -495,14 +496,19 @@ static int dv_probe(AVProbeData *p)
     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 && p->buf_size / matches < 1024*1024) {
+        if (matches > 4)
+            return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match
+        return AVPROBE_SCORE_MAX/4;
+    }
     return 0;
 }
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list