[FFmpeg-devel] [PATCH 3/5] concatdec: move duration calculating code to open_file
Marton Balint
cus at passwd.hu
Sun Oct 25 16:55:31 CET 2015
On Sun, 25 Oct 2015, Nicolas George wrote:
> Le tridi 3 brumaire, an CCXXIV, Marton Balint a écrit :
>> 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);
>> + }
>
> At this point, the file duration is not reliable, so unless I am mistaken
> this change would produce wrong timestamps when stitching, for example, MP3
> files without extra headers.
>
Hmm. I need this computed here for the next patch. Maybe we could
calcualate the duration here and then update it in open_next_file as well?
Regards,
Marton
More information about the ffmpeg-devel
mailing list