tta: make probing more robust

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2013-05-28 11:46:10 +00:00
parent 35e683e457
commit ced0307ea9

View File

@ -33,9 +33,11 @@ typedef struct {
static int tta_probe(AVProbeData *p)
{
const uint8_t *d = p->buf;
if (d[0] == 'T' && d[1] == 'T' && d[2] == 'A' && d[3] == '1')
if (AV_RL32(&p->buf[0]) == MKTAG('T', 'T', 'A', '1') &&
(AV_RL16(&p->buf[4]) == 1 || AV_RL16(&p->buf[4]) == 2) &&
AV_RL16(&p->buf[6]) > 0 &&
AV_RL16(&p->buf[8]) > 0 &&
AV_RL32(&p->buf[10]) > 0)
return AVPROBE_SCORE_EXTENSION + 30;
return 0;
}