demux: avformat: fix build with guess_rate / libav
authorFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 14 Jun 2018 16:43:47 +0000 (18:43 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Thu, 14 Jun 2018 17:10:08 +0000 (19:10 +0200)
modules/demux/avformat/demux.c

index de66091..98b4cac 100644 (file)
@@ -437,7 +437,19 @@ int avformat_OpenDemux( vlc_object_t *p_this )
 # warning FIXME: implement palette transmission
             psz_type = "video";
 
-            AVRational rate = av_guess_frame_rate( p_sys->ic, s, NULL );
+            AVRational rate;
+#if (LIBAVUTIL_VERSION_MICRO < 100) /* libav */
+# if (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(55, 20, 0))
+            rate.num = s->time_base.num;
+            rate.den = s->time_base.den;
+# else
+            rate.num = s->codec->time_base.num;
+            rate.den = s->codec->time_base.den;
+# endif
+            rate.den *= __MAX( s->codec->ticks_per_frame, 1 );
+#else /* ffmpeg */
+            rate = av_guess_frame_rate( p_sys->ic, s, NULL );
+#endif
             if( rate.den && rate.num )
             {
                 es_fmt.video.i_frame_rate = rate.num;