changeset 5302:9d7f3a448c3c libavformat

Smarten mtv's probe a bit. Check for non zero on bpp and width|height header fields. This change is among the ones suggested by Vitor Sessak in his '[FFmpeg-devel] [PATCH] Improve MTV probe' thread.
author reynaldo
date Sun, 18 Oct 2009 18:02:12 +0000
parents 08c073da6553
children 03d4d6534554
files mtv.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mtv.c	Sun Oct 18 16:13:29 2009 +0000
+++ b/mtv.c	Sun Oct 18 18:02:12 2009 +0000
@@ -25,6 +25,7 @@
  */
 
 #include "libavutil/bswap.h"
+#include "libavutil/intreadwrite.h"
 #include "avformat.h"
 
 #define MTV_ASUBCHUNK_DATA_SIZE 500
@@ -56,6 +57,10 @@
     if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V')
         return 0;
 
+    /* Check for nonzero in bpp and (width|height) header fields */
+    if(!(p->buf[51] && AV_RL16(&p->buf[52]) | AV_RL16(&p->buf[54])))
+        return 0;
+
     return AVPROBE_SCORE_MAX;
 }