summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2019-08-08 22:28:26 +0200
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2020-04-07 13:20:59 +0100
commita13841b79782eb09222d953e9c7d3cd00fefecf3 (patch)
treedeae88e3934adbee805c933c152c3ff996aa3933
parent97b526c192add6f252b327245fd9223546867352 (diff)
mov: Support fake moov boxes disguised as hoov
Some broken apps generate files that have a fake box named 'hoov' instead of a proper 'moov' one. This is speculation but it seems like this box contains data to be modified later (eg as file grows in size, data gets re-written) and its name is supposed to be changed to 'moov' once it can be used as a 'moov', but for some reason this step is skipped. Since this is not the first time this happens ('moov' boxes can be found in 'free' ones) extend the existing hacks to search for the moov in such boxes and skip the moov_retry since it needs to be found right away. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r--libavformat/mov.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index a46787373f..0c4e468dd4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6890,10 +6890,10 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size >= 8) {
a.size = avio_rb32(pb);
a.type = avio_rl32(pb);
- if (a.type == MKTAG('f','r','e','e') &&
+ if (((a.type == MKTAG('f','r','e','e') && c->moov_retry) ||
+ a.type == MKTAG('h','o','o','v')) &&
a.size >= 8 &&
- c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT &&
- c->moov_retry) {
+ c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT) {
uint8_t buf[8];
uint32_t *type = (uint32_t *)buf + 1;
if (avio_read(pb, buf, 8) != 8)
@@ -6901,7 +6901,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_seek(pb, -8, SEEK_CUR);
if (*type == MKTAG('m','v','h','d') ||
*type == MKTAG('c','m','o','v')) {
- av_log(c->fc, AV_LOG_ERROR, "Detected moov in a free atom.\n");
+ av_log(c->fc, AV_LOG_ERROR, "Detected moov in a free or hoov atom.\n");
a.type = MKTAG('m','o','o','v');
}
}