[FFmpeg-cvslog] r19261 - trunk/libavformat/mov.c

reimar subversion
Wed Jun 24 10:23:40 CEST 2009


Author: reimar
Date: Wed Jun 24 10:23:40 2009
New Revision: 19261

Log:
In mov_read_packet remember the AVStream we want to demux next instead of the
MOVStreamContext. We need the AVStream anyway and it is easier to get the
MOVStreamContext from the AVStream than the other way around.

Modified:
   trunk/libavformat/mov.c

Modified: trunk/libavformat/mov.c
==============================================================================
--- trunk/libavformat/mov.c	Wed Jun 24 06:38:48 2009	(r19260)
+++ trunk/libavformat/mov.c	Wed Jun 24 10:23:40 2009	(r19261)
@@ -2060,14 +2060,15 @@ static int mov_read_packet(AVFormatConte
     MOVContext *mov = s->priv_data;
     MOVStreamContext *sc = 0;
     AVIndexEntry *sample = 0;
+    AVStream *st = NULL;
     int64_t best_dts = INT64_MAX;
     int i, ret;
  retry:
     for (i = 0; i < s->nb_streams; i++) {
-        AVStream *st = s->streams[i];
-        MOVStreamContext *msc = st->priv_data;
-        if (st->discard != AVDISCARD_ALL && msc->pb && msc->current_sample < st->nb_index_entries) {
-            AVIndexEntry *current_sample = &st->index_entries[msc->current_sample];
+        AVStream *avst = s->streams[i];
+        MOVStreamContext *msc = avst->priv_data;
+        if (avst->discard != AVDISCARD_ALL && msc->pb && msc->current_sample < avst->nb_index_entries) {
+            AVIndexEntry *current_sample = &avst->index_entries[msc->current_sample];
             int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale);
             dprintf(s, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts);
             if (!sample || (url_is_streamed(s->pb) && current_sample->pos < sample->pos) ||
@@ -2077,7 +2078,7 @@ static int mov_read_packet(AVFormatConte
                   (FFABS(best_dts - dts) > AV_TIME_BASE && dts < best_dts)))))) {
                 sample = current_sample;
                 best_dts = dts;
-                sc = msc;
+                st = avst;
             }
         }
     }
@@ -2090,6 +2091,7 @@ static int mov_read_packet(AVFormatConte
         dprintf(s, "read fragments, offset 0x%llx\n", url_ftell(s->pb));
         goto retry;
     }
+    sc = st->priv_data;
     /* must be done just before reading, to avoid infinite loop on sample */
     sc->current_sample++;
     if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
@@ -2123,7 +2125,6 @@ static int mov_read_packet(AVFormatConte
         if (sc->wrong_dts)
             pkt->dts = AV_NOPTS_VALUE;
     } else {
-        AVStream *st = s->streams[sc->ffindex];
         int64_t next_dts = (sc->current_sample < st->nb_index_entries) ?
             st->index_entries[sc->current_sample].timestamp : st->duration;
         pkt->duration = next_dts - pkt->dts;



More information about the ffmpeg-cvslog mailing list