[FFmpeg-devel] [PATCH 1/2] Use input AVPavket.pts to set AVSubtitle.pts when the subtitle decoder don't set this field by itself.
Michael Niedermayer
michaelni at gmx.at
Tue Apr 12 04:03:43 CEST 2011
On Mon, Apr 11, 2011 at 11:57:40PM +0200, Aurelien Jacobs wrote:
> Signed-off-by: Aurelien Jacobs <aurel at gnuage.org>
> ---
> libavcodec/utils.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index bd5bdfd..6f4c689 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -803,8 +803,12 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
> *got_sub_ptr = 0;
> avcodec_get_subtitle_defaults(sub);
> ret = avctx->codec->decode(avctx, sub, got_sub_ptr, avpkt);
> - if (*got_sub_ptr)
> + if (*got_sub_ptr) {
> avctx->frame_number++;
> + if (sub->pts == AV_NOPTS_VALUE && avpkt->pts != AV_NOPTS_VALUE)
> + sub->pts = ((int64_t)AV_TIME_BASE * avpkt->pts *
> + avctx->time_base.num) / avctx->time_base.den;
this can overflow, see:
av_rescale_q()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Many things microsoft did are stupid, but not doing something just because
microsoft did it is even more stupid. If everything ms did were stupid they
would be bankrupt already.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110412/e2eff4a9/attachment.asc>
More information about the ffmpeg-devel
mailing list