summaryrefslogtreecommitdiff
path: root/libavformat/tmv.c
diff options
context:
space:
mode:
authorDaniel Verkamp <daniel@drv.nu>2009-10-09 18:24:47 +0000
committerDaniel Verkamp <daniel@drv.nu>2009-10-09 18:24:47 +0000
commitf19ae9ea4dbde5e9ffb19202e708443c111fc1cc (patch)
treeee5e2444af86af352a43bec1d9164d82d98ce2f1 /libavformat/tmv.c
parent0359289d1d2ac9f57a1d10f26c0e7b23c5a05230 (diff)
Stricter TMV probe
Originally committed as revision 20194 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/tmv.c')
-rw-r--r--libavformat/tmv.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index 566f562810..4561a030e9 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -43,10 +43,19 @@ typedef struct TMVContext {
unsigned stream_index;
} TMVContext;
+#define PROBE_MIN_SAMPLE_RATE 5000
+#define PROBE_MAX_FPS 120
+#define PROBE_MIN_AUDIO_SIZE (PROBE_MIN_SAMPLE_RATE / PROBE_MAX_FPS)
+
static int tmv_probe(AVProbeData *p)
{
- if (AV_RL32(p->buf) == TMV_TAG)
- return AVPROBE_SCORE_MAX;
+ if (AV_RL32(p->buf) == TMV_TAG &&
+ AV_RL16(p->buf+4) >= PROBE_MIN_SAMPLE_RATE &&
+ AV_RL16(p->buf+6) >= PROBE_MIN_AUDIO_SIZE &&
+ !p->buf[8] && // compression method
+ p->buf[9] && // char cols
+ p->buf[10]) // char rows
+ return AVPROBE_SCORE_MAX / (p->buf[9] == 40 && p->buf[10] == 25)? 1 : 4;
return 0;
}