[FFmpeg-devel] [PATCH] avformat/concatdec: Handle NOPTS start_time

Nicolas George george at nsup.org
Mon Dec 15 18:53:19 CET 2014


Le quintidi 25 frimaire, an CCXXIII, Michael Niedermayer a écrit :
> Lines: 36
> 
> Fixes Ticket3598
> 
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavformat/concatdec.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
> index a2584d7..253951a 100644
> --- a/libavformat/concatdec.c
> +++ b/libavformat/concatdec.c
> @@ -512,9 +512,14 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
>             av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
>             av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
>  
> -    delta = av_rescale_q(cat->cur_file->start_time - cat->avf->start_time,
> -                         AV_TIME_BASE_Q,
> -                         cat->avf->streams[pkt->stream_index]->time_base);
> +    if (cat->avf->start_time == AV_NOPTS_VALUE)
> +        delta = av_rescale_q(cat->cur_file->start_time,
> +                             AV_TIME_BASE_Q,
> +                             cat->avf->streams[pkt->stream_index]->time_base);
> +    else
> +        delta = av_rescale_q(cat->cur_file->start_time - cat->avf->start_time,
> +                             AV_TIME_BASE_Q,
> +                             cat->avf->streams[pkt->stream_index]->time_base);
>      if (pkt->pts != AV_NOPTS_VALUE)
>          pkt->pts += delta;
>      if (pkt->dts != AV_NOPTS_VALUE)

I am ok in principle, but I like it better written like [PATCH 1/2]: less
code duplication, less changed lines.

Also, I wonder if there is any disadvantage in [PATCH 2/2], which would fix
this particular problem too.

Please feel free to apply your version or any of my patches without waiting
for me, but beware, neither was tested beyond a run of FATE, as I have
little time right now.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavf-concatdec-handle-NOPTS-start_time.patch
Type: text/x-diff
Size: 1445 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141215/87209ed5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-lavf-wavdec-set-start_time-to-0.patch
Type: text/x-diff
Size: 734 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141215/87209ed5/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141215/87209ed5/attachment.asc>


More information about the ffmpeg-devel mailing list