[vlc-commits] demux: avformat: use guess rate instead of timebase

Francois Cartegnie git at videolan.org
Wed Jun 13 15:30:22 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 12 17:04:21 2018 +0200| [372c7cf22c2f0074ca51ba634e620c7ba65733f2] | committer: Francois Cartegnie

demux: avformat: use guess rate instead of timebase

contains same code, and
packet time base can be != from the real rate (ex: flv)

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

 modules/demux/avformat/demux.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 3e3d40f0ef..397bf003d3 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -436,15 +436,14 @@ int avformat_OpenDemux( vlc_object_t *p_this )
 
 # warning FIXME: implement palette transmission
             psz_type = "video";
-#if (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(55, 20, 0))
-            es_fmt.video.i_frame_rate = s->time_base.num;
-            es_fmt.video.i_frame_rate_base = s->time_base.den;
-            if( s->codec->ticks_per_frame > 0 )
-                es_fmt.video.i_frame_rate_base *= s->codec->ticks_per_frame;
-#else
-            es_fmt.video.i_frame_rate = s->codec->time_base.num;
-            es_fmt.video.i_frame_rate_base = s->codec->time_base.den * __MAX( s->codec->ticks_per_frame, 1 );
-#endif
+
+            AVRational rate = av_guess_frame_rate( p_sys->ic, s, NULL );
+            if( rate.den && rate.num )
+            {
+                es_fmt.video.i_frame_rate = rate.num;
+                es_fmt.video.i_frame_rate_base = rate.den;
+            }
+
             es_fmt.video.i_sar_num = s->sample_aspect_ratio.num;
             if (s->sample_aspect_ratio.num > 0)
                 es_fmt.video.i_sar_den = s->sample_aspect_ratio.den;



More information about the vlc-commits mailing list