aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-04 21:19:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-04-04 21:19:45 +0200
commit0a512e347fb25baa17bde7d5347213695324dd9c (patch)
tree5ebe056fb4e4942a85a4d6d4cd0ec27ff549af41
parentcfaffb1ab7de383e8fe67add8ff42f0a2c52ff97 (diff)
parent83affcde5124601a9dc6ad149bf5dbdb569fc10b (diff)
downloadffmpeg-0a512e347fb25baa17bde7d5347213695324dd9c.tar.gz
Merge remote-tracking branch 'cigaes/master'
* cigaes/master: lavc: use packet duration for subtitles if necessary. Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/utils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 064b473c86..76f7e8e142 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2229,6 +2229,14 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded);
av_assert1((ret >= 0) >= !!*got_sub_ptr &&
!!*got_sub_ptr >= !!sub->num_rects);
+
+ if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
+ avctx->pkt_timebase.num) {
+ AVRational ms = { 1, 1000 };
+ sub->end_display_time = av_rescale_q(avpkt->duration,
+ avctx->pkt_timebase, ms);
+ }
+
if (tmp.data != pkt_recoded.data) { // did we recode?
/* prevent from destroying side data from original packet */
pkt_recoded.side_data = NULL;