[vlc-commits] avcodec: use framerate as time_base seems to be debrecated in 0.56

Ilkka Ollakka git at videolan.org
Mon Aug 10 08:10:10 CEST 2015


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Aug  9 23:54:31 2015 +0300| [302f74f91bf596169cb9164adb2ede891d0c98b8] | committer: Ilkka Ollakka

avcodec: use framerate as time_base seems to be debrecated in 0.56

Libav/ffmpeg seems to store littlebit different values in framerate, so
there is #if to check that. Not sure if it's good idea at all to do that
like this.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=302f74f91bf596169cb9164adb2ede891d0c98b8
---

 modules/codec/avcodec/video.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index c84ecb9..83515ea 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -180,6 +180,17 @@ static int lavc_UpdateVideoFormat( decoder_t *p_dec, AVCodecContext *p_context,
         p_dec->fmt_out.video.i_frame_rate_base =
             p_dec->fmt_in.video.i_frame_rate_base;
     }
+#if LIBAVCODEC_VERSION_CHECK( 56, 5, 0, 7, 100 )
+    else if( p_context->framerate.num > 0 && p_context->framerate.den > 0 )
+    {
+        p_dec->fmt_out.video.i_frame_rate = p_context->framerate.num;
+        p_dec->fmt_out.video.i_frame_rate_base = p_context->framerate.den;
+# if LIBAVCODEC_VERSION_MICRO <  100
+        // for some reason libav don't thinkg framerate presents actually same thing as in ffmpeg
+        p_dec->fmt_out.video.i_frame_rate_base *= __MAX( p_context->ticks_per_frame, 1 );
+# endif
+    }
+#endif
     else if( p_context->time_base.num > 0 && p_context->time_base.den > 0 )
     {
         p_dec->fmt_out.video.i_frame_rate = p_context->time_base.den;



More information about the vlc-commits mailing list