diff options
author | David Goldwich <david.goldwich@gmail.com> | 2013-10-24 15:24:26 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-11-04 18:43:18 +0100 |
commit | 0a7fef39fc578bd7c90fd2646299f8cad722ecb1 (patch) | |
tree | d8bcbdb469afd37908b2d231a61202e26ccd09f7 | |
parent | 1c736bedd9891501960ebac0f7c05eb60225e947 (diff) | |
download | ffmpeg-0a7fef39fc578bd7c90fd2646299f8cad722ecb1.tar.gz |
omadec: loosen format probing constraints
Imporoves detection of some files in the wild:
- ID3v2 a.k.a. "ea3" header is optional.
- Version and flags in ID3v2 header are unspecified.
Signed-off-by: David Goldwich <david.goldwich@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r-- | libavformat/omadec.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/libavformat/omadec.c b/libavformat/omadec.c index eeab70ea0c..709a60b6ff 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -446,23 +446,16 @@ static int oma_read_packet(AVFormatContext *s, AVPacket *pkt) static int oma_read_probe(AVProbeData *p) { - const uint8_t *buf; + const uint8_t *buf = p->buf; unsigned tag_len = 0; - buf = p->buf; - - if (p->buf_size < ID3v2_HEADER_SIZE || - !ff_id3v2_match(buf, ID3v2_EA3_MAGIC) || - buf[3] != 3 || // version must be 3 - buf[4]) // flags byte zero - return 0; - - tag_len = ff_id3v2_tag_len(buf); + if (p->buf_size >= ID3v2_HEADER_SIZE && ff_id3v2_match(buf, ID3v2_EA3_MAGIC)) + tag_len = ff_id3v2_tag_len(buf); /* This check cannot overflow as tag_len has at most 28 bits */ if (p->buf_size < tag_len + 5) /* EA3 header comes late, might be outside of the probe buffer */ - return AVPROBE_SCORE_EXTENSION; + return tag_len ? AVPROBE_SCORE_EXTENSION : 0; buf += tag_len; |