@@ -7104,6 +7104,7 @@ static int mov_probe(const AVProbeData *p)
uint32_t tag;
int score = 0;
int moov_offset = 0;
+ int mdat_offset = 0;
/* check file header */
offset = 0;
@@ -7129,7 +7130,11 @@ static int mov_probe(const AVProbeData *p)
/* check for obvious tags */
case MKTAG('m','o','o','v'):
moov_offset = offset + 4;
+ offset += minsize;
+ continue; // descend into moov
case MKTAG('m','d','a','t'):
+ mdat_offset = offset + 4;
+ break;
case MKTAG('p','n','o','t'): /* detect movs with preview pics like ew.mov and april.mov */
case MKTAG('u','d','t','a'): /* Packet Video PVAuthor adds this and a lot of more junk */
case MKTAG('f','t','y','p'):
@@ -7160,6 +7165,15 @@ static int mov_probe(const AVProbeData *p)
}
offset += size;
}
+
+ if ((!!moov_offset) + (!!mdat_offset) + (!!score) > 1) {
+ // We found more than 1 tag and at least either MDAT or MOOV
+ score = AVPROBE_SCORE_MAX;
+ } else if (mdat_offset == 4 && p->buf_size > 16384) { // mdat at the start and its too big so we cannot see beyond
+ score = AVPROBE_SCORE_MAX;
+ } else
+ score = 0;
+
if (score > AVPROBE_SCORE_MAX - 50 && moov_offset) {
/* moov atom in the header - we should make sure that this is not a
* MOV-packed MPEG-PS */
Please test this and provide samples which break with this so a clean probe that works with every sample can be written. (i failed to find a file which fails) This also fixes multiple probetest failures the score = 0 case could be replaced by a small score of some form and the remaining code overall can be simplified further Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavformat/mov.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)