changeset 2201:c514ebfeec49 libavformat

drop blocks which are part of unsupported tracks
author aurel
date Sun, 24 Jun 2007 21:49:13 +0000
parents 5894ebb2faa7
children 32d675fb5e2e
files matroskadec.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/matroskadec.c	Sun Jun 24 12:29:12 2007 +0000
+++ b/matroskadec.c	Sun Jun 24 21:49:13 2007 +0000
@@ -41,7 +41,7 @@
      * the calling app uses for this track. */
     uint32_t num;
     uint32_t uid;
-    uint32_t stream_index;
+    int stream_index;
 
     char *name;
     char *language;
@@ -2021,6 +2021,7 @@
             int extradata_size = 0;
             int extradata_offset = 0;
             track = matroska->tracks[i];
+            track->stream_index = -1;
 
             /* libavformat does not really support subtitles.
              * Also apply some sanity checks. */
@@ -2213,6 +2214,7 @@
             MatroskaDemuxIndex *idx = &matroska->index[i];
             track = matroska_find_track_by_num(matroska, idx->track);
             stream = matroska->tracks[track]->stream_index;
+            if (stream >= 0)
             av_add_index_entry(matroska->ctx->streams[stream],
                                idx->pos, idx->time/matroska->time_scale,
                                0, 0, AVINDEX_KEYFRAME);
@@ -2260,6 +2262,8 @@
         av_free(origdata);
         return res;
     }
+    if (matroska->tracks[track]->stream_index < 0)
+        return res;
     st = matroska->ctx->streams[matroska->tracks[track]->stream_index];
     if (st->discard >= AVDISCARD_ALL) {
         av_free(origdata);