From fc8fa007fb6099643a1f742a162e5e5eda760fd6 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sun, 18 Apr 2010 19:09:25 +0000 Subject: Implement librtmp seek support. Implement flv_read_seek(), add a missing check on stream_index and fix timestamp rounding in rtmp_read_seek(). Also add the flv_read_seek2() function, which is not enabled but is useful as reference. To actually implement flv_read_seek2() correctly, there would need to be some corresponding av_url_read_fseek2() function to propagate the timestamps down to the ByteIOContext and URLContext. Patch by Howard Chu highlandsun.com>. See the thread: Subject: [FFmpeg-devel] RTMP seek support Date: 2010-03-28 23:35:02 GMT Originally committed as revision 22904 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/librtmp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libavformat/librtmp.c') diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index 69a69f1211..b9efa51477 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -144,7 +144,10 @@ static int64_t rtmp_read_seek(URLContext *s, int stream_index, return AVERROR(ENOSYS); /* seeks are in milliseconds */ - timestamp = av_rescale(timestamp, AV_TIME_BASE, 1000); + if (stream_index < 0) + timestamp = av_rescale_rnd(timestamp, 1000, AV_TIME_BASE, + flags & AVSEEK_FLAG_BACKWARD ? AV_ROUND_DOWN : AV_ROUND_UP); + if (!RTMP_SendSeek(r, timestamp)) return -1; return timestamp; -- cgit v1.2.3