Mercurial > mplayer.hg
comparison libmpdemux/demux_lavf.c @ 34963:0ba5ba56f6d0
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.
author | al |
---|---|
date | Thu, 02 Aug 2012 23:28:04 +0000 |
parents | 02a03e00341e |
children | 4d94558867d6 |
comparison
equal
deleted
inserted
replaced
34962:8446e92c7bc2 | 34963:0ba5ba56f6d0 |
---|---|
649 } | 649 } |
650 | 650 |
651 if(pkt.pts != AV_NOPTS_VALUE){ | 651 if(pkt.pts != AV_NOPTS_VALUE){ |
652 dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base); | 652 dp->pts=pkt.pts * av_q2d(priv->avfc->streams[id]->time_base); |
653 priv->last_pts= dp->pts * AV_TIME_BASE; | 653 priv->last_pts= dp->pts * AV_TIME_BASE; |
654 // always set endpts for subtitles, even if AV_PKT_FLAG_KEY is not set, | 654 if(pkt.duration > 0) |
655 // otherwise they will stay on screen to long if e.g. ASS is demuxed from mkv | 655 dp->endpts = dp->pts + pkt.duration * av_q2d(priv->avfc->streams[id]->time_base); |
656 if((ds == demux->sub || (pkt.flags & AV_PKT_FLAG_KEY)) && | 656 /* subtitle durations are sometimes stored in convergence_duration */ |
657 pkt.convergence_duration > 0) | 657 if(ds == demux->sub && pkt.convergence_duration > 0) |
658 dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base); | 658 dp->endpts = dp->pts + pkt.convergence_duration * av_q2d(priv->avfc->streams[id]->time_base); |
659 } | 659 } |
660 dp->pos=demux->filepos; | 660 dp->pos=demux->filepos; |
661 dp->flags= !!(pkt.flags&AV_PKT_FLAG_KEY); | 661 dp->flags= !!(pkt.flags&AV_PKT_FLAG_KEY); |
662 // append packet to DS stream: | 662 // append packet to DS stream: |