From 06105bd193c8b7f002087197a1f4d7258aca3d3c Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Fri, 19 Jun 2009 00:47:57 +0200 Subject: [PATCH] Used AVCodecContext::ticks_per_frame when available. It fixes a regression with interpolated timestamps for some mpeg-I/II and for h264. --- modules/codec/avcodec/video.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index d2cd8c9b4e..81f485e6c8 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -1118,9 +1118,17 @@ static void ffmpeg_NextPts( decoder_t *p_dec ) } else if( p_sys->p_context->time_base.den > 0 ) { +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52,20,0) + int i_tick = i_tick = p_sys->p_context->ticks_per_frame; + if( i_tick <= 0 ) + i_tick = 1; +#else + int i_tick = 1; +#endif + p_sys->i_pts += INT64_C(1000000) * (2 + p_sys->p_ff_pic->repeat_pict) * - p_sys->p_context->time_base.num / + i_tick * p_sys->p_context->time_base.num / (2 * p_sys->p_context->time_base.den); } } -- 2.39.2