[vlc-commits] modules: use the vlc_tick_t/ms conversion macros for hardcoded values
Steve Lhomme
git at videolan.org
Fri Jul 6 16:07:48 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May 7 08:55:33 2018 +0200| [be8197f5720706c25c32efd0cb0e97e11ee40fce] | committer: Steve Lhomme
modules: use the vlc_tick_t/ms conversion macros for hardcoded values
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=be8197f5720706c25c32efd0cb0e97e11ee40fce
---
modules/access/dtv/linux.c | 8 ++++----
modules/access/dvb/linux_dvb.c | 6 +++---
modules/access/satip.c | 2 +-
modules/audio_output/coreaudio_common.c | 2 +-
modules/audio_output/directsound.c | 2 +-
modules/codec/gstreamer/gstdecode.c | 2 +-
modules/spu/remoteosd.c | 7 +++----
7 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/modules/access/dtv/linux.c b/modules/access/dtv/linux.c
index e5d75d03f2..1c097620a3 100644
--- a/modules/access/dtv/linux.c
+++ b/modules/access/dtv/linux.c
@@ -843,7 +843,7 @@ known:
cmd.msg[4] = cmd.msg[5] = 0; /* unused */
cmd.msg_len = 4; /* length */
- vlc_tick_sleep (15000); /* wait 15 ms before DiSEqC command */
+ vlc_tick_sleep (VLC_TICK_FROM_MS(15)); /* wait 15 ms before DiSEqC command */
unsigned uncommitted = var_InheritInteger (d->obj, "dvb-uncommitted");
if (uncommitted > 0)
{
@@ -872,7 +872,7 @@ known:
vlc_strerror_c(errno));
return -1;
}
- vlc_tick_sleep(125000); /* wait 125 ms before committed DiSEqC command */
+ vlc_tick_sleep(VLC_TICK_FROM_MS(125)); /* wait 125 ms before committed DiSEqC command */
}
if (ioctl (d->frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd) < 0)
{
@@ -880,7 +880,7 @@ known:
vlc_strerror_c(errno));
return -1;
}
- vlc_tick_sleep (54000 + 15000);
+ vlc_tick_sleep (VLC_TICK_FROM_MS(54 + 15));
/* Mini-DiSEqC */
satno &= 1;
@@ -891,7 +891,7 @@ known:
vlc_strerror_c(errno));
return -1;
}
- vlc_tick_sleep (15000);
+ vlc_tick_sleep (VLC_TICK_FROM_MS(15));
}
/* Continuous tone (to select high oscillator frequency) */
diff --git a/modules/access/dvb/linux_dvb.c b/modules/access/dvb/linux_dvb.c
index ad0112f376..bd39374efa 100644
--- a/modules/access/dvb/linux_dvb.c
+++ b/modules/access/dvb/linux_dvb.c
@@ -685,7 +685,7 @@ static int DoDiseqc( vlc_object_t *p_access, dvb_sys_t *p_sys )
}
/* Wait for at least 15 ms. */
- vlc_tick_sleep(15000);
+ vlc_tick_sleep(VLC_TICK_FROM_MS(15));
i_val = var_GetInteger( p_access, "dvb-satno" );
if( i_val > 0 && i_val < 5 )
@@ -724,7 +724,7 @@ static int DoDiseqc( vlc_object_t *p_access, dvb_sys_t *p_sys )
return VLC_EGENERIC;
}
- vlc_tick_sleep(15000);
+ vlc_tick_sleep(VLC_TICK_FROM_MS(15));
}
if( ioctl( p_sys->i_frontend_handle, FE_SET_TONE, fe_tone ) )
@@ -735,7 +735,7 @@ static int DoDiseqc( vlc_object_t *p_access, dvb_sys_t *p_sys )
return VLC_EGENERIC;
}
- vlc_tick_sleep(50000);
+ vlc_tick_sleep(VLC_TICK_FROM_MS(50));
return 0;
}
diff --git a/modules/access/satip.c b/modules/access/satip.c
index 6dabeb4302..da10a2658a 100644
--- a/modules/access/satip.c
+++ b/modules/access/satip.c
@@ -415,7 +415,7 @@ static void satip_teardown(void *data) {
/* Extra sleep for compatibility with some satip servers, that
* can't handle new sessions right after teardown */
- vlc_tick_sleep(150000);
+ vlc_tick_sleep(VLC_TICK_FROM_MS(150));
}
}
}
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index 1bf1a8c10e..a5598c62a7 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -248,7 +248,7 @@ ca_Flush(audio_output_t *p_aout, bool wait)
/* Calculate the duration of the circular buffer, in order to wait
* for the render thread to play it all */
const vlc_tick_t i_frame_us =
- FramesToUs(p_sys, BytesToFrames(p_sys, p_sys->i_out_size)) + 10000;
+ FramesToUs(p_sys, BytesToFrames(p_sys, p_sys->i_out_size)) + VLC_TICK_FROM_MS(10);
lock_unlock(p_sys);
vlc_tick_sleep(i_frame_us);
lock_lock(p_sys);
diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index d460b13896..69733b32b1 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -1138,7 +1138,7 @@ static void * PlayedDataEraser( void * data )
tosleep = ( tosleep / p_sys->i_bytes_per_sample ) * CLOCK_FREQ / p_sys->i_rate;
}
- tosleep = __MAX( tosleep, 20000 );
+ tosleep = __MAX( tosleep, VLC_TICK_FROM_MS(20) );
dsresult = IDirectSoundBuffer_Lock( p_sys->p_dsbuffer,
p_sys->i_write,
toerase,
diff --git a/modules/codec/gstreamer/gstdecode.c b/modules/codec/gstreamer/gstdecode.c
index 1a33d6f669..3a90ad4e04 100644
--- a/modules/codec/gstreamer/gstdecode.c
+++ b/modules/codec/gstreamer/gstdecode.c
@@ -112,7 +112,7 @@ void gst_vlc_dec_ensure_empty_queue( decoder_t *p_dec )
while( p_sys->b_running && i_count < 60 &&
gst_atomic_queue_length( p_sys->p_que ))
{
- vlc_tick_sleep ( 15000 );
+ vlc_tick_sleep ( VLC_TICK_FROM_MS(15) );
i_count++;
}
diff --git a/modules/spu/remoteosd.c b/modules/spu/remoteosd.c
index e1ec87495a..6a542ff98f 100644
--- a/modules/spu/remoteosd.c
+++ b/modules/spu/remoteosd.c
@@ -702,12 +702,11 @@ static void* update_request_thread( void *obj )
{
filter_t* p_filter = (filter_t*)obj;
int canc = vlc_savecancel();
- vlc_tick_t interval = var_InheritInteger( p_filter, RMTOSD_CFG "update" );
+ vlc_tick_t interval = VLC_TICK_FROM_MS( var_InheritInteger( p_filter, RMTOSD_CFG "update" ) );
vlc_restorecancel(canc);
- if( interval < 100 )
- interval = 100;
- interval *= 1000; /* ms -> µs */
+ if( interval < VLC_TICK_FROM_MS(100) )
+ interval = VLC_TICK_FROM_MS(100);
do
vlc_tick_sleep( interval );
More information about the vlc-commits
mailing list