[vlc-commits] modules: use vlc_tick_from_sec()

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May  7 15:44:11 2018 +0200| [9d3d1d66602d2b2984fef149567401054ba8beb7] | committer: Steve Lhomme

modules: use vlc_tick_from_sec()

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

 modules/access/rtp/rtp.c      |  3 +--
 modules/codec/stl.c           |  2 +-
 modules/codec/ttml/ttml.c     | 10 +++++-----
 modules/codec/webvtt/webvtt.c |  6 +++---
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index f4921d4acb..fb82815d93 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -263,8 +263,7 @@ static int Open (vlc_object_t *obj)
     p_sys->fd           = fd;
     p_sys->rtcp_fd      = rtcp_fd;
     p_sys->max_src      = var_CreateGetInteger (obj, "rtp-max-src");
-    p_sys->timeout      = var_CreateGetInteger (obj, "rtp-timeout")
-                        * CLOCK_FREQ;
+    p_sys->timeout      = vlc_tick_from_sec( var_CreateGetInteger (obj, "rtp-timeout") );
     p_sys->max_dropout  = var_CreateGetInteger (obj, "rtp-max-dropout");
     p_sys->max_misorder = var_CreateGetInteger (obj, "rtp-max-misorder");
     p_sys->thread_ready = false;
diff --git a/modules/codec/stl.c b/modules/codec/stl.c
index 1c27a7130b..bf464c84f5 100644
--- a/modules/codec/stl.c
+++ b/modules/codec/stl.c
@@ -248,7 +248,7 @@ static void GroupApplyStyle(stl_sg_t *p_group, uint8_t code)
 
 static int64_t ParseTimeCode(const uint8_t *data, double fps)
 {
-    return CLOCK_FREQ * (data[0] * 3600 +
+    return vlc_tick_from_sec( data[0] * 3600 +
                          data[1] *   60 +
                          data[2] *    1 +
                          data[3] /  fps);
diff --git a/modules/codec/ttml/ttml.c b/modules/codec/ttml/ttml.c
index 294b559671..91a2b486b7 100644
--- a/modules/codec/ttml/ttml.c
+++ b/modules/codec/ttml/ttml.c
@@ -92,13 +92,13 @@ static tt_time_t tt_ParseTime( const char *s )
         sscanf( s, "%u:%2u:%2u",         &h1, &m1, &s1          ) == 3 ||
                            tt_ScanReset( &h1, &m1, &s1, &c, &d1 ) )
     {
-        t.base = CLOCK_FREQ * (h1 * 3600 + m1 * 60 + s1);
+        t.base = vlc_tick_from_sec(h1 * 3600 + m1 * 60 + s1);
         if( c == '.' && d1 > 0 )
         {
             unsigned i_den = 1;
             for( const char *p = strchr( s, '.' ) + 1; *p && (i_den < UINT_MAX / 10); p++ )
                 i_den *= 10;
-            t.base += CLOCK_FREQ * d1 / i_den;
+            t.base += vlc_tick_from_sec(d1) / i_den;
         }
         else if( c == ':' )
         {
@@ -116,15 +116,15 @@ static tt_time_t tt_ParseTime( const char *s )
                 if( *(psz_end + 1) == 's' )
                     t.base = VLC_TICK_FROM_MS(v);
                 else
-                    t.base = CLOCK_FREQ * 60 * v;
+                    t.base = vlc_tick_from_sec(60 * v);
             }
             else if( *psz_end == 's' )
             {
-                t.base = CLOCK_FREQ * v;
+                t.base = vlc_tick_from_sec(v);
             }
             else if( *psz_end == 'h' )
             {
-                t.base = CLOCK_FREQ * v * 3600;
+                t.base = vlc_tick_from_sec(v * 3600);
             }
             else if( *psz_end == 'f' )
             {
diff --git a/modules/codec/webvtt/webvtt.c b/modules/codec/webvtt/webvtt.c
index e9585e92a7..93da2179f1 100644
--- a/modules/codec/webvtt/webvtt.c
+++ b/modules/codec/webvtt/webvtt.c
@@ -89,9 +89,9 @@ struct webvtt_text_parser_t
 
 static vlc_tick_t MakeTime( unsigned t[4] )
 {
-    return VLC_TICK_FROM_SEC(t[0] * 3600)+
-           VLC_TICK_FROM_SEC(t[1] * 60)+
-           VLC_TICK_FROM_SEC(t[2]) +
+    return vlc_tick_from_sec(t[0] * 3600)+
+           vlc_tick_from_sec(t[1] * 60)+
+           vlc_tick_from_sec(t[2]) +
            VLC_TICK_FROM_MS(t[3]);
 }
 



More information about the vlc-commits mailing list