Commit 1ad29e0e authored by reimar's avatar reimar

Vastly improved mm_probe function, passes probetest.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19851 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7b9e10c1
...@@ -58,10 +58,22 @@ typedef struct { ...@@ -58,10 +58,22 @@ typedef struct {
static int mm_probe(AVProbeData *p) static int mm_probe(AVProbeData *p)
{ {
int len, type, fps, w, h;
if (p->buf_size < MM_HEADER_LEN_AV + MM_PREAMBLE_SIZE)
return 0;
/* the first chunk is always the header */ /* the first chunk is always the header */
if (AV_RL16(&p->buf[0]) != MM_TYPE_HEADER) if (AV_RL16(&p->buf[0]) != MM_TYPE_HEADER)
return 0; return 0;
if (AV_RL32(&p->buf[2]) != MM_HEADER_LEN_V && AV_RL32(&p->buf[2]) != MM_HEADER_LEN_AV) len = AV_RL32(&p->buf[2]);
if (len != MM_HEADER_LEN_V && len != MM_HEADER_LEN_AV)
return 0;
fps = AV_RL16(&p->buf[8]);
w = AV_RL16(&p->buf[12]);
h = AV_RL16(&p->buf[14]);
if (!fps || fps > 60 || !w || w > 2048 || !h || h > 2048)
return 0;
type = AV_RL16(&p->buf[len]);
if (!type || type > 0x31)
return 0; return 0;
/* only return half certainty since this check is a bit sketchy */ /* only return half certainty since this check is a bit sketchy */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment