[vlc-commits] modules: use VLC_TICK_FROM_SEC instead of hardcoded values
Steve Lhomme
git at videolan.org
Wed Sep 19 11:58:02 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May 7 14:51:56 2018 +0200| [b17b44b660f314399c44299347d3e5df217093ef] | committer: Steve Lhomme
modules: use VLC_TICK_FROM_SEC instead of hardcoded values
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b17b44b660f314399c44299347d3e5df217093ef
---
modules/access/satip.c | 2 +-
modules/access_output/udp.c | 2 +-
modules/audio_output/mmdevice.h | 4 ++--
modules/codec/cc.c | 2 +-
modules/codec/cea708.c | 2 +-
modules/codec/omxil/utils.c | 4 ++--
modules/codec/schroedinger.c | 2 +-
modules/codec/substext.h | 2 +-
modules/demux/vobsub.c | 2 +-
modules/demux/webvtt.c | 2 +-
modules/misc/fingerprinter.c | 2 +-
modules/mux/mp4/mp4.c | 2 +-
12 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/modules/access/satip.c b/modules/access/satip.c
index 0429b97740..a3d7268590 100644
--- a/modules/access/satip.c
+++ b/modules/access/satip.c
@@ -420,7 +420,7 @@ static void satip_teardown(void *data) {
}
}
-#define RECV_TIMEOUT 2 * 1000 * 1000
+#define RECV_TIMEOUT VLC_TICK_FROM_SEC(2)
static void *satip_thread(void *data) {
stream_t *access = data;
access_sys_t *sys = access->p_sys;
diff --git a/modules/access_output/udp.c b/modules/access_output/udp.c
index feb413d0dd..cc53156ae9 100644
--- a/modules/access_output/udp.c
+++ b/modules/access_output/udp.c
@@ -367,7 +367,7 @@ static void* ThreadWrite( void *data )
i_date = p_sys->i_caching + p_pk->i_dts;
if( i_date_last > 0 )
{
- if( i_date - i_date_last > 2000000 )
+ if( i_date - i_date_last > VLC_TICK_FROM_SEC(2) )
{
if( !i_dropped_packets )
msg_Dbg( p_access, "mmh, hole (%"PRId64" > 2s) -> drop",
diff --git a/modules/audio_output/mmdevice.h b/modules/audio_output/mmdevice.h
index b9f0b2ae10..d671f450d3 100644
--- a/modules/audio_output/mmdevice.h
+++ b/modules/audio_output/mmdevice.h
@@ -83,8 +83,8 @@ static inline HRESULT aout_stream_Flush(aout_stream_t *s, bool wait)
{ /* Loosy drain emulation */
vlc_tick_t delay;
- if (SUCCEEDED(aout_stream_TimeGet(s, &delay))
- && delay <= INT64_C(5000000))
+ if (SUCCEEDED(aout_stream_TimeGet(s, &delay)) &&
+ delay <= VLC_TICK_FROM_SEC(5))
Sleep(MS_FROM_VLC_TICK( delay ) + 1);
return S_OK;
}
diff --git a/modules/codec/cc.c b/modules/codec/cc.c
index 8e1e3f7243..b84cce2786 100644
--- a/modules/codec/cc.c
+++ b/modules/codec/cc.c
@@ -503,7 +503,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, eia608_t *h, vlc_tick_t i_pts )
return NULL;
p_spu->i_start = i_pts;
- p_spu->i_stop = i_pts + 10000000; /* 10s max */
+ p_spu->i_stop = i_pts + VLC_TICK_FROM_SEC(10); /* 10s max */
p_spu->b_ephemer = true;
p_spu->b_absolute = false;
diff --git a/modules/codec/cea708.c b/modules/codec/cea708.c
index 4bf773fd9b..2ffd3018fc 100644
--- a/modules/codec/cea708.c
+++ b/modules/codec/cea708.c
@@ -1071,7 +1071,7 @@ static subpicture_t *CEA708_BuildSubtitle( cea708_t *p_cea708 )
}
p_spu->i_start = p_cea708->i_clock;
- p_spu->i_stop = p_cea708->i_clock + 10000000; /* 10s max */
+ p_spu->i_stop = p_cea708->i_clock + VLC_TICK_FROM_SEC(10); /* 10s max */
p_spu->b_ephemer = true;
p_spu->b_absolute = false;
diff --git a/modules/codec/omxil/utils.c b/modules/codec/omxil/utils.c
index 6df9a53d30..1ec069a068 100644
--- a/modules/codec/omxil/utils.c
+++ b/modules/codec/omxil/utils.c
@@ -81,7 +81,7 @@ OMX_ERRORTYPE WaitForOmxEvent(OmxEventQueue *queue, OMX_EVENTTYPE *event,
OMX_U32 *data_1, OMX_U32 *data_2, OMX_PTR *event_data)
{
OmxEvent *p_event;
- vlc_tick_t deadline = vlc_tick_now() + CLOCK_FREQ;
+ vlc_tick_t deadline = vlc_tick_now() + VLC_TICK_FROM_SEC(1);
vlc_mutex_lock(&queue->mutex);
@@ -124,7 +124,7 @@ OMX_ERRORTYPE WaitForSpecificOmxEvent(OmxEventQueue *queue,
if(status != OMX_ErrorNone) return status;
if(event == specific_event) break;
- if(vlc_tick_now() - before > CLOCK_FREQ) return OMX_ErrorTimeout;
+ if(vlc_tick_now() - before > VLC_TICK_FROM_SEC(1)) return OMX_ErrorTimeout;
}
return OMX_ErrorNone;
diff --git a/modules/codec/schroedinger.c b/modules/codec/schroedinger.c
index 4bdf07c843..347ca41bd5 100644
--- a/modules/codec/schroedinger.c
+++ b/modules/codec/schroedinger.c
@@ -603,7 +603,7 @@ static void SetVideoFormat( decoder_t *p_dec )
p_sys->p_format = schro_decoder_get_video_format(p_sys->p_schro);
if( p_sys->p_format == NULL ) return;
- p_sys->i_frame_pts_delta = CLOCK_FREQ
+ p_sys->i_frame_pts_delta = VLC_TICK_FROM_SEC(1)
* p_sys->p_format->frame_rate_denominator
/ p_sys->p_format->frame_rate_numerator;
diff --git a/modules/codec/substext.h b/modules/codec/substext.h
index d014af8237..50ca70a907 100644
--- a/modules/codec/substext.h
+++ b/modules/codec/substext.h
@@ -261,7 +261,7 @@ static void SubpictureTextUpdate(subpicture_t *subpic,
if( b_schedule_blink_update &&
(sys->i_next_update == VLC_TICK_INVALID || sys->i_next_update < ts) )
{
- sys->i_next_update = ts + CLOCK_FREQ;
+ sys->i_next_update = ts + VLC_TICK_FROM_SEC(1);
sys->b_blink_even = !sys->b_blink_even;
}
}
diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index 7cf12c15b8..3de858fee1 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -174,7 +174,7 @@ static int Open ( vlc_object_t *p_this )
if( p_sys->track[i].i_subtitles > 1 )
{
if( p_sys->track[i].p_subtitles[p_sys->track[i].i_subtitles-1].i_start > p_sys->i_length )
- p_sys->i_length = (int64_t) p_sys->track[i].p_subtitles[p_sys->track[i].i_subtitles-1].i_start + ( 1 *1000 *1000 );
+ p_sys->i_length = (int64_t) p_sys->track[i].p_subtitles[p_sys->track[i].i_subtitles-1].i_start + VLC_TICK_FROM_SEC( 1 );
}
}
}
diff --git a/modules/demux/webvtt.c b/modules/demux/webvtt.c
index 74c758c713..505096d099 100644
--- a/modules/demux/webvtt.c
+++ b/modules/demux/webvtt.c
@@ -583,7 +583,7 @@ static int Demux( demux_t *p_demux )
if ( !p_sys->b_slave )
{
es_out_SetPCR( p_demux->out, VLC_TICK_0 + i_barrier );
- p_sys->i_next_demux_time += CLOCK_FREQ;
+ p_sys->i_next_demux_time += VLC_TICK_FROM_SEC(1);
}
if( p_sys->index.i_current >= p_sys->index.i_count )
diff --git a/modules/misc/fingerprinter.c b/modules/misc/fingerprinter.c
index c11475a96f..5dd1e979d0 100644
--- a/modules/misc/fingerprinter.c
+++ b/modules/misc/fingerprinter.c
@@ -328,7 +328,7 @@ static void *Run( void *opaque )
/* main loop */
for (;;)
{
- vlc_tick_sleep( CLOCK_FREQ );
+ vlc_tick_sleep( VLC_TICK_FROM_SEC(1) );
QueueIncomingRequests( p_sys );
diff --git a/modules/mux/mp4/mp4.c b/modules/mux/mp4/mp4.c
index d2bef82d10..7cb6012be8 100644
--- a/modules/mux/mp4/mp4.c
+++ b/modules/mux/mp4/mp4.c
@@ -679,7 +679,7 @@ static int MuxStream(sout_mux_t *p_mux, sout_input_t *p_input, mp4_stream_t *p_s
else
{
vlc_tick_t i_diff = dts_fb_pts( p_next ) - dts_fb_pts( p_data );
- if (i_diff < CLOCK_FREQ) /* protection */
+ if (i_diff < VLC_TICK_FROM_SEC(1)) /* protection */
p_data->i_length = i_diff;
}
}
More information about the vlc-commits
mailing list