[FFmpeg-devel] [PATCH] stricter dnxhd test

Reimar Döffinger Reimar.Doeffinger
Mon Sep 14 22:54:03 CEST 2009


I believe this to be correct in so far as our decoder should fail for
any formats this rejects.
Unfortunately I was not able to find any samples for raw DNxHD (I thought
there were some in the samples archive, but I didn't find any), so it is
untested...
Index: libavformat/raw.c
===================================================================
--- libavformat/raw.c   (revision 19844)
+++ libavformat/raw.c   (working copy)
@@ -558,10 +558,17 @@
 static int dnxhd_probe(AVProbeData *p)
 {
     static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01};
-    if (!memcmp(p->buf, header, 5))
-        return AVPROBE_SCORE_MAX;
-    else
+    int w, h, compression_id;
+    if (memcmp(p->buf, header, 5))
         return 0;
+    h = AV_RB16(p->buf + 0x18);
+    w = AV_RB16(p->buf + 0x1a);
+    if (!w || !h)
+        return 0;
+    compression_id = AV_RB32(p->buf + 0x28);
+    if (compression_id < 1237 || compression_id > 1253)
+        return 0;
+    return AVPROBE_SCORE_MAX;
 }
 #endif
 




More information about the ffmpeg-devel mailing list