[FFmpeg-cvslog] avformat: offset fps calculation by one to include 60.00 fps

Hendrik Leppkes git at videolan.org
Fri Jun 22 02:04:26 CEST 2012


ffmpeg | branch: master | Hendrik Leppkes <h.leppkes at gmail.com> | Mon Apr  9 18:54:42 2012 +0200| [59163139679b0aa2cb84cd6d7a3f696ed5a5813a] | committer: Michael Niedermayer

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 <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59163139679b0aa2cb84cd6d7a3f696ed5a5813a
---

 libavformat/utils.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8d82f9e..1a586ad 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; i<FF_ARRAY_ELEMS(st->info->duration_error[0][0]); i++) {
+                for (i=0; i<FF_ARRAY_ELEMS(st->info->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; j<FF_ARRAY_ELEMS(st->info->duration_error[0][0]); j++) {
+                for (j=0; j<FF_ARRAY_ELEMS(st->info->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))



More information about the ffmpeg-cvslog mailing list