From 59163139679b0aa2cb84cd6d7a3f696ed5a5813a Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 9 Apr 2012 18:54:42 +0200 Subject: [PATCH] avformat: offset fps calculation by one to include 60.00 fps To ensure the full range of values is still used, also adjust all uses of this function to loop from 0 instead of 1. This way only 60.00 is added and nothing lost. Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 8d82f9e37a..1a586ad2bb 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2421,7 +2421,7 @@ static void compute_chapters_end(AVFormatContext *s) } static int get_std_framerate(int i){ - if(i<60*12) return i*1001; + if(i<60*12) return (i+1)*1001; else return ((const int[]){24,30,60,12,15,48})[i-60*12]*1000*12; } @@ -2618,7 +2618,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) // if(st->codec->codec_type == AVMEDIA_TYPE_VIDEO) // av_log(NULL, AV_LOG_ERROR, "%f\n", dts); - for (i=1; iinfo->duration_error[0][0]); i++) { + for (i=0; iinfo->duration_error[0][0]); i++) { int framerate= get_std_framerate(i); double sdts= dts*framerate/(1001*12); for(j=0; j<2; j++){ @@ -2727,7 +2727,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) int num = 0; double best_error= 0.01; - for (j=1; jinfo->duration_error[0][0]); j++) { + for (j=0; jinfo->duration_error[0][0]); j++) { int k; if(st->info->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*12.0)/get_std_framerate(j))