Commit 9dd82724 authored by Nicolas George's avatar Nicolas George

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.
parent 1b9a2514
...@@ -1701,6 +1701,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, ...@@ -1701,6 +1701,9 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
avctx->pkt = avpkt; avctx->pkt = avpkt;
*got_sub_ptr = 0; *got_sub_ptr = 0;
avcodec_get_subtitle_defaults(sub); 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); ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
if (*got_sub_ptr) if (*got_sub_ptr)
avctx->frame_number++; avctx->frame_number++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment