Mercurial > libavformat.hg
changeset 4717:ee2dd1b3afc3 libavformat
do not modify sample_count, check against index entries
author | bcoudurier |
---|---|
date | Sun, 15 Mar 2009 07:21:22 +0000 |
parents | 7c99a46b3f3d |
children | 7bf091a4b6d9 |
files | mov.c |
diffstat | 1 files changed, 3 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mov.c Sat Mar 14 23:39:52 2009 +0000 +++ b/mov.c Sun Mar 15 07:21:22 2009 +0000 @@ -1170,7 +1170,7 @@ for (j = 0; j < sc->stsc_data[stsc_index].count; j++) { if (current_sample >= sc->sample_count) { av_log(mov->fc, AV_LOG_ERROR, "wrong sample count\n"); - goto out; + return; } keyframe = !sc->keyframe_count || current_sample+key_off == sc->keyframes[stss_index]; if (keyframe) { @@ -1245,9 +1245,6 @@ } } } - out: - /* adjust sample count to avindex entries */ - sc->sample_count = st->nb_index_entries; } static int mov_read_trak(MOVContext *c, ByteIOContext *pb, MOVAtom atom) @@ -1273,7 +1270,6 @@ (!sc->sample_size && !sc->sample_count))){ av_log(c->fc, AV_LOG_ERROR, "stream %d, missing mandatory atoms, broken header\n", st->index); - sc->sample_count = 0; //ignore track return 0; } if(!sc->time_rate) @@ -1608,7 +1604,6 @@ offset += sample_size; } frag->moof_offset = offset; - sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; } @@ -1865,7 +1860,7 @@ 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 < msc->sample_count) { + if (st->discard != AVDISCARD_ALL && msc->pb && msc->current_sample < st->nb_index_entries) { AVIndexEntry *current_sample = &st->index_entries[msc->current_sample]; int64_t dts = av_rescale(current_sample->timestamp * (int64_t)msc->time_rate, AV_TIME_BASE, msc->time_scale); @@ -1925,7 +1920,7 @@ pkt->dts = AV_NOPTS_VALUE; } else { AVStream *st = s->streams[sc->ffindex]; - int64_t next_dts = (sc->current_sample < sc->sample_count) ? + 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; pkt->pts = pkt->dts;