[FFmpeg-devel] [PATCH] avformat/gifdec: cleanup

Anton Khirnov anton at khirnov.net
Mon May 22 19:10:52 EEST 2023


Quoting James Almer (2023-05-22 18:07:50)
> On 5/22/2023 12:49 PM, Paul B Mahol wrote:
> > On 5/21/23, Paul B Mahol <onemda at gmail.com> wrote:
> >> Attached patches.
> >>
> >> This finally removes giant hacks in gif demuxer and allows using gif
> >> files via pipe reliably.
> >>
> > 
> > Now with smaller diff.
> 
> [...]
> 
> > From f3d6eea43df686b4211601b194fac81f032eb273 Mon Sep 17 00:00:00 2001
> > From: Paul B Mahol <onemda at gmail.com>
> > Date: Sun, 21 May 2023 02:15:26 +0200
> > Subject: [PATCH 1/2] avformat/demux: add support to derive timestamps from
> >  packet durations for video
> > 
> > Signed-off-by: Paul B Mahol <onemda at gmail.com>
> > ---
> >  libavformat/demux.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/libavformat/demux.c b/libavformat/demux.c
> > index dec02a1a6b..b3f563ccc7 100644
> > --- a/libavformat/demux.c
> > +++ b/libavformat/demux.c
> > @@ -1195,6 +1195,11 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
> >                                       st->time_base,
> >                                       AV_ROUND_DOWN);
> >              }
> > +        } else if ((s->iformat->flags & AVFMT_NOTIMESTAMPS) && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
> 
> Why only for AVFMT_NOTIMESTAMPS formats? Same as the audio check above, 
> the parser could set duration regardless of where the packet came from.

I suggested that on IRC.

The idea is that container durations are authoritative for video, so
parser duration should only be used when we do not have container
timing.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list