[FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file
Marton Balint
cus at passwd.hu
Sat Oct 24 22:42:14 CEST 2015
Signed-off-by: Marton Balint <cus at passwd.hu>
---
libavformat/concatdec.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 7686f28..f262d44 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -316,6 +316,14 @@ 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->duration = cat->avf->duration;
+ if (file->inpoint != AV_NOPTS_VALUE)
+ file->duration -= (file->inpoint - file->file_start_time);
+ if (file->outpoint != AV_NOPTS_VALUE)
+ file->duration -= cat->avf->duration - (file->outpoint - file->file_start_time);
+ }
+
if ((ret = match_streams(avf)) < 0)
return ret;
if (file->inpoint != AV_NOPTS_VALUE) {
@@ -469,14 +477,6 @@ 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 (++fileno >= cat->nb_files) {
cat->eof = 1;
return AVERROR_EOF;
--
2.1.4
More information about the ffmpeg-devel
mailing list