diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-07-24 18:00:11 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-26 03:04:49 +0200 |
commit | 2cd491a47cdf217c89ba5445bbe6e9b10ecd1ca0 (patch) | |
tree | cea94a5ccd8549b517ba7539ab0080a74f53e788 /libavformat | |
parent | 2880c316602bacba1ce5fa2c75890527534b2af3 (diff) | |
download | ffmpeg-2cd491a47cdf217c89ba5445bbe6e9b10ecd1ca0.tar.gz |
lavf: move generic index generation code to a later point
By moving it to a later point relative and unknown timestamps
are more likely to have been corrected
similar patch reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Conflicts:
libavformat/utils.c
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index d7aba39d15..124476ded6 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1233,14 +1233,6 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index) compute_pkt_fields(s, st, st->parser, &out_pkt); - if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && - out_pkt.flags & AV_PKT_FLAG_KEY) { - int64_t pos= out_pkt.pos; - ff_reduce_index(s, st->index); - av_add_index_entry(st, pos, out_pkt.dts, - 0, 0, AVINDEX_KEYFRAME); - } - if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) { out_pkt.destruct = pkt->destruct; pkt->destruct = NULL; @@ -1468,10 +1460,16 @@ return_packet: st->skip_samples = 0; } + if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY) { + ff_reduce_index(s, st->index); + av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME); + } + if (is_relative(pkt->dts)) pkt->dts -= RELATIVE_TS_BASE; if (is_relative(pkt->pts)) pkt->pts -= RELATIVE_TS_BASE; + return ret; } |