[FFmpeg-devel] [PATCH]lavf/icodec: Improve probe function

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Jan 12 13:49:37 CET 2016


Hi!

On Tuesday 12 January 2016 01:33:53 pm Carl Eugen Hoyos wrote:
>
> Attached patch improves ico probing, previously mpeg-2 frames could be
> detected.

Wikipedia claims that planes can be 0, new patch attached.

Carl Eugen
-------------- next part --------------
diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index 22e2099..4d6e6dc 100644
--- a/libavformat/icodec.c
+++ b/libavformat/icodec.c
@@ -44,8 +44,12 @@ typedef struct {
 
 static int probe(AVProbeData *p)
 {
-    if (AV_RL16(p->buf) == 0 && AV_RL16(p->buf + 2) == 1 && AV_RL16(p->buf + 4))
-        return AVPROBE_SCORE_MAX / 4;
+    if (   AV_RL16(p->buf) == 0
+        && AV_RL16(p->buf + 2) == 1
+        && AV_RL16(p->buf + 4)
+        && !(AV_RL16(p->buf + 10) & ~1)
+        && !p->buf[13])
+        return AVPROBE_SCORE_MAX / 4 + 1;
     return 0;
 }
 


More information about the ffmpeg-devel mailing list