diff options
author | Bryan Huh <bryan@box.com> | 2015-11-10 11:11:26 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-10 23:45:19 +0100 |
commit | 85e3c31fd54c106d45b0066e4fc3cf42d31ffb41 (patch) | |
tree | 68be7b131319563e054bba616a36bc52dc38f485 /libavformat/mov.c | |
parent | d9726893f311b7bbbc9887db2c3ffbefaad78ca3 (diff) | |
download | ffmpeg-85e3c31fd54c106d45b0066e4fc3cf42d31ffb41.tar.gz |
avformat/mov: Add option to ignore chapters during parsing
Chapter-indexing can be expensive since chapters may be interspersed
throughout the entire file and may require many seeks - especially
costly when consuming a video over a remote protocol like http.
Furthermore it is often unnecessary, especially when only trying to get
video info (e.g. via ffprobe).
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r-- | libavformat/mov.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index a7ba4d8ae2..38d36590e6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -462,6 +462,9 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) char str[256+1]; int ret; + if (c->ignore_chapters) + return 0; + if ((atom.size -= 5) < 0) return 0; @@ -4635,7 +4638,7 @@ static int mov_read_header(AVFormatContext *s) av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); if (pb->seekable) { - if (mov->chapter_track > 0) + if (mov->chapter_track > 0 && !mov->ignore_chapters) mov_read_chapters(s); for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->codec->codec_tag == AV_RL32("tmcd")) @@ -5046,6 +5049,8 @@ static const AVOption mov_options[] = { 0, 1, FLAGS}, {"ignore_editlist", "", OFFSET(ignore_editlist), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, FLAGS}, + {"ignore_chapters", "", OFFSET(ignore_chapters), AV_OPT_TYPE_BOOL, {.i64 = 0}, + 0, 1, FLAGS}, {"use_mfra_for", "use mfra for fragment timestamps", OFFSET(use_mfra_for), AV_OPT_TYPE_INT, {.i64 = FF_MOV_FLAG_MFRA_AUTO}, |