[MPlayer-cvslog] r35057 - trunk/libmpdemux/demux_lavf.c

al subversion at mplayerhq.hu
Fri Aug 3 01:28:04 CEST 2012


Author: al
Date: Fri Aug  3 01:28:04 2012
New Revision: 35057

Log:
demux_lavf: Set endpts from AVPacket.duration

  Always set endpts from AVPacket.duration for all streams. Override
endpts with AVPacket.convergence_duration for subtitle streams if it
is non-zero, because some lavf demuxers store the duration there.
However keep the behaviour to never set endpts if it would equal pts
afterwards.

  Also stop checking AV_PKT_FLAG_KEY when overriding endpts with
convergence_duration. It does not seem necessary anymore.

Modified:
   trunk/libmpdemux/demux_lavf.c

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sun Jul 29 21:50:30 2012	(r35056)
+++ trunk/libmpdemux/demux_lavf.c	Fri Aug  3 01:28:04 2012	(r35057)
@@ -651,10 +651,10 @@ static int demux_lavf_fill_buffer(demuxe
     if(pkt.pts != AV_NOPTS_VALUE){
         dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base);
         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)
+        if(pkt.duration > 0)
+            dp->endpts = dp->pts + pkt.duration * av_q2d(priv->avfc->streams[id]->time_base);
+        /* subtitle durations are sometimes stored in convergence_duration */
+        if(ds == demux->sub && pkt.convergence_duration > 0)
             dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base);
     }
     dp->pos=demux->filepos;


More information about the MPlayer-cvslog mailing list