aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-21 21:11:28 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-21 21:13:20 +0200
commitdb1347f66ed009ec5a80749d853e1a5768225d26 (patch)
treeef14f36c966a996e2a7386987500657008aec9df /libavformat/mpegts.c
parent27f7589ab1ad0f6d2694d713e176dfa234662e60 (diff)
downloadffmpeg-db1347f66ed009ec5a80749d853e1a5768225d26.tar.gz
mpegts: cache information to speed up seeking.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 36443cb2b9..f014d7cace 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1778,10 +1778,13 @@ static int64_t mpegts_get_dts(AVFormatContext *s, int stream_index,
if(ret < 0)
return AV_NOPTS_VALUE;
av_free_packet(&pkt);
- if(pkt.stream_index == stream_index && pkt.dts != AV_NOPTS_VALUE){
- av_assert0(pkt.pos >= 0);
- *ppos= pkt.pos;
- return pkt.dts;
+ if(pkt.dts != AV_NOPTS_VALUE && pkt.pos >= 0){
+ ff_reduce_index(s, pkt.stream_index);
+ av_add_index_entry(s->streams[pkt.stream_index], pkt.pos, pkt.dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */);
+ if(pkt.stream_index == stream_index){
+ *ppos= pkt.pos;
+ return pkt.dts;
+ }
}
pos = pkt.pos;
}