concatdec: simplify duration calculation in open_next_file
authorMarton Balint <cus@passwd.hu>
Mon, 9 Nov 2015 22:49:25 +0000 (23:49 +0100)
committerMarton Balint <cus@passwd.hu>
Tue, 24 Nov 2015 23:34:29 +0000 (00:34 +0100)
If duration is still AV_NOPTS_VALUE when opening the next file, we can assume
that outpoint is not set.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/concatdec.c

index 560aa64..1693941 100644 (file)
@@ -471,13 +471,8 @@ static int open_next_file(AVFormatContext *avf)
     ConcatContext *cat = avf->priv_data;
     unsigned fileno = cat->cur_file - cat->files;
 
-    if (cat->cur_file->duration == AV_NOPTS_VALUE) {
-        cat->cur_file->duration = cat->avf->duration;
-        if (cat->cur_file->inpoint != AV_NOPTS_VALUE)
-            cat->cur_file->duration -= (cat->cur_file->inpoint - cat->cur_file->file_start_time);
-        if (cat->cur_file->outpoint != AV_NOPTS_VALUE)
-            cat->cur_file->duration -= cat->avf->duration - (cat->cur_file->outpoint - cat->cur_file->file_start_time);
-    }
+    if (cat->cur_file->duration == AV_NOPTS_VALUE)
+        cat->cur_file->duration = cat->avf->duration - (cat->cur_file->file_inpoint - cat->cur_file->file_start_time);
 
     if (++fileno >= cat->nb_files) {
         cat->eof = 1;