From aa96d433e24cde44bf8009c809c6f41308ff8fd4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20Storsj=C3=B6?= Date: Tue, 21 Feb 2012 12:16:18 +0200 Subject: [PATCH] movdec: Don't parse all fragments if ignidx is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In nonseekable files, we already stop parsing the toplevel atoms after finding moov and one mdat. In large seekable files (or files that are seekable, but slowly, e.g. http), reading all the fragments at the start can take a considerable amount of time. This allows opting out from this behaviour. Signed-off-by: Martin Storsjö --- libavformat/mov.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index a2b2da0a22..c2f13b6316 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -350,8 +350,9 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (err < 0) return err; if (c->found_moov && c->found_mdat && - (!pb->seekable || start_pos + a.size == avio_size(pb))) { - if (!pb->seekable) + ((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) || + start_pos + a.size == avio_size(pb))) { + if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) c->next_root_atom = start_pos + a.size; return 0; } -- 2.11.0