vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Tue Jun 
12 17:04:21 2018 +0200| [32832dce09b64ca55304c7d132ac91ec78a7bcf4] | 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)

(cherry picked from commit 372c7cf22c2f0074ca51ba634e620c7ba65733f2)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=32832dce09b64ca55304c7d132ac91ec78a7bcf4
---

 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 60a3a940b8..91991f442b 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -443,15 +443,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;

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to