[FFmpeg-devel] [PATCH] lavf/concatdec: implement compat seek method.

Nicolas George nicolas.george at normalesup.org
Mon Apr 29 17:09:45 CEST 2013


Allow seeking for applications that use the old API.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavformat/concatdec.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 5359ad1..4b6947c 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -375,6 +375,18 @@ static int concat_seek(AVFormatContext *avf, int stream,
     return ret;
 }
 
+static int concat_compat_seek(AVFormatContext *avf, int stream_index,
+                              int64_t ts, int flags)
+{
+    int64_t tsmin = INT64_MIN, tsmax = INT64_MAX;
+
+    if ((flags & AVSEEK_FLAG_BACKWARD))
+        tsmax = ts;
+    else
+        tsmin = ts;
+    return concat_seek(avf, stream_index, tsmin, ts, tsmax, flags);
+}
+
 #define OFFSET(x) offsetof(ConcatContext, x)
 #define DEC AV_OPT_FLAG_DECODING_PARAM
 
@@ -401,5 +413,6 @@ AVInputFormat ff_concat_demuxer = {
     .read_packet    = concat_read_packet,
     .read_close     = concat_read_close,
     .read_seek2     = concat_seek,
+    .read_seek      = concat_compat_seek,
     .priv_class     = &concat_class,
 };
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list