From a54242503e3fd50dcd4d3af8b39e1d2a6e138e45 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 12 Oct 2016 16:17:43 +0200 Subject: FFmpeg: Fix off by one error in number of detected frames in matroska container Seems to be rounding error. Hopefully new code handles the error fixed back in SVN revision 28901 and still have proper frame number for Hjalti. What could possibly go wrong here.. --- source/blender/imbuf/intern/anim_movie.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index d378ca9a78c..a40b257b75b 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -522,9 +522,9 @@ static int startffmpeg(struct anim *anim) anim->duration = pFormatCtx->streams[videoStream]->nb_frames; } else { - anim->duration = ceil(pFormatCtx->duration * - av_q2d(frame_rate) / - AV_TIME_BASE); + anim->duration = (int)(pFormatCtx->duration * + av_q2d(frame_rate) / + AV_TIME_BASE + 0.5f); } frs_num = frame_rate.num; -- cgit v1.2.3