From: Reimar Döffinger Date: Sat, 14 Mar 2009 21:46:00 +0000 (+0000) Subject: Add AVFMT_GENERIC_INDEX support also for formats that do not use a parser. X-Git-Tag: v0.6~5347 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74f5ae847de156873aeb73f180b41bc141373269;p=platform%2Fupstream%2Flibav.git Add AVFMT_GENERIC_INDEX support also for formats that do not use a parser. Originally committed as revision 17965 to svn://svn.ffmpeg.org/ffmpeg/trunk --- diff --git a/libavformat/utils.c b/libavformat/utils.c index e371d5d3d..7419cc662 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -954,6 +954,11 @@ static int av_read_frame_internal(AVFormatContext *s, AVPacket *pkt) *pkt = st->cur_pkt; st->cur_pkt.data= NULL; compute_pkt_fields(s, st, NULL, pkt); s->cur_st = NULL; + if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && + (pkt->flags & PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) { + ff_reduce_index(s, st->index); + av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME); + } break; } else if (st->cur_len > 0 && st->discard < AVDISCARD_ALL) { len = av_parser_parse2(st->parser, st->codec, &pkt->data, &pkt->size,