]> git.sesse.net Git - ffmpeg/commitdiff
bit: rewrite probe
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 25 Sep 2011 03:15:30 +0000 (05:15 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 25 Sep 2011 03:33:09 +0000 (05:33 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/bit.c

index 5fb3d552f3b9917e3e5e4ef30113088583fcafcb..774ddcb5ae467addffcd1fa1c182ada6363ad412 100644 (file)
 
 static int probe(AVProbeData *p)
 {
-    int i;
-    i=AV_RL16(&p->buf[0]);
-    if(i != SYNC_WORD)
-        return 0;
-
-    switch(AV_RL16(&p->buf[2]))
-    {
-    case 0x40:
-    case 0x50:
-        return AVPROBE_SCORE_MAX/2;
-    default:
-        return 0;
+    int i, j;
+
+    for(i=0; i+3<p->buf_size && i< 10*0x50; ){
+        if(AV_RL16(&p->buf[0]) != SYNC_WORD)
+            return 0;
+        j=AV_RL16(&p->buf[2]);
+        if(j!=0x40 && j!=0x50)
+            return 0;
+        i+=j;
     }
+    return AVPROBE_SCORE_MAX/2;
 }
 
 static int read_header(AVFormatContext *s, AVFormatParameters *ap)