[FFmpeg-cvslog] avformat/matroskadec: fix IGNIDX handling

wm4 git at videolan.org
Thu Feb 12 17:09:23 CET 2015


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Mon Feb  9 20:39:01 2015 +0100| [7862325f8084a45a59fc629051c6c8e6e33318c4] | committer: Michael Niedermayer

avformat/matroskadec: fix IGNIDX handling

Just because the user requested the seek index to be ignored, we can't
just skip essential headers. At least tags are often located at the end
of the file, and the old code simply ignored the seekhead for all
elements, not just the cue index. Also, it looks like it used the index
even if IGNIDX was set if the cue index was located in the beginning of
the file.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7862325f8084a45a59fc629051c6c8e6e33318c4
---

 libavformat/matroskadec.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 84c6e44..4c92a9d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1464,8 +1464,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
     int i;
 
     // we should not do any seeking in the streaming case
-    if (!matroska->ctx->pb->seekable ||
-        (matroska->ctx->flags & AVFMT_FLAG_IGNIDX))
+    if (!matroska->ctx->pb->seekable)
         return;
 
     for (i = 0; i < seekhead_list->nb_elem; i++) {
@@ -1500,6 +1499,9 @@ static void matroska_add_index_entries(MatroskaDemuxContext *matroska)
     int index_scale = 1;
     int i, j;
 
+    if (matroska->ctx->flags & AVFMT_FLAG_IGNIDX)
+        return;
+
     index_list = &matroska->index;
     index      = index_list->elem;
     if (index_list->nb_elem &&
@@ -1525,6 +1527,9 @@ static void matroska_add_index_entries(MatroskaDemuxContext *matroska)
 static void matroska_parse_cues(MatroskaDemuxContext *matroska) {
     int i;
 
+    if (matroska->ctx->flags & AVFMT_FLAG_IGNIDX)
+        return;
+
     for (i = 0; i < matroska->num_level1_elems; i++) {
         MatroskaLevel1Element *elem = &matroska->level1_elems[i];
         if (elem->id == MATROSKA_ID_CUES && !elem->parsed) {



More information about the ffmpeg-cvslog mailing list