[FFmpeg-devel] [PATCH 3/3] [RFC] mpegts: Support seeking based on stream timestamps.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Sep 21 11:17:16 CEST 2014
Should should fix seeking in some blurays in combination with
e.g. MPlayer.
Not yet tested due to no bluray at hand.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
libavformat/mpegts.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 3434341..c04e156 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2659,6 +2659,12 @@ void ff_mpegts_parse_close(MpegTSContext *ts)
av_free(ts);
}
+static int mpegts_read_seek(AVFormatContext *s, int stream_index,
+ int64_t ts, int flags)
+{
+ return avio_seek_time(s->pb, stream_index, ts, flags);
+}
+
AVInputFormat ff_mpegts_demuxer = {
.name = "mpegts",
.long_name = NULL_IF_CONFIG_SMALL("MPEG-TS (MPEG-2 Transport Stream)"),
@@ -2668,6 +2674,7 @@ AVInputFormat ff_mpegts_demuxer = {
.read_packet = mpegts_read_packet,
.read_close = mpegts_read_close,
.read_timestamp = mpegts_get_dts,
+ .read_seek = mpegts_read_seek,
.flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
.priv_class = &mpegts_class,
};
@@ -2680,6 +2687,7 @@ AVInputFormat ff_mpegtsraw_demuxer = {
.read_packet = mpegts_raw_read_packet,
.read_close = mpegts_read_close,
.read_timestamp = mpegts_get_dts,
+ .read_seek = mpegts_read_seek,
.flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT,
.priv_class = &mpegtsraw_class,
};
--
1.9.1
More information about the ffmpeg-devel
mailing list