Mercurial > libavformat.hg
changeset 5269:bcd5ff60e3da libavformat
Stricter TMV probe
author | daniel |
---|---|
date | Fri, 09 Oct 2009 18:24:47 +0000 |
parents | 6156f7337ce8 |
children | 80542fdaba5e |
files | tmv.c |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tmv.c Tue Oct 06 17:51:28 2009 +0000 +++ b/tmv.c Fri Oct 09 18:24:47 2009 +0000 @@ -43,10 +43,19 @@ 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; }