+
+static void ffmpeg_NextPts( decoder_t *p_dec, int i_block_rate )
+{
+ decoder_sys_t *p_sys = p_dec->p_sys;
+
+ if( p_sys->i_pts <= 0 )
+ return;
+
+ /* interpolate the next PTS */
+ if( p_dec->fmt_in.video.i_frame_rate > 0 &&
+ p_dec->fmt_in.video.i_frame_rate_base > 0 )
+ {
+ p_sys->i_pts += INT64_C(1000000) *
+ (2 + p_sys->p_ff_pic->repeat_pict) *
+ p_dec->fmt_in.video.i_frame_rate_base *
+ i_block_rate / INPUT_RATE_DEFAULT /
+ (2 * p_dec->fmt_in.video.i_frame_rate);
+ }
+ else if( p_sys->p_context->time_base.den > 0 )
+ {
+ p_sys->i_pts += INT64_C(1000000) *
+ (2 + p_sys->p_ff_pic->repeat_pict) *
+ p_sys->p_context->time_base.num *
+ i_block_rate / INPUT_RATE_DEFAULT /
+ (2 * p_sys->p_context->time_base.den);
+ }
+}