[MPlayer-dev-eng] [PATCH] Read normal duration when demuxing subtitles through lavf (v2)
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Jul 29 04:05:06 CEST 2012
On Fri, Jul 27, 2012 at 07:21:45PM -0700, Philip Langdale wrote:
> Hi all,
>
> Currently, mplayer only looks at convergence_duration when
> using lavf to demux subtitles. Some containers use the
> normal duration field for subtitles (eg: mov_text), so we
> should read that if the convergence_duration is not used.
>
> Thanks,
>
> --phil
> 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.
More information about the MPlayer-dev-eng
mailing list