[FFmpeg-devel] [PATCH 2/2] mpegts: Try av_url_read_fseek in the read_seek function

Martin Storsjö martin
Mon Mar 7 14:18:15 CET 2011


This allows seeking in applehttp streams. The duration of such
streams is not exported from the protocol yet, though.
---
 libavformat/mpegts.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index b1b329e..dfa2d88 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1768,6 +1768,12 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in
     uint8_t buf[TS_PACKET_SIZE];
     int64_t pos;
 
+    if (s->pb->is_streamed) {
+        int ret = av_url_read_fseek(s->pb, stream_index, target_ts, flags);
+        if (ret != AVERROR(ENOSYS))
+            return ret;
+    }
+
     if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
         return -1;
 
-- 
1.7.3.1




More information about the ffmpeg-devel mailing list