concatdec: calculate duration early if outpoint is known
authorMarton Balint <cus@passwd.hu>
Sat, 24 Oct 2015 14:20:41 +0000 (16:20 +0200)
committerMarton Balint <cus@passwd.hu>
Tue, 24 Nov 2015 23:34:29 +0000 (00:34 +0100)
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/concatdec.c

index 0180a7e..560aa64 100644 (file)
@@ -316,6 +316,8 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
                            cat->files[fileno - 1].duration;
     file->file_start_time = (cat->avf->start_time == AV_NOPTS_VALUE) ? 0 : cat->avf->start_time;
     file->file_inpoint = (file->inpoint == AV_NOPTS_VALUE) ? file->file_start_time : file->inpoint;
+    if (file->duration == AV_NOPTS_VALUE && file->outpoint != AV_NOPTS_VALUE)
+        file->duration = file->outpoint - file->file_inpoint;
     if ((ret = match_streams(avf)) < 0)
         return ret;
     if (file->inpoint != AV_NOPTS_VALUE) {