[vlc-commits] core: replace hardcoded CLOCK_FREQ fractions/multiples by VLC_TICK macros

Steve Lhomme git at videolan.org
Tue Jul 3 11:24:03 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul  3 10:34:08 2018 +0200| [3f7d31e97b94a4a1976b51938d10d935107c06ca] | committer: Steve Lhomme

core: replace hardcoded CLOCK_FREQ fractions/multiples by VLC_TICK macros

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

 src/clock/input_clock.c        | 2 +-
 src/input/stats.c              | 2 +-
 src/misc/background_worker.c   | 2 +-
 src/network/httpd.c            | 2 +-
 src/video_output/interlacing.c | 2 +-
 src/video_output/video_epg.c   | 2 +-
 src/video_output/video_text.c  | 2 +-
 src/video_output/vout_intf.c   | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/clock/input_clock.c b/src/clock/input_clock.c
index 2ffe164890..1c84e8c17d 100644
--- a/src/clock/input_clock.c
+++ b/src/clock/input_clock.c
@@ -84,7 +84,7 @@
 
 /* Latency introduced on DVDs with CR == 0 on chapter change - this is from
  * my dice --Meuuh */
-#define CR_MEAN_PTS_GAP (CLOCK_FREQ * 3 / 10)
+#define CR_MEAN_PTS_GAP VLC_TICK_FROM_MS(300)
 
 /* Rate (in 1/256) at which we will read faster to try to increase our
  * internal buffer (if we control the pace of the source).
diff --git a/src/input/stats.c b/src/input/stats.c
index 5d2cd1e880..92c2bb66e3 100644
--- a/src/input/stats.c
+++ b/src/input/stats.c
@@ -126,7 +126,7 @@ void input_rate_Add(input_rate_t *counter, uintmax_t val)
     /* Ignore samples within a second of another */
     vlc_tick_t now = vlc_tick_now();
     if (counter->samples[0].date != VLC_TICK_INVALID
-     && (now - counter->samples[0].date) < 1*CLOCK_FREQ)
+     && (now - counter->samples[0].date) < VLC_TICK_FROM_SEC(1))
         return;
 
     memcpy(counter->samples + 1, counter->samples,
diff --git a/src/misc/background_worker.c b/src/misc/background_worker.c
index 1877c38718..2f21e5006a 100644
--- a/src/misc/background_worker.c
+++ b/src/misc/background_worker.c
@@ -89,7 +89,7 @@ static void* Thread( void* data )
             else if( worker->head.deadline != VLC_TICK_INVALID )
             {
                 /* Wait 1 seconds for new inputs before terminating */
-                vlc_tick_t deadline = vlc_tick_now() + 1*CLOCK_FREQ;
+                vlc_tick_t deadline = vlc_tick_now() + VLC_TICK_FROM_SEC(1);
                 int ret = vlc_cond_timedwait( &worker->tail.wait,
                                               &worker->lock, deadline );
                 if( ret != 0 )
diff --git a/src/network/httpd.c b/src/network/httpd.c
index 8fa261f190..00eedfe7ce 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -1170,7 +1170,7 @@ static void httpd_ClientInit(httpd_client_t *cl, vlc_tick_t now)
 {
     cl->i_state = HTTPD_CLIENT_RECEIVING;
     cl->i_activity_date = now;
-    cl->i_activity_timeout = CLOCK_FREQ*10;
+    cl->i_activity_timeout = VLC_TICK_FROM_SEC(10);
     cl->i_buffer_size = HTTPD_CL_BUFSIZE;
     cl->i_buffer = 0;
     cl->p_buffer = xmalloc(cl->i_buffer_size);
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index 1da44c5b3a..f9c2a76ade 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -180,7 +180,7 @@ void vout_SetInterlacingState(vout_thread_t *vout, bool is_interlaced)
                                  - (!!vout->p->interlacing.is_interlaced);
     if (interlacing_change == 1 ||
         (interlacing_change == -1 &&
-        vout->p->interlacing.date + CLOCK_FREQ*30 < vlc_tick_now()))
+        vout->p->interlacing.date + VLC_TICK_FROM_SEC(30) < vlc_tick_now()))
     {
         msg_Dbg(vout, "Detected %s video",
                  is_interlaced ? "interlaced" : "progressive");
diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index 409fc9d481..447f105bf0 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -646,7 +646,7 @@ int vout_OSDEpg(vout_thread_t *vout, input_item_t *input )
 
     subpic->i_channel  = VOUT_SPU_CHANNEL_OSD;
     subpic->i_start    = now;
-    subpic->i_stop     = now + CLOCK_FREQ*3;
+    subpic->i_stop     = now + VLC_TICK_FROM_SEC(3);
     subpic->b_ephemer  = true;
     subpic->b_absolute = false;
     subpic->b_fade     = true;
diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c
index ab5f0fa1ed..10de062aa8 100644
--- a/src/video_output/video_text.c
+++ b/src/video_output/video_text.c
@@ -152,7 +152,7 @@ void vout_OSDMessage(vout_thread_t *vout, int channel, const char *format, ...)
     char *string;
     if (vasprintf(&string, format, args) != -1) {
         vout_OSDText(vout, channel,
-                     SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_RIGHT, CLOCK_FREQ*1,
+                     SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_RIGHT, VLC_TICK_FROM_SEC(1),
                      string);
         free(string);
     }
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 28022ef2d5..8c7b4571d6 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -335,7 +335,7 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic )
      * hardcoded 0 doesn't seem right */
     p_subpic->i_channel = 0;
     p_subpic->i_start = vlc_tick_now();
-    p_subpic->i_stop  = p_subpic->i_start + CLOCK_FREQ*4;
+    p_subpic->i_stop  = p_subpic->i_start + VLC_TICK_FROM_SEC(4);
     p_subpic->b_ephemer = true;
     p_subpic->b_fade = true;
 



More information about the vlc-commits mailing list