[MPlayer-dev-eng] [PATCH] Read normal duration when demuxing subtitles through lavf (v2)

Philip Langdale philipl at overt.org
Mon Jul 30 05:17:35 CEST 2012


On Sun, 29 Jul 2012 16:49:51 +0200
Alexander Strasser <eclipse7 at gmx.net> wrote:

> > > Index: libmpdemux/demux_lavf.c
> > > ===================================================================
> > > --- libmpdemux/demux_lavf.c	(revision 35050)
> > > +++ libmpdemux/demux_lavf.c	(working copy)
> > > @@ -653,9 +653,14 @@
> > >          priv->last_pts= dp->pts * AV_TIME_BASE;
> > >          // always set endpts for subtitles, even if
> > > AV_PKT_FLAG_KEY is not set, // otherwise they will stay on screen
> > > to long if e.g. ASS is demuxed from mkv
> > > -        if((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) &&
> > > -           pkt.convergence_duration > 0)
> > > -            dp->endpts = dp->pts + pkt.convergence_duration *
> > > av_q2d(priv->avfc->streams[id]->time_base);
> > > +        if (ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) {
> > > +            int64_t duration = 0;
> > > +            if (pkt.convergence_duration > 0)
> > > +                duration = pkt.convergence_duration;
> > > +            else if (pkt.duration > 0)
> > > +                duration = pkt.duration;
> > > +            dp->endpts = dp->pts + duration *
> > > av_q2d(priv->avfc->streams[id]->time_base);
> > 
> > The intention was that endpts will only be set if the duration is >
> > 0. Subtitles never disappearing is better than them never appearing
> > because pts == endpts.
> 
>   I was just thinking about that. But am I the only one who finds the
> comment misleading?
> 
>   Anyway, I would propose to just pull the dp->endpts assignment into
> both branches of the inner if and directly use the corresponding
> duration member.
> 
>   Any objections? I would edit that myself when testing, so no need
> for a resending the patch.

No objections from me. I didn't intend to change the behaviour in
that way. Thanks.

--phil


More information about the MPlayer-dev-eng mailing list