[vlc-commits] modules: convert variables in seconds to ticks using vlc_tick_from_sec()
Steve Lhomme
git at videolan.org
Tue Jul 3 15:30:44 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jul 3 14:07:58 2018 +0200| [911569be2ccd64c44ccaea0cca96888b8899c537] | committer: Steve Lhomme
modules: convert variables in seconds to ticks using vlc_tick_from_sec()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=911569be2ccd64c44ccaea0cca96888b8899c537
---
modules/access/bluray.c | 2 +-
modules/access/dtv/en50221.c | 2 +-
modules/access/dvdnav.c | 2 +-
modules/access/idummy.c | 2 +-
modules/access/live555.cpp | 2 +-
modules/access/v4l2/video.c | 2 +-
modules/access_output/livehttp.c | 2 +-
modules/codec/scte18.c | 2 +-
modules/codec/ttml/ttml.h | 2 +-
modules/control/gestures.c | 6 +++---
modules/control/hotkeys.c | 2 +-
modules/control/oldrc.c | 2 +-
modules/demux/avi/avi.c | 8 ++++----
modules/demux/hls/playlist/Parser.cpp | 2 +-
modules/demux/image.c | 2 +-
modules/demux/mpeg/ts.c | 8 ++++----
modules/demux/ogg.c | 2 +-
modules/demux/playlist/m3u.c | 2 +-
modules/demux/tta.c | 6 +++---
modules/gui/macosx/VLCCoreInteraction.m | 2 +-
modules/gui/macosx/VLCInputManager.m | 2 +-
modules/gui/macosx/VLCMainMenu.m | 2 +-
modules/gui/macosx/VLCRemoteControlService.m | 2 +-
modules/gui/macosx/applescript.m | 2 +-
modules/gui/qt/components/extended_panels.cpp | 4 ++--
modules/gui/qt/input_manager.cpp | 4 ++--
modules/lua/vlc.c | 2 +-
modules/misc/rtsp.c | 2 +-
modules/services_discovery/sap.c | 2 +-
modules/spu/rss.c | 3 +--
modules/stream_out/cycle.c | 10 +++++-----
modules/stream_out/rtsp.c | 6 +++---
modules/video_output/decklink.cpp | 2 +-
src/os2/thread.c | 2 +-
34 files changed, 52 insertions(+), 53 deletions(-)
diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index b43c095837..b8dd93f773 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -2201,7 +2201,7 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout )
if (!p_sys->i_still_end_time) {
if (i_timeout) {
msg_Dbg(p_demux, "Still image (%d seconds)", i_timeout);
- p_sys->i_still_end_time = vlc_tick_now() + i_timeout * CLOCK_FREQ;
+ p_sys->i_still_end_time = vlc_tick_now() + vlc_tick_from_sec( i_timeout );
} else {
msg_Dbg(p_demux, "Still image (infinite)");
p_sys->i_still_end_time = -1;
diff --git a/modules/access/dtv/en50221.c b/modules/access/dtv/en50221.c
index bd36f588c5..03e98dc021 100644
--- a/modules/access/dtv/en50221.c
+++ b/modules/access/dtv/en50221.c
@@ -1488,7 +1488,7 @@ static void DateTimeManage( cam_t * p_cam, int i_session_id )
(date_time_t *)p_cam->p_sessions[i_session_id - 1].p_sys;
if ( p_date->i_interval
- && vlc_tick_now() > p_date->i_last + (vlc_tick_t)p_date->i_interval * CLOCK_FREQ )
+ && vlc_tick_now() > p_date->i_last + vlc_tick_from_sec( p_date->i_interval ) )
{
DateTimeSend( p_cam, i_session_id );
}
diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index 264e608daf..ce2079c6c2 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -871,7 +871,7 @@ static int Demux( demux_t *p_demux )
if( event->length != 0xff && p_sys->still.b_created )
{
- vlc_tick_t delay = event->length * CLOCK_FREQ;
+ vlc_tick_t delay = vlc_tick_from_sec( event->length );
vlc_timer_schedule( p_sys->still.timer, false, delay, 0 );
}
diff --git a/modules/access/idummy.c b/modules/access/idummy.c
index 7194a19d48..2e3ce9a96a 100644
--- a/modules/access/idummy.c
+++ b/modules/access/idummy.c
@@ -178,7 +178,7 @@ nop:
if( !strncasecmp( psz_name, "pause:", 6 ) )
{
double f = us_atof( psz_name + 6 );
- vlc_tick_t length = f * CLOCK_FREQ;
+ vlc_tick_t length = vlc_tick_from_sec( f );
msg_Info( p_demux, "command `pause %f'", f );
if( length == 0 )
diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 0786853e65..b20db653ec 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -1932,7 +1932,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
//msg_Dbg( p_demux, "pts: %d", pts.tv_sec );
- int64_t i_pts = (int64_t)pts.tv_sec * CLOCK_FREQ +
+ vlc_tick_t i_pts = vlc_tick_from_sec( pts.tv_sec ) +
(int64_t)pts.tv_usec;
/* XXX Beurk beurk beurk Avoid having negative value XXX */
diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index 3d87b176ba..9a08aeb3c2 100644
--- a/modules/access/v4l2/video.c
+++ b/modules/access/v4l2/video.c
@@ -567,7 +567,7 @@ vlc_tick_t GetBufferPTS (const struct v4l2_buffer *buf)
switch (buf->flags & V4L2_BUF_FLAG_TIMESTAMP_MASK)
{
case V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC:
- pts = (buf->timestamp.tv_sec * CLOCK_FREQ)
+ pts = vlc_tick_from_sec( buf->timestamp.tv_sec )
+ buf->timestamp.tv_usec;
static_assert (CLOCK_FREQ == 1000000, "Clock unit mismatch");
break;
diff --git a/modules/access_output/livehttp.c b/modules/access_output/livehttp.c
index 2659e6205d..aa0a1785c4 100644
--- a/modules/access_output/livehttp.c
+++ b/modules/access_output/livehttp.c
@@ -235,7 +235,7 @@ static int Open( vlc_object_t *p_this )
/* Try to get within asked segment length */
p_sys->i_seglen = var_GetInteger( p_access, SOUT_CFG_PREFIX "seglen" );
- p_sys->i_seglenm = CLOCK_FREQ * p_sys->i_seglen;
+ p_sys->i_seglenm = vlc_tick_from_sec( p_sys->i_seglen );
p_sys->full_segments = NULL;
p_sys->full_segments_end = &p_sys->full_segments;
diff --git a/modules/codec/scte18.c b/modules/codec/scte18.c
index 62254bc70c..73ee7cda21 100644
--- a/modules/codec/scte18.c
+++ b/modules/codec/scte18.c
@@ -190,7 +190,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
p_spu->i_start = p_block->i_pts;
if( p_cea->alert_message_time_remaining )
- p_spu->i_stop = p_spu->i_start + CLOCK_FREQ * p_cea->alert_message_time_remaining;
+ p_spu->i_stop = p_spu->i_start + vlc_tick_from_sec( p_cea->alert_message_time_remaining );
else
p_spu->i_stop = VLC_TICK_INVALID;
diff --git a/modules/codec/ttml/ttml.h b/modules/codec/ttml/ttml.h
index e91b43a1c6..efa8c1ef29 100644
--- a/modules/codec/ttml/ttml.h
+++ b/modules/codec/ttml/ttml.h
@@ -150,7 +150,7 @@ static inline tt_time_t tt_time_Sub( tt_time_t t1, tt_time_t t2 )
if( t2.frames > t1.frames )
{
unsigned diff = 1 + (t2.frames - t1.frames) / TT_FRAME_RATE;
- t1.base -= diff * CLOCK_FREQ;
+ t1.base -= vlc_tick_from_sec( diff );
t1.frames += diff * TT_FRAME_RATE;
}
t1.frames -= t2.frames;
diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index 891456f255..b4f17fefe5 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -201,7 +201,7 @@ static void ProcessGesture( intf_thread_t *p_intf )
int it = var_InheritInteger( p_intf , "short-jump-size" );
if( it > 0 )
- var_SetInteger( p_input, "time-offset", -CLOCK_FREQ * it );
+ var_SetInteger( p_input, "time-offset", vlc_tick_from_sec( -it ) );
vlc_object_release( p_input );
break;
}
@@ -216,7 +216,7 @@ static void ProcessGesture( intf_thread_t *p_intf )
int it = var_InheritInteger( p_intf , "short-jump-size" );
if( it > 0 )
- var_SetInteger( p_input, "time-offset", CLOCK_FREQ * it );
+ var_SetInteger( p_input, "time-offset", vlc_tick_from_sec( it ) );
vlc_object_release( p_input );
break;
}
@@ -479,7 +479,7 @@ static int InputEvent( vlc_object_t *p_this, char const *psz_var,
/* intf-event is serialized against itself and is the sole user of
* p_sys->p_vout. So there is no need to acquire the lock currently. */
if( p_sys->p_vout != NULL )
- { /* /!\ Beware of lock inversion with var_DelCallback() /!\ */
+ { /* /!\ Beware of lock inversion with var_DelCallback() /!\ */
var_DelCallback( p_sys->p_vout, "mouse-moved", MovedEvent,
p_intf );
var_DelCallback( p_sys->p_vout, "mouse-button-down", ButtonEvent,
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index ac10feb6e1..818e41237f 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -981,7 +981,7 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
vlc_tick_t it = var_InheritInteger( p_input, varname );
if( it < 0 )
break;
- var_SetInteger( p_input, "time-offset", it * sign * CLOCK_FREQ );
+ var_SetInteger( p_input, "time-offset", vlc_tick_from_sec( it * sign ) );
DisplayPosition( p_vout, slider_chan, p_input );
break;
}
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 2c9c2728e3..3cdbf8f04e 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -984,7 +984,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
else
{
int t = atoi( newval.psz_string );
- var_SetInteger( p_input, "time", CLOCK_FREQ * t );
+ var_SetInteger( p_input, "time", vlc_tick_from_sec( t ) );
}
i_error = VLC_SUCCESS;
}
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index a3d46accde..b2a79adbc2 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1047,7 +1047,7 @@ static int Demux_Seekable( demux_t *p_demux )
if( i_track_count <= 0 )
{
- int64_t i_length = p_sys->i_length * CLOCK_FREQ;
+ int64_t i_length = vlc_tick_from_sec( p_sys->i_length );
p_sys->i_time += p_sys->i_read_increment;
if( i_length > 0 )
@@ -1710,7 +1710,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
else
{
- i64 = (vlc_tick_t)(f * CLOCK_FREQ * p_sys->i_length);
+ i64 = vlc_tick_from_sec( f * p_sys->i_length );
return Seek( p_demux, i64, f, b );
}
@@ -1798,7 +1798,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
* Function to convert pts to chunk or byte
*****************************************************************************/
-static int64_t AVI_Rescale( int64_t i_value, uint32_t i_timescale, uint32_t i_newscale )
+static int64_t AVI_Rescale( vlc_tick_t i_value, uint32_t i_timescale, uint32_t i_newscale )
{
/* TODO: replace (and mp4) with better global helper (recursive checks) */
if( i_timescale == i_newscale )
@@ -1840,7 +1840,7 @@ static vlc_tick_t AVI_GetDPTS( avi_track_t *tk, int64_t i_count )
return i_dpts;
if( tk->i_scale )
- i_dpts = AVI_Rescale( CLOCK_FREQ * i_count, tk->i_rate, tk->i_scale );
+ i_dpts = AVI_Rescale( vlc_tick_from_sec( i_count ), tk->i_rate, tk->i_scale );
if( tk->i_samplesize )
{
diff --git a/modules/demux/hls/playlist/Parser.cpp b/modules/demux/hls/playlist/Parser.cpp
index 4d84c34f9b..9bb06ef0bc 100644
--- a/modules/demux/hls/playlist/Parser.cpp
+++ b/modules/demux/hls/playlist/Parser.cpp
@@ -253,7 +253,7 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
duration = durAttribute->floatingPoint();
ctx_extinf = NULL;
}
- const vlc_tick_t nzDuration = CLOCK_FREQ * duration;
+ const vlc_tick_t nzDuration = vlc_tick_from_sec( duration );
segment->duration.Set(duration * (uint64_t) rep->getTimescale());
segment->startTime.Set(rep->getTimescale().ToScaled(nzStartTime));
nzStartTime += nzDuration;
diff --git a/modules/demux/image.c b/modules/demux/image.c
index dc9df51e50..de4d88d322 100644
--- a/modules/demux/image.c
+++ b/modules/demux/image.c
@@ -731,7 +731,7 @@ static int Open(vlc_object_t *object)
sys->data = data;
sys->es = es_out_Add(demux->out, &fmt);
- sys->duration = CLOCK_FREQ * var_InheritFloat(demux, "image-duration");
+ sys->duration = vlc_tick_from_sec( var_InheritFloat(demux, "image-duration") );
sys->is_realtime = var_InheritBool(demux, "image-realtime");
sys->pts_offset = sys->is_realtime ? vlc_tick_now() : 0;
sys->pts_next = VLC_TICK_INVALID;
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 26c2fd1d04..3c6ced8e9b 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -961,11 +961,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
time_t i_time, i_length;
if( !EITCurrentEventTime( p_pmt, p_sys, &i_time, &i_length ) &&
- i_length > 0 && !SeekToTime( p_demux, p_pmt, (int64_t)(TO_SCALE(i_length * CLOCK_FREQ) * f) ) )
+ i_length > 0 && !SeekToTime( p_demux, p_pmt, (int64_t)(TO_SCALE( vlc_tick_from_sec( i_length * f ))) ) )
{
ReadyQueuesPostSeek( p_demux );
es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME,
- (int64_t)(TO_SCALE(i_length * CLOCK_FREQ) * f) );
+ (int64_t)(TO_SCALE( vlc_tick_from_sec( i_length * f ))) );
return VLC_SUCCESS;
}
}
@@ -1018,7 +1018,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
time_t i_event_start;
if( !EITCurrentEventTime( p_pmt, p_sys, &i_event_start, NULL ) )
{
- *pi64 = i_event_start * CLOCK_FREQ;
+ *pi64 = vlc_tick_from_sec( i_event_start );
return VLC_SUCCESS;
}
}
@@ -1039,7 +1039,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
time_t i_event_duration;
if( !EITCurrentEventTime( p_pmt, p_sys, NULL, &i_event_duration ) )
{
- *pi64 = i_event_duration * CLOCK_FREQ;
+ *pi64 = vlc_tick_from_sec( i_event_duration );
return VLC_SUCCESS;
}
}
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index e2a9a23f8a..4fc2d28a0a 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -786,7 +786,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
}
assert( p_sys->i_length > 0 );
- i64 = CLOCK_FREQ * p_sys->i_length * f;
+ i64 = vlc_tick_from_sec( f * p_sys->i_length );
Ogg_PreparePostSeek( p_sys );
if ( Oggseek_SeektoAbsolutetime( p_demux, p_stream, VLC_TICK_0 + i64 ) >= 0 )
{
diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index 1c01dcbb7e..36b99958db 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -255,7 +255,7 @@ static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
FREENULL( psz_artist );
parseEXTINF( psz_parse, &psz_artist, &psz_name, &i_parsed_duration );
if( i_parsed_duration >= 0 )
- i_duration = i_parsed_duration * CLOCK_FREQ;
+ i_duration = vlc_tick_from_sec( i_parsed_duration );
if( psz_name )
psz_name = pf_dup( psz_name );
if( psz_artist )
diff --git a/modules/demux/tta.c b/modules/demux/tta.c
index 278952e5cb..187065eb17 100644
--- a/modules/demux/tta.c
+++ b/modules/demux/tta.c
@@ -208,7 +208,7 @@ static int Demux( demux_t *p_demux )
p_sys->pi_seektable[p_sys->i_currentframe] );
if( p_data == NULL )
return VLC_DEMUXER_EOF;
- p_data->i_dts = p_data->i_pts = VLC_TICK_0 + CLOCK_FREQ * p_sys->i_currentframe * TTA_FRAMETIME;
+ p_data->i_dts = p_data->i_pts = VLC_TICK_0 + vlc_tick_from_sec( p_sys->i_currentframe * TTA_FRAMETIME );
p_sys->i_currentframe++;
@@ -266,12 +266,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_LENGTH:
pi64 = va_arg( args, int64_t * );
- *pi64 = CLOCK_FREQ * p_sys->i_totalframes * TTA_FRAMETIME;
+ *pi64 = vlc_tick_from_sec( p_sys->i_totalframes * TTA_FRAMETIME );
return VLC_SUCCESS;
case DEMUX_GET_TIME:
pi64 = va_arg( args, int64_t * );
- *pi64 = CLOCK_FREQ * p_sys->i_currentframe * TTA_FRAMETIME;
+ *pi64 = vlc_tick_from_sec( p_sys->i_currentframe * TTA_FRAMETIME );
return VLC_SUCCESS;
case DEMUX_CAN_PAUSE:
diff --git a/modules/gui/macosx/VLCCoreInteraction.m b/modules/gui/macosx/VLCCoreInteraction.m
index 3b329a1d49..d1bdc2e604 100644
--- a/modules/gui/macosx/VLCCoreInteraction.m
+++ b/modules/gui/macosx/VLCCoreInteraction.m
@@ -359,7 +359,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
int64_t i_interval = var_InheritInteger( p_input, p_value );
if (i_interval > 0) {
- vlc_tick_t val = CLOCK_FREQ * i_interval;
+ vlc_tick_t val = vlc_tick_from_sec( i_interval );
if (!b_value)
val = val * -1;
var_SetInteger( p_input, "time-offset", val );
diff --git a/modules/gui/macosx/VLCInputManager.m b/modules/gui/macosx/VLCInputManager.m
index e99b40b0a3..fb68f37f77 100644
--- a/modules/gui/macosx/VLCInputManager.m
+++ b/modules/gui/macosx/VLCInputManager.m
@@ -670,7 +670,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
if (result == RESUME_RESTART)
return;
- vlc_tick_t lastPos = (vlc_tick_t)lastPosition.intValue * CLOCK_FREQ;
+ vlc_tick_t lastPos = vlc_tick_from_sec( lastPosition.intValue );
msg_Dbg(getIntf(), "continuing playback at %lld", lastPos);
var_SetInteger(p_input_thread, "time", lastPos);
};
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index 407bfe8d8c..21d8f2570a 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -847,7 +847,7 @@
input_thread_t *p_input = pl_CurrentInput(getIntf());
if (p_input) {
- input_Control(p_input, INPUT_SET_TIME, (int64_t)(returnTime * CLOCK_FREQ));
+ input_Control(p_input, INPUT_SET_TIME, vlc_tick_from_sec( returnTime ));
vlc_object_release(p_input);
}
}];
diff --git a/modules/gui/macosx/VLCRemoteControlService.m b/modules/gui/macosx/VLCRemoteControlService.m
index 04d0fe2bcd..2e68cacd52 100644
--- a/modules/gui/macosx/VLCRemoteControlService.m
+++ b/modules/gui/macosx/VLCRemoteControlService.m
@@ -132,7 +132,7 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle()
}
if (event.command == cc.changePlaybackPositionCommand) {
MPChangePlaybackPositionCommandEvent *positionEvent = (MPChangePlaybackPositionCommandEvent *)event;
- [coreInteraction jumpToTime:positionEvent.positionTime * CLOCK_FREQ];
+ [coreInteraction jumpToTime: vlc_tick_from_sec( positionEvent.positionTime )];
return MPRemoteCommandHandlerStatusSuccess;
}
if (event.command == cc.changeRepeatModeCommand) {
diff --git a/modules/gui/macosx/applescript.m b/modules/gui/macosx/applescript.m
index 7fe7a536cf..a74d901e33 100644
--- a/modules/gui/macosx/applescript.m
+++ b/modules/gui/macosx/applescript.m
@@ -243,7 +243,7 @@
if (!p_input)
return;
- input_Control(p_input, INPUT_SET_TIME, (int64_t)(i64_value * CLOCK_FREQ));
+ input_Control(p_input, INPUT_SET_TIME, vlc_tick_from_sec( i64_value ));
vlc_object_release(p_input);
}
}
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index 768ffe5241..041dff4308 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -1509,7 +1509,7 @@ void SyncControls::advanceAudio( double f_advance )
{
if( THEMIM->getInput() && b_userAction )
{
- int64_t i_delay = f_advance * CLOCK_FREQ;
+ vlc_tick_t i_delay = vlc_tick_from_sec( f_advance );
var_SetInteger( THEMIM->getInput(), "audio-delay", i_delay );
}
}
@@ -1518,7 +1518,7 @@ void SyncControls::advanceSubs( double f_advance )
{
if( THEMIM->getInput() && b_userAction )
{
- int64_t i_delay = f_advance * CLOCK_FREQ;
+ vlc_tick_t i_delay = vlc_tick_from_sec( f_advance );
var_SetInteger( THEMIM->getInput(), "spu-delay", i_delay );
}
}
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index ed0e65e353..1a06d41f97 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -927,7 +927,7 @@ void InputManager::jumpFwd()
int i_interval = var_InheritInteger( p_input, "short-jump-size" );
if( i_interval > 0 && hasInput() )
{
- vlc_tick_t val = CLOCK_FREQ * i_interval;
+ vlc_tick_t val = vlc_tick_from_sec( i_interval );
var_SetInteger( p_input, "time-offset", val );
}
}
@@ -937,7 +937,7 @@ void InputManager::jumpBwd()
int i_interval = var_InheritInteger( p_input, "short-jump-size" );
if( i_interval > 0 && hasInput() )
{
- vlc_tick_t val = -CLOCK_FREQ * i_interval;
+ vlc_tick_t val = vlc_tick_from_sec( -i_interval );
var_SetInteger( p_input, "time-offset", val );
}
}
diff --git a/modules/lua/vlc.c b/modules/lua/vlc.c
index 65631558e6..6caec54d3c 100644
--- a/modules/lua/vlc.c
+++ b/modules/lua/vlc.c
@@ -488,7 +488,7 @@ input_item_t *vlclua_read_input_item(vlc_object_t *obj, lua_State *L)
lua_getfield( L, -3, "duration" );
if (lua_isnumber(L, -1))
- duration = (vlc_tick_t)(lua_tonumber(L, -1) * (CLOCK_FREQ * 1.));
+ duration = vlc_tick_from_sec( lua_tonumber(L, -1) );
else if (!lua_isnil(L, -1))
msg_Warn(obj, "Playlist item duration should be a number (seconds)");
lua_pop( L, 1 ); /* pop "duration" */
diff --git a/modules/misc/rtsp.c b/modules/misc/rtsp.c
index f3f5ad8545..1bd5581152 100644
--- a/modules/misc/rtsp.c
+++ b/modules/misc/rtsp.c
@@ -928,7 +928,7 @@ static int64_t ParseNPT (const char *str)
uselocale (oldloc);
freelocale (loc);
}
- return sec * CLOCK_FREQ;
+ return vlc_tick_from_sec( sec );
}
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 7e5ce60574..04d3e67d5d 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -579,7 +579,7 @@ static void *Run( void *data )
/* Check for items that need deletion */
for( int i = 0; i < p_sys->i_announces; i++ )
{
- vlc_tick_t i_timeout = CLOCK_FREQ * p_sys->i_timeout;
+ vlc_tick_t i_timeout = vlc_tick_from_sec( p_sys->i_timeout );
sap_announce_t * p_announce = p_sys->pp_announces[i];
vlc_tick_t i_last_period = now - p_announce->i_last;
diff --git a/modules/spu/rss.c b/modules/spu/rss.c
index bd51456ea9..44e1074a9b 100644
--- a/modules/spu/rss.c
+++ b/modules/spu/rss.c
@@ -313,8 +313,7 @@ static int CreateFilter( vlc_object_t *p_this )
vlc_mutex_destroy( &p_sys->lock );
goto error;
}
- vlc_timer_schedule( p_sys->timer, false, 1,
- (vlc_tick_t)(i_ttl)*CLOCK_FREQ );
+ vlc_timer_schedule( p_sys->timer, false, 1, vlc_tick_from_sec(i_ttl) );
free( psz_urls );
return VLC_SUCCESS;
diff --git a/modules/stream_out/cycle.c b/modules/stream_out/cycle.c
index 0f6fe14183..aeda97d63e 100644
--- a/modules/stream_out/cycle.c
+++ b/modules/stream_out/cycle.c
@@ -210,24 +210,24 @@ static vlc_tick_t ParseTime(const char *str)
case 'w':
if (u > 15250284U)
return -1;
- return CLOCK_FREQ * 604800LLU * u;
+ return vlc_tick_from_sec( 604800LLU * u );
case 'd':
if (u > 106751991U)
return -1;
- return CLOCK_FREQ * 86400LLU * u;
+ return vlc_tick_from_sec( 86400LLU * u );
case 'h':
if (u > 2562047788U)
return -1;
- return CLOCK_FREQ * 3600LLU * u;
+ return vlc_tick_from_sec( 3600LLU * u );
case 'm':
if (u > 153722867280U)
return -1;
- return CLOCK_FREQ * 60LLU * u;
+ return vlc_tick_from_sec( 60LLU * u );
case 's':
case 0:
if (u > 9223372036854U)
return -1;
- return CLOCK_FREQ * u;
+ return vlc_tick_from_sec( u );
}
return -1;
}
diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 80b136b852..bc37df375f 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -310,7 +310,7 @@ static void RtspUpdateTimer( rtsp_stream_t *rtsp )
timeout = rtsp->sessionv[i]->last_seen;
}
if (timeout != 0)
- timeout += rtsp->timeout * CLOCK_FREQ;
+ timeout += vlc_tick_from_sec( rtsp->timeout );
vlc_timer_schedule(rtsp->timer, true, timeout, 0);
}
@@ -323,7 +323,7 @@ static void RtspTimeOut( void *data )
vlc_tick_t now = vlc_tick_now();
for (int i = rtsp->sessionc - 1; i >= 0; i--)
{
- if (rtsp->sessionv[i]->last_seen + rtsp->timeout * CLOCK_FREQ < now)
+ if (rtsp->sessionv[i]->last_seen + vlc_tick_from_sec( rtsp->timeout ) < now)
{
if (rtsp->vod_media != NULL)
{
@@ -588,7 +588,7 @@ static int64_t ParseNPT (const char *str)
uselocale (oldloc);
freelocale (loc);
}
- return sec < 0 ? -1 : sec * CLOCK_FREQ;
+ return sec < 0 ? -1 : vlc_tick_from_sec( sec );
}
diff --git a/modules/video_output/decklink.cpp b/modules/video_output/decklink.cpp
index 75b546ceda..de7b869365 100644
--- a/modules/video_output/decklink.cpp
+++ b/modules/video_output/decklink.cpp
@@ -898,7 +898,7 @@ static void PrepareVideo(vout_display_t *vd, picture_t *picture, subpicture_t *,
if (!picture)
return;
- if (now - date > sys->video.nosignal_delay * CLOCK_FREQ) {
+ if (now - date > vlc_tick_from_sec( sys->video.nosignal_delay )) {
msg_Dbg(vd, "no signal");
if (sys->video.pic_nosignal) {
picture = sys->video.pic_nosignal;
diff --git a/src/os2/thread.c b/src/os2/thread.c
index 8884497dea..d3a64f17fa 100644
--- a/src/os2/thread.c
+++ b/src/os2/thread.c
@@ -418,7 +418,7 @@ int vlc_cond_timedwait_daytime (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
gettimeofday (&tv, NULL);
- total = CLOCK_FREQ * tv.tv_sec +
+ total = vlc_tick_from_sec( tv.tv_sec ) +
CLOCK_FREQ * tv.tv_usec / 1000000L;
total = (deadline - total) / 1000;
if( total < 0 )
More information about the vlc-commits
mailing list