[vlc-commits] avformat:demux: hardcode the check between CLOCK_FREQ and AV_TIME_BASE

Steve Lhomme git at videolan.org
Wed Sep 19 11:58:38 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Sep 19 11:40:34 2018 +0200| [d70fd38d676779413b280b6db5a8f60889fb7e7d] | committer: Steve Lhomme

avformat:demux: hardcode the check between CLOCK_FREQ and AV_TIME_BASE

And use the vlc_tick conversion macros

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

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

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index d92f2c2107..284c03565f 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -937,15 +937,12 @@ static void ResetTime( demux_t *p_demux, int64_t i_time )
     }
     else
     {
-        if( CLOCK_FREQ == AV_TIME_BASE )
-        {
-            t = i_time;
-        }
-        else
-        {
-            lldiv_t q = lldiv( i_time, AV_TIME_BASE );
-            t = q.quot * CLOCK_FREQ + q.rem * CLOCK_FREQ / AV_TIME_BASE;
-        }
+#if CLOCK_FREQ == AV_TIME_BASE
+        t = FROM_AV_TS(i_time);
+#else
+        lldiv_t q = lldiv( i_time, AV_TIME_BASE );
+        t = vlc_tick_from_sec(q.quot) + FROM_AV_TS(q.rem);
+#endif
 
         if( t == VLC_TICK_INVALID )
             t = VLC_TICK_0;



More information about the vlc-commits mailing list