[FFmpeg-devel] [RFC]Improve adp detection

Carl Eugen Hoyos cehoyos at ag.or.at
Wed Oct 30 00:43:09 CET 2013


Hi!

All zeros (and all other non-changing values) are currently detected as adp.
Attached patch tries to improve this, better ideas (and patches) very welcome!

I will backport whatever will be committed.

Carl Eugen
-------------- next part --------------
diff --git a/libavformat/adp.c b/libavformat/adp.c
index c5feac4..88e0f22 100644
--- a/libavformat/adp.c
+++ b/libavformat/adp.c
@@ -26,7 +26,8 @@
 
 static int adp_probe(AVProbeData *p)
 {
-    int i;
+    int i, changes = 0;
+    char last = 0;
 
     if (p->buf_size < 32)
         return 0;
@@ -34,6 +35,13 @@ static int adp_probe(AVProbeData *p)
     for (i = 0; i < p->buf_size - 3; i+=32)
         if (p->buf[i] != p->buf[i+2] || p->buf[i+1] != p->buf[i+3])
             return 0;
+        else {
+            if (p->buf[i] != last)
+                changes++;
+            last = p->buf[i];
+        }
+    if (changes <= 1)
+        return 0;
 
     return p->buf_size < 260 ? 1 : AVPROBE_SCORE_MAX / 4;
 }


More information about the ffmpeg-devel mailing list