aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-09-09 16:00:06 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-09-15 15:58:42 +0200
commit9dd82724315d651891f2a1ed733c4de06e9cb07a (patch)
treeab9a50f80c7a610b23e8ec77d1010858dbb85b95
parent1b9a251438708a3716246b8e3fd63e407175548c (diff)
downloadffmpeg-9dd82724315d651891f2a1ed733c4de06e9cb07a.tar.gz
lavc: set AVSubtitle.pts if possible.
If the packet has a PTS and the corresponding time base is known, set the pts field of the decoded subtitle structure before the call to the decoder. The decoder is still allowed to change the PTS if necessary.
-rw-r--r--libavcodec/utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 99e012ab2f..30b0d21a5b 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1701,6 +1701,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
avctx->pkt = avpkt;
*got_sub_ptr = 0;
avcodec_get_subtitle_defaults(sub);
+ if (avctx->pkt_timebase.den && avpkt->pts != AV_NOPTS_VALUE)
+ sub->pts = av_rescale_q(avpkt->pts,
+ avctx->pkt_timebase, AV_TIME_BASE_Q);
ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
if (*got_sub_ptr)
avctx->frame_number++;