diff mbox

[FFmpeg-devel,PATCHv2,1/4] avformat/concatdec: always allow seeking to start

Message ID 20181223002151.32381-1-cus@passwd.hu
State Accepted
Commit 7f42276aa91c5fe1ad43f43e58a7645a674a3fda
Headers show

Commit Message

Marton Balint Dec. 23, 2018, 12:21 a.m. UTC
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/concatdec.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Nicolas George Dec. 30, 2018, 1:26 p.m. UTC | #1
Marton Balint (2018-12-23):
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>  libavformat/concatdec.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Looks good to me, thanks.

Regards,
Marton Balint Dec. 30, 2018, 8:42 p.m. UTC | #2
On Sun, 30 Dec 2018, Nicolas George wrote:

> Marton Balint (2018-12-23):
>> Signed-off-by: Marton Balint <cus@passwd.hu>
>> ---
>>  libavformat/concatdec.c | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> Looks good to me, thanks.

Applied, thanks.

Marton
diff mbox

Patch

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index bbe13136fa..3ed95a4538 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -692,6 +692,13 @@  static int real_seek(AVFormatContext *avf, int stream,
 
     left  = 0;
     right = cat->nb_files;
+
+    /* Always support seek to start */
+    if (ts <= 0)
+        right = 1;
+    else if (!cat->seekable)
+        return AVERROR(ESPIPE); /* XXX: can we use it? */
+
     while (right - left > 1) {
         int mid = (left + right) / 2;
         if (ts < cat->files[mid].start_time)
@@ -728,8 +735,6 @@  static int concat_seek(AVFormatContext *avf, int stream,
     AVFormatContext *cur_avf_saved = cat->avf;
     int ret;
 
-    if (!cat->seekable)
-        return AVERROR(ESPIPE); /* XXX: can we use it? */
     if (flags & (AVSEEK_FLAG_BYTE | AVSEEK_FLAG_FRAME))
         return AVERROR(ENOSYS);
     cat->avf = NULL;