Browse code

avformat/m4vdec: Check for non startcode 00 00 00 sequences in probe

Fixes miss detection of PCM as m4v
Fixes Ticket 3928

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7c1835c52a4be2e4e996f83c91a8d5a147b01100)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/09/07 23:39:39
Showing 1 changed files
... ...
@@ -33,13 +33,15 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
33 33
 
34 34
     for(i=0; i<probe_packet->buf_size; i++){
35 35
         temp_buffer = (temp_buffer<<8) + probe_packet->buf[i];
36
-        if ((temp_buffer & 0xffffff00) != 0x100)
36
+        if (temp_buffer & 0xfffffe00)
37
+            continue;
38
+        if (temp_buffer < 2)
37 39
             continue;
38 40
 
39 41
         if (temp_buffer == VOP_START_CODE)                         VOP++;
40 42
         else if (temp_buffer == VISUAL_OBJECT_START_CODE)          VISO++;
41
-        else if (temp_buffer < 0x120)                              VO++;
42
-        else if (temp_buffer < 0x130)                              VOL++;
43
+        else if (temp_buffer >= 0x100 && temp_buffer < 0x120)      VO++;
44
+        else if (temp_buffer >= 0x120 && temp_buffer < 0x130)      VOL++;
43 45
         else if (   !(0x1AF < temp_buffer && temp_buffer < 0x1B7)
44 46
                  && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++;
45 47
     }