[vlc-commits] modules: use VLC_TICK_FROM_MS instead of hardcoded values

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Sat May 12 14:53:55 2018 +0200| [7fb3f4293a0d466e40deb01b3b135a3a7aae750c] | committer: Steve Lhomme

modules: use VLC_TICK_FROM_MS instead of hardcoded values

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

 modules/codec/avcodec/encoder.c  | 6 +++---
 modules/demux/avformat/demux.c   | 2 +-
 modules/demux/avi/avi.c          | 4 ++--
 modules/demux/nsv.c              | 2 +-
 modules/demux/rawdv.c            | 2 +-
 modules/demux/subtitle.c         | 2 +-
 modules/gui/qt/input_manager.cpp | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index cbe150c701..e64c3d5f8e 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -50,9 +50,9 @@
 
 #include <libavutil/channel_layout.h>
 
-#define HURRY_UP_GUARD1 (450000)
-#define HURRY_UP_GUARD2 (300000)
-#define HURRY_UP_GUARD3 (100000)
+#define HURRY_UP_GUARD1 VLC_TICK_FROM_MS(450)
+#define HURRY_UP_GUARD2 VLC_TICK_FROM_MS(300)
+#define HURRY_UP_GUARD3 VLC_TICK_FROM_MS(100)
 
 #define MAX_FRAME_DELAY (FF_MAX_B_FRAMES + 2)
 
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index c88ddfd683..d59699e5d9 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -992,7 +992,7 @@ static block_t *BuildSsaFrame( const AVPacket *p_pkt, unsigned i_order )
         p_frame->i_length = vlc_tick_from_sec((h1-h0) * 3600 +
                                          (m1-m0) * 60 +
                                          (s1-s0) * 1) +
-                            CLOCK_FREQ * (c1-c0) / 100;
+                             VLC_TICK_FROM_MS (c1-c0) / 100;
     return p_frame;
 }
 
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 39c980e7ea..be4840f5c4 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1152,7 +1152,7 @@ static int Demux_Seekable( demux_t *p_demux )
                 }
                 else
                 {
-                    i_toread = AVI_PTSToByte( tk, 20 * 1000 );
+                    i_toread = AVI_PTSToByte( tk, VLC_TICK_FROM_MS(20) );
                     i_toread = __MAX( i_toread, 100 );
                 }
             }
@@ -2619,7 +2619,7 @@ static void AVI_IndexCreate( demux_t *p_demux )
         avi_packet_t pk;
 
         /* Don't update/check dialog too often */
-        if( p_dialog_id != NULL && vlc_tick_now() - i_dialog_update > 100000 )
+        if( p_dialog_id != NULL && vlc_tick_now() - i_dialog_update > VLC_TICK_FROM_MS(100) )
         {
             if( vlc_dialog_is_cancelled( p_demux, p_dialog_id ) )
                 break;
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index 6110750c8a..22d3e4e1e0 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -620,7 +620,7 @@ static int ReadNSVs( demux_t *p_demux )
     else
     {
         msg_Dbg( p_demux, "invalid fps (0x00)" );
-        p_sys->i_pcr_inc = 40000;
+        p_sys->i_pcr_inc = VLC_TICK_FROM_MS(40);
     }
     //msg_Dbg( p_demux, "    - fps=%.3f", 1000000.0 / (double)p_sys->i_pcr_inc );
 
diff --git a/modules/demux/rawdv.c b/modules/demux/rawdv.c
index 592a425be2..5520dee84d 100644
--- a/modules/demux/rawdv.c
+++ b/modules/demux/rawdv.c
@@ -259,7 +259,7 @@ static int Demux( demux_t *p_demux )
     if( p_sys->b_hurry_up )
     {
          /* 3 frames */
-        p_sys->i_pcr = vlc_tick_now() + (p_sys->i_dsf ? 120000 : 90000);
+        p_sys->i_pcr = vlc_tick_now() + (p_sys->i_dsf ? VLC_TICK_FROM_MS(120) : VLC_TICK_FROM_MS(90));
     }
 
     /* Call the pace control */
diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 9af186edf9..5c5c5f9113 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -329,7 +329,7 @@ static int Open ( vlc_object_t *p_this )
     p_sys->subtitles.p_array  = NULL;
 
     p_sys->props.psz_header         = NULL;
-    p_sys->props.i_microsecperframe = 40000;
+    p_sys->props.i_microsecperframe = VLC_TICK_FROM_MS(40);
     p_sys->props.jss.b_inited       = false;
     p_sys->props.mpsub.b_inited     = false;
     p_sys->props.sami.psz_start     = NULL;
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index 0ce4626344..67ff65e2ca 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -1111,7 +1111,7 @@ void MainInputManager::prev()
 
 void MainInputManager::prevOrReset()
 {
-    if( !p_input || var_GetInteger( p_input, "time") < INT64_C(10000) )
+    if( !p_input || var_GetInteger( p_input, "time") < VLC_TICK_FROM_MS(10) )
         playlist_Prev( THEPL );
     else
         getIM()->sliderUpdate( 0.0 );



More information about the vlc-commits mailing list