[FFmpeg-devel] [PATCH 1/3] avformat/m4vdec: Fix detection of raw MPEG-4 ES Studio

Michael Niedermayer michael at niedermayer.cc
Mon Apr 30 00:56:14 EEST 2018


Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavformat/m4vdec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/m4vdec.c b/libavformat/m4vdec.c
index 34d434f7d2..be30f86a5c 100644
--- a/libavformat/m4vdec.c
+++ b/libavformat/m4vdec.c
@@ -29,6 +29,7 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
 {
     uint32_t temp_buffer = -1;
     int VO = 0, VOL = 0, VOP = 0, VISO = 0, res = 0;
+    int res_main = 0;
     int i;
 
     for (i = 0; i < probe_packet->buf_size; i++) {
@@ -46,11 +47,16 @@ static int mpeg4video_probe(AVProbeData *probe_packet)
             VO++;
         else if (temp_buffer >= 0x120 && temp_buffer < 0x130)
             VOL++;
+        else if (temp_buffer == 0x1B7 || temp_buffer == 0x1B8)
+            res_main++;
         else if (!(0x1AF < temp_buffer && temp_buffer < 0x1B7) &&
                  !(0x1B9 < temp_buffer && temp_buffer < 0x1C4))
             res++;
     }
 
+    if (res_main && 2*res_main < VOP)
+        res += res_main;
+
     if (VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res == 0)
         return VOP+VO > 4 ? AVPROBE_SCORE_EXTENSION : AVPROBE_SCORE_EXTENSION/2;
 
-- 
2.17.0



More information about the ffmpeg-devel mailing list