]> git.sesse.net Git - casparcg/commitdiff
2.0.2: ffmpeg_producer: Fixed unnecessary nb_frames estimation.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Tue, 29 Nov 2011 21:33:04 +0000 (21:33 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Tue, 29 Nov 2011 21:33:04 +0000 (21:33 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.2@1720 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

modules/ffmpeg/producer/util/util.cpp

index ee97d9b5cb55870df59085b1a994b81f87e12b13..a0f1a884f9c27d70586bce9ad19410b776ccbe75 100644 (file)
@@ -359,7 +359,14 @@ void fix_meta_data(AVFormatContext& context)
                }\r
                else\r
                {\r
-                       video_stream->nb_frames = (video_stream->duration*video_stream->time_base.num*video_context->time_base.den)/(video_stream->time_base.den*video_context->time_base.num*video_context->ticks_per_frame);          }\r
+                       auto stream_time = video_stream->time_base;\r
+                       auto duration    = video_stream->duration;\r
+                       auto codec_time  = video_context->time_base;\r
+                       auto ticks               = video_context->ticks_per_frame;\r
+\r
+                       if(video_stream->nb_frames == 0)\r
+                               video_stream->nb_frames = (duration*stream_time.num*codec_time.den)/(stream_time.den*codec_time.num*ticks);     \r
+               }\r
        }\r
 }\r
 \r