[FFmpeg-devel] [PATCH 2/5] concatdec: calculate duration early if outpoint is known

Marton Balint cus at passwd.hu
Sat Nov 14 14:36:57 CET 2015


On Fri, 13 Nov 2015, Nicolas George wrote:

> Le decadi 20 brumaire, an CCXXIV, Marton Balint a écrit :
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  libavformat/concatdec.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
>> index 0180a7e..560aa64 100644
>> --- a/libavformat/concatdec.c
>> +++ b/libavformat/concatdec.c
>> @@ -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;
>
> Is it not already done? In read_header():
>
>        if (cat->files[i].duration == AV_NOPTS_VALUE) {
>            if (cat->files[i].inpoint == AV_NOPTS_VALUE || cat->files[i].outpoint == AV_NOPTS_VALUE)
>                break;
>            cat->files[i].duration = cat->files[i].outpoint - cat->files[i].inpoint;
>        }
>
> is done for every file, it seems it does exactly the same thing.

In read_header, duration is only set if both inpoint and outpoint is set 
by the user.

In open_file duration is set if outpoint is set by the user which is 
the superset of the first case.

Regards,
Marton


More information about the ffmpeg-devel mailing list