diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-06-24 08:23:40 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2009-06-24 08:23:40 +0000 |
commit | 69fc436cbca24fe78c4486dd3acd70880c1f4e27 (patch) | |
tree | a621dc17e602818b151209e841af96c696b36ee6 /libavformat | |
parent | 3c70902bf55b9731cf5cf7d3b27ee4d5d61c0ecc (diff) | |
download | ffmpeg-69fc436cbca24fe78c4486dd3acd70880c1f4e27.tar.gz |
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.
Originally committed as revision 19261 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mov.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 718c5e497a..3fb831f5fa 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2060,14 +2060,15 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) 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(AVFormatContext *s, AVPacket *pkt) (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(AVFormatContext *s, AVPacket *pkt) 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(AVFormatContext *s, AVPacket *pkt) 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; |