[FFmpeg-devel] [PATCH] Stricter TMV probe

Daniel Verkamp daniel
Mon Sep 14 21:34:50 CEST 2009


Hi,

In the spirit of the discussion about probe scores, here is an
improved probe routine for TMV (currently it is only checking for 4
printable-ASCII bytes at the beginning of the file).

Thanks,
-- Daniel Verkamp
-------------- next part --------------
Index: libavformat/tmv.c
===================================================================
--- libavformat/tmv.c	(revision 19841)
+++ libavformat/tmv.c	(working copy)
@@ -45,7 +45,12 @@
 
 static int tmv_probe(AVProbeData *p)
 {
-    if (AV_RL32(p->buf) == TMV_TAG)
+    if (AV_RL32(p->buf) == TMV_TAG &&
+        AV_RL16(p->buf+4) && // samplerate
+        AV_RL16(p->buf+6) && // chunksize
+               !p->buf[8] && // compmethod
+                p->buf[9] && // charcols
+                p->buf[10])  // charrows
         return AVPROBE_SCORE_MAX;
     return 0;
 }



More information about the ffmpeg-devel mailing list