[FFmpeg-cvslog] lavc: use packet duration for subtitles if necessary.

Nicolas George git at videolan.org
Thu Apr 4 21:24:46 CEST 2013


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Sun Mar 24 15:52:28 2013 +0100| [83affcde5124601a9dc6ad149bf5dbdb569fc10b] | committer: Nicolas George

lavc: use packet duration for subtitles if necessary.

Fix trac ticket #2397.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=83affcde5124601a9dc6ad149bf5dbdb569fc10b
---

 libavcodec/utils.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 064b473..76f7e8e 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;



More information about the ffmpeg-cvslog mailing list