Commit b4dfbc62 authored by Steve Lhomme's avatar Steve Lhomme

rename mdate() to vlc_tick_now()

The lua "mdate" remains the same.
parent 8b0c6bb9
...@@ -175,7 +175,7 @@ struct audio_output ...@@ -175,7 +175,7 @@ struct audio_output
* clock and the media upstream clock (if any). * clock and the media upstream clock (if any).
* *
* If the audio output clock is exactly synchronized with the system * If the audio output clock is exactly synchronized with the system
* monotonic clock (i.e. mdate()), then aout_TimeGetDefault() can * monotonic clock (i.e. vlc_tick_now()), then aout_TimeGetDefault() can
* implement this callback. * implement this callback.
* *
* \param delay pointer to the delay until the next sample to be written * \param delay pointer to the delay until the next sample to be written
......
...@@ -430,7 +430,7 @@ static inline int decoder_GetInputAttachments( decoder_t *dec, ...@@ -430,7 +430,7 @@ static inline int decoder_GetInputAttachments( decoder_t *dec,
/** /**
* This function converts a decoder timestamp into a display date comparable * This function converts a decoder timestamp into a display date comparable
* to mdate(). * to vlc_tick_now().
* You MUST use it *only* for gathering statistics about speed. * You MUST use it *only* for gathering statistics about speed.
*/ */
VLC_USED VLC_USED
......
...@@ -84,7 +84,7 @@ VLC_API int vlc_mwait_i11e(vlc_tick_t); ...@@ -84,7 +84,7 @@ VLC_API int vlc_mwait_i11e(vlc_tick_t);
*/ */
static inline int vlc_msleep_i11e(vlc_tick_t delay) static inline int vlc_msleep_i11e(vlc_tick_t delay)
{ {
return vlc_mwait_i11e(mdate() + delay); return vlc_mwait_i11e(vlc_tick_now() + delay);
} }
/** /**
......
...@@ -521,7 +521,7 @@ VLC_API void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex); ...@@ -521,7 +521,7 @@ VLC_API void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex);
* *
* This works like vlc_cond_wait() but with an additional time-out. * This works like vlc_cond_wait() but with an additional time-out.
* The time-out is expressed as an absolute timestamp using the same arbitrary * The time-out is expressed as an absolute timestamp using the same arbitrary
* time reference as the mdate() and vlc_tick_wait() functions. * time reference as the vlc_tick_now() and vlc_tick_wait() functions.
* *
* \note This function is a cancellation point. In case of thread cancellation, * \note This function is a cancellation point. In case of thread cancellation,
* the mutex is always locked before cancellation proceeds. * the mutex is always locked before cancellation proceeds.
...@@ -534,7 +534,7 @@ VLC_API void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex); ...@@ -534,7 +534,7 @@ VLC_API void vlc_cond_wait(vlc_cond_t *cond, vlc_mutex_t *mutex);
* \warning If the variable was initialized with vlc_cond_init_daytime(), or * \warning If the variable was initialized with vlc_cond_init_daytime(), or
* was statically initialized with \ref VLC_STATIC_COND, the time reference * was statically initialized with \ref VLC_STATIC_COND, the time reference
* used by this function is unspecified (depending on the implementation, it * used by this function is unspecified (depending on the implementation, it
* might be the Unix epoch or the mdate() clock). * might be the Unix epoch or the vlc_tick_now() clock).
* *
* \return 0 if the condition was signaled, an error code in case of timeout. * \return 0 if the condition was signaled, an error code in case of timeout.
*/ */
...@@ -842,12 +842,12 @@ VLC_API unsigned long vlc_thread_id(void) VLC_USED; ...@@ -842,12 +842,12 @@ VLC_API unsigned long vlc_thread_id(void) VLC_USED;
* *
* \return a timestamp in microseconds. * \return a timestamp in microseconds.
*/ */
VLC_API vlc_tick_t mdate(void); VLC_API vlc_tick_t vlc_tick_now(void);
/** /**
* Waits until a deadline. * Waits until a deadline.
* *
* \param deadline timestamp to wait for (\ref mdate()) * \param deadline timestamp to wait for (\ref vlc_tick_now())
* *
* \note The deadline may be exceeded due to OS scheduling. * \note The deadline may be exceeded due to OS scheduling.
* \note This function is a cancellation point. * \note This function is a cancellation point.
...@@ -959,7 +959,7 @@ VLC_API void vlc_timer_destroy(vlc_timer_t timer); ...@@ -959,7 +959,7 @@ VLC_API void vlc_timer_destroy(vlc_timer_t timer);
* timer is still running. See also vlc_timer_getoverrun(). * timer is still running. See also vlc_timer_getoverrun().
* *
* \param timer initialized timer * \param timer initialized timer
* \param absolute the timer value origin is the same as mdate() if true, * \param absolute the timer value origin is the same as vlc_tick_now() if true,
* the timer value is relative to now if false. * the timer value is relative to now if false.
* \param value zero to disarm the timer, otherwise the initial time to wait * \param value zero to disarm the timer, otherwise the initial time to wait
* before firing the timer. * before firing the timer.
......
...@@ -238,7 +238,7 @@ libvlc_module_description_t *libvlc_video_filter_list_get( libvlc_instance_t *p_ ...@@ -238,7 +238,7 @@ libvlc_module_description_t *libvlc_video_filter_list_get( libvlc_instance_t *p_
int64_t libvlc_clock(void) int64_t libvlc_clock(void)
{ {
return mdate(); return vlc_tick_now();
} }
const char vlc_module_name[] = "libvlc"; const char vlc_module_name[] = "libvlc";
...@@ -182,7 +182,7 @@ static void *Thread (void *data) ...@@ -182,7 +182,7 @@ static void *Thread (void *data)
vlc_tick_t pts; vlc_tick_t pts;
frames = snd_pcm_readi (pcm, block->p_buffer, sys->period_size); frames = snd_pcm_readi (pcm, block->p_buffer, sys->period_size);
pts = mdate (); pts = vlc_tick_now ();
if (frames < 0) if (frames < 0)
{ {
block_Release (block); block_Release (block);
...@@ -242,7 +242,7 @@ static int Control (demux_t *demux, int query, va_list ap) ...@@ -242,7 +242,7 @@ static int Control (demux_t *demux, int query, va_list ap)
switch (query) switch (query)
{ {
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
*va_arg (ap, int64_t *) = mdate () - sys->start; *va_arg (ap, int64_t *) = vlc_tick_now () - sys->start;
break; break;
case DEMUX_GET_PTS_DELAY: case DEMUX_GET_PTS_DELAY:
...@@ -458,7 +458,7 @@ static int Open (vlc_object_t *obj) ...@@ -458,7 +458,7 @@ static int Open (vlc_object_t *obj)
fmt.audio.i_rate = param; fmt.audio.i_rate = param;
sys->rate = param; sys->rate = param;
sys->start = mdate (); sys->start = vlc_tick_now ();
sys->caching = INT64_C(1000) * var_InheritInteger (demux, "live-caching"); sys->caching = INT64_C(1000) * var_InheritInteger (demux, "live-caching");
param = sys->caching; param = sys->caching;
val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, &param, NULL); val = snd_pcm_hw_params_set_buffer_time_near (pcm, hw, &param, NULL);
......
...@@ -456,7 +456,7 @@ static int Control(demux_t *p_demux, int i_query, va_list args) ...@@ -456,7 +456,7 @@ static int Control(demux_t *p_demux, int i_query, va_list args)
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = va_arg(args, int64_t *); pi64 = va_arg(args, int64_t *);
*pi64 = mdate(); *pi64 = vlc_tick_now();
return VLC_SUCCESS; return VLC_SUCCESS;
default: default:
......
...@@ -414,7 +414,7 @@ static void startBackground(demux_t *p_demux) ...@@ -414,7 +414,7 @@ static void startBackground(demux_t *p_demux)
} }
// XXX TODO: what would be correct timestamp ??? // XXX TODO: what would be correct timestamp ???
p_block->i_dts = p_block->i_pts = mdate() + CLOCK_FREQ/25; p_block->i_dts = p_block->i_pts = vlc_tick_now() + CLOCK_FREQ/25;
uint8_t *p = p_block->p_buffer; uint8_t *p = p_block->p_buffer;
memset(p, 0, fmt.video.i_width * fmt.video.i_height); memset(p, 0, fmt.video.i_width * fmt.video.i_height);
...@@ -1634,7 +1634,7 @@ static void bluraySendOverlayToVout(demux_t *p_demux, bluray_overlay_t *p_ov) ...@@ -1634,7 +1634,7 @@ static void bluraySendOverlayToVout(demux_t *p_demux, bluray_overlay_t *p_ov)
return; return;
} }
p_pic->i_start = p_pic->i_stop = mdate(); p_pic->i_start = p_pic->i_stop = vlc_tick_now();
p_pic->i_channel = vout_RegisterSubpictureChannel(p_sys->p_vout); p_pic->i_channel = vout_RegisterSubpictureChannel(p_sys->p_vout);
p_ov->i_channel = p_pic->i_channel; p_ov->i_channel = p_pic->i_channel;
...@@ -2189,7 +2189,7 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout ) ...@@ -2189,7 +2189,7 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout )
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
/* time period elapsed ? */ /* time period elapsed ? */
if (p_sys->i_still_end_time > 0 && p_sys->i_still_end_time <= mdate()) { if (p_sys->i_still_end_time > 0 && p_sys->i_still_end_time <= vlc_tick_now()) {
msg_Dbg(p_demux, "Still image end"); msg_Dbg(p_demux, "Still image end");
bd_read_skip_still(p_sys->bluray); bd_read_skip_still(p_sys->bluray);
...@@ -2201,7 +2201,7 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout ) ...@@ -2201,7 +2201,7 @@ static void blurayStillImage( demux_t *p_demux, unsigned i_timeout )
if (!p_sys->i_still_end_time) { if (!p_sys->i_still_end_time) {
if (i_timeout) { if (i_timeout) {
msg_Dbg(p_demux, "Still image (%d seconds)", i_timeout); msg_Dbg(p_demux, "Still image (%d seconds)", i_timeout);
p_sys->i_still_end_time = mdate() + i_timeout * CLOCK_FREQ; p_sys->i_still_end_time = vlc_tick_now() + i_timeout * CLOCK_FREQ;
} else { } else {
msg_Dbg(p_demux, "Still image (infinite)"); msg_Dbg(p_demux, "Still image (infinite)");
p_sys->i_still_end_time = -1; p_sys->i_still_end_time = -1;
......
...@@ -452,7 +452,7 @@ static block_t *GrabVideo( demux_t *p_demux ) ...@@ -452,7 +452,7 @@ static block_t *GrabVideo( demux_t *p_demux )
memcpy( p_block->p_buffer, (const char *)p_sys->frame->image, memcpy( p_block->p_buffer, (const char *)p_sys->frame->image,
p_sys->width * p_sys->height * 2 ); p_sys->width * p_sys->height * 2 );
p_block->i_pts = p_block->i_dts = mdate(); p_block->i_pts = p_block->i_dts = vlc_tick_now();
dc1394_capture_enqueue( p_sys->camera, p_sys->frame ); dc1394_capture_enqueue( p_sys->camera, p_sys->frame );
return p_block; return p_block;
} }
...@@ -502,7 +502,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -502,7 +502,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return VLC_SUCCESS; return VLC_SUCCESS;
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
*va_arg( args, int64_t * ) = mdate(); *va_arg( args, int64_t * ) = vlc_tick_now();
return VLC_SUCCESS; return VLC_SUCCESS;
/* TODO implement others */ /* TODO implement others */
......
...@@ -773,7 +773,7 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -773,7 +773,7 @@ static int DemuxOpen( vlc_object_t *p_this )
p_stream->p_es = es_out_Add( p_demux->out, &fmt ); p_stream->p_es = es_out_Add( p_demux->out, &fmt );
} }
p_sys->i_start = mdate(); p_sys->i_start = vlc_tick_now();
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -1988,7 +1988,7 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args ) ...@@ -1988,7 +1988,7 @@ static int DemuxControl( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
pi64 = va_arg( args, int64_t * ); pi64 = va_arg( args, int64_t * );
*pi64 = mdate() - p_sys->i_start; *pi64 = vlc_tick_now() - p_sys->i_start;
return VLC_SUCCESS; return VLC_SUCCESS;
/* TODO implement others */ /* TODO implement others */
......
...@@ -638,7 +638,7 @@ STDMETHODIMP CapturePin::Receive( IMediaSample *pSample ) ...@@ -638,7 +638,7 @@ STDMETHODIMP CapturePin::Receive( IMediaSample *pSample )
msg_Dbg( p_input, "CapturePin::Receive" ); msg_Dbg( p_input, "CapturePin::Receive" );
#endif #endif
vlc_tick_t i_timestamp = mdate() * 10; vlc_tick_t i_timestamp = vlc_tick_now() * 10;
VLCMediaSample vlc_sample = {pSample, i_timestamp}; VLCMediaSample vlc_sample = {pSample, i_timestamp};
vlc_mutex_lock( &p_sys->lock ); vlc_mutex_lock( &p_sys->lock );
......
...@@ -340,7 +340,7 @@ ssize_t BDAOutput::Pop(void *buf, size_t len, int ms) ...@@ -340,7 +340,7 @@ ssize_t BDAOutput::Pop(void *buf, size_t len, int ms)
vlc_mutex_locker l( &lock ); vlc_mutex_locker l( &lock );
vlc_tick_t i_deadline = mdate() + ms * 1000; vlc_tick_t i_deadline = vlc_tick_now() + ms * 1000;
while( !p_first ) while( !p_first )
{ {
if( vlc_cond_timedwait( &wait, &lock, i_deadline ) ) if( vlc_cond_timedwait( &wait, &lock, i_deadline ) )
......
...@@ -1439,7 +1439,7 @@ static void DateTimeSend( cam_t * p_cam, int i_session_id ) ...@@ -1439,7 +1439,7 @@ static void DateTimeSend( cam_t * p_cam, int i_session_id )
APDUSend( p_cam, i_session_id, AOT_DATE_TIME, p_response, 7 ); APDUSend( p_cam, i_session_id, AOT_DATE_TIME, p_response, 7 );
p_date->i_last = mdate(); p_date->i_last = vlc_tick_now();
} }
} }
...@@ -1488,7 +1488,7 @@ static void DateTimeManage( cam_t * p_cam, int i_session_id ) ...@@ -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; (date_time_t *)p_cam->p_sessions[i_session_id - 1].p_sys;
if ( p_date->i_interval if ( p_date->i_interval
&& mdate() > p_date->i_last + (vlc_tick_t)p_date->i_interval * CLOCK_FREQ ) && vlc_tick_now() > p_date->i_last + (vlc_tick_t)p_date->i_interval * CLOCK_FREQ )
{ {
DateTimeSend( p_cam, i_session_id ); DateTimeSend( p_cam, i_session_id );
} }
...@@ -2030,7 +2030,7 @@ void en50221_Poll( cam_t * p_cam ) ...@@ -2030,7 +2030,7 @@ void en50221_Poll( cam_t * p_cam )
switch( p_cam->i_ca_type ) switch( p_cam->i_ca_type )
{ {
case CA_CI_LINK: case CA_CI_LINK:
if( mdate() > p_cam->i_next_event ) if( vlc_tick_now() > p_cam->i_next_event )
break; break;
case CA_CI: case CA_CI:
return; return;
...@@ -2168,7 +2168,7 @@ void en50221_Poll( cam_t * p_cam ) ...@@ -2168,7 +2168,7 @@ void en50221_Poll( cam_t * p_cam )
} }
} }
p_cam->i_next_event = mdate() + p_cam->i_timeout; p_cam->i_next_event = vlc_tick_now() + p_cam->i_timeout;
} }
......
...@@ -389,7 +389,7 @@ Raw1394Handler(raw1394handle_t handle, unsigned char *data, ...@@ -389,7 +389,7 @@ Raw1394Handler(raw1394handle_t handle, unsigned char *data,
if( p_sys->p_ev->p_frame ) if( p_sys->p_ev->p_frame )
{ {
/* Push current frame to p_access thread. */ /* Push current frame to p_access thread. */
//p_sys->p_ev->p_frame->i_pts = mdate(); //p_sys->p_ev->p_frame->i_pts = vlc_tick_now();
block_ChainAppend( &p_sys->p_frame, p_sys->p_ev->p_frame ); block_ChainAppend( &p_sys->p_frame, p_sys->p_ev->p_frame );
} }
/* reset list */ /* reset list */
......
...@@ -292,7 +292,7 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata, ...@@ -292,7 +292,7 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata,
FrontendGetStatus( &p_sys->dvb, &status ); FrontendGetStatus( &p_sys->dvb, &status );
bool b_has_lock = status.b_has_lock; bool b_has_lock = status.b_has_lock;
vlc_tick_t i_scan_start = mdate(); vlc_tick_t i_scan_start = vlc_tick_now();
for( ; *pi_count == 0; ) for( ; *pi_count == 0; )
{ {
...@@ -304,7 +304,7 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata, ...@@ -304,7 +304,7 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata,
do do
{ {
vlc_tick_t i_poll_timeout = i_scan_start - mdate() + i_timeout; vlc_tick_t i_poll_timeout = i_scan_start - vlc_tick_now() + i_timeout;
i_ret = 0; i_ret = 0;
...@@ -332,7 +332,7 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata, ...@@ -332,7 +332,7 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata,
FrontendGetStatus( &p_sys->dvb, &status ); FrontendGetStatus( &p_sys->dvb, &status );
if( status.b_has_lock && !b_has_lock ) if( status.b_has_lock && !b_has_lock )
{ {
i_scan_start = mdate(); i_scan_start = vlc_tick_now();
b_has_lock = true; b_has_lock = true;
} }
} }
......
...@@ -421,7 +421,7 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter, ...@@ -421,7 +421,7 @@ scan_t *scan_New( vlc_object_t *p_obj, const scan_parameter_t *p_parameter,
p_scan->b_multiplexes_from_nit = false; p_scan->b_multiplexes_from_nit = false;
scan_parameter_Init( &p_scan->parameter ); scan_parameter_Init( &p_scan->parameter );
scan_parameter_Copy( p_parameter, &p_scan->parameter ); scan_parameter_Copy( p_parameter, &p_scan->parameter );
p_scan->i_time_start = mdate(); p_scan->i_time_start = vlc_tick_now();
p_scan->p_scanlist = NULL; p_scan->p_scanlist = NULL;
p_scan->i_scanlist = 0; p_scan->i_scanlist = 0;
...@@ -812,7 +812,7 @@ static int scan_Next( scan_t *p_scan, scan_tuner_config_t *p_cfg ) ...@@ -812,7 +812,7 @@ static int scan_Next( scan_t *p_scan, scan_tuner_config_t *p_cfg )
//while( !scan_tuner_config_ParametersValidate( &p_scan->parameter, p_cfg ) ); //while( !scan_tuner_config_ParametersValidate( &p_scan->parameter, p_cfg ) );
const size_t i_total_services = scan_CountServices( p_scan ); const size_t i_total_services = scan_CountServices( p_scan );
const vlc_tick_t i_eta = f_position > 0.005 ? (mdate() - p_scan->i_time_start) * ( 1.0 / f_position - 1.0 ) : -1; const vlc_tick_t i_eta = f_position > 0.005 ? (vlc_tick_now() - p_scan->i_time_start) * ( 1.0 / f_position - 1.0 ) : -1;
char psz_eta[MSTRTIME_MAX_SIZE]; char psz_eta[MSTRTIME_MAX_SIZE];
const char *psz_fmt = _("%.1f MHz (%d services)\n~%s remaining"); const char *psz_fmt = _("%.1f MHz (%d services)\n~%s remaining");
...@@ -871,12 +871,12 @@ int scan_Run( scan_t *p_scan ) ...@@ -871,12 +871,12 @@ int scan_Run( scan_t *p_scan )
/* */ /* */
uint8_t packet[TS_PACKET_SIZE * SCAN_READ_BUFFER_COUNT]; uint8_t packet[TS_PACKET_SIZE * SCAN_READ_BUFFER_COUNT];
int64_t i_scan_start = mdate(); int64_t i_scan_start = vlc_tick_now();
for( ;; ) for( ;; )
{ {
unsigned i_timeout = scan_session_GetTablesTimeout( session ); unsigned i_timeout = scan_session_GetTablesTimeout( session );
vlc_tick_t i_remaining = mdate() - i_scan_start; vlc_tick_t i_remaining = vlc_tick_now() - i_scan_start;
if( i_remaining > i_timeout ) if( i_remaining > i_timeout )
break; break;
......
...@@ -69,7 +69,7 @@ typedef struct ...@@ -69,7 +69,7 @@ typedef struct
static int DemuxPause( demux_t *demux ) static int DemuxPause( demux_t *demux )
{ {
demux_sys_t *p_sys = demux->p_sys; demux_sys_t *p_sys = demux->p_sys;
vlc_tick_t now = mdate(); vlc_tick_t now = vlc_tick_now();
if( now >= p_sys->end ) if( now >= p_sys->end )
return 0; return 0;
...@@ -88,7 +88,7 @@ static int ControlPause( demux_t *demux, int query, va_list args ) ...@@ -88,7 +88,7 @@ static int ControlPause( demux_t *demux, int query, va_list args )
{ {
double *ppos = va_arg( args, double * ); double *ppos = va_arg( args, double * );
double pos; double pos;
vlc_tick_t now = mdate(); vlc_tick_t now = vlc_tick_now();
pos = 1. + ((double)(now - p_sys->end) / (double)p_sys->length); pos = 1. + ((double)(now - p_sys->end) / (double)p_sys->length);
*ppos = (pos <= 1.) ? pos : 1.; *ppos = (pos <= 1.) ? pos : 1.;
...@@ -98,7 +98,7 @@ static int ControlPause( demux_t *demux, int query, va_list args ) ...@@ -98,7 +98,7 @@ static int ControlPause( demux_t *demux, int query, va_list args )
case DEMUX_SET_POSITION: case DEMUX_SET_POSITION:
{ {
double pos = va_arg( args, double ); double pos = va_arg( args, double );
vlc_tick_t now = mdate(); vlc_tick_t now = vlc_tick_now();
p_sys->end = now + (p_sys->length * (1. - pos)); p_sys->end = now + (p_sys->length * (1. - pos));
break; break;
...@@ -114,14 +114,14 @@ static int ControlPause( demux_t *demux, int query, va_list args ) ...@@ -114,14 +114,14 @@ static int ControlPause( demux_t *demux, int query, va_list args )
case DEMUX_GET_TIME: case DEMUX_GET_TIME:
{ {
vlc_tick_t *ppos = va_arg( args, vlc_tick_t * ); vlc_tick_t *ppos = va_arg( args, vlc_tick_t * );
*ppos = mdate() + p_sys->length - p_sys->end; *ppos = vlc_tick_now() + p_sys->length - p_sys->end;
break; break;
} }
case DEMUX_SET_TIME: case DEMUX_SET_TIME:
{ {
vlc_tick_t pos = va_arg( args, vlc_tick_t ); vlc_tick_t pos = va_arg( args, vlc_tick_t );
p_sys->end = mdate() + p_sys->length - pos; p_sys->end = vlc_tick_now() + p_sys->length - pos;
break; break;
} }
...@@ -188,7 +188,7 @@ nop: ...@@ -188,7 +188,7 @@ nop:
if( p_sys == NULL ) if( p_sys == NULL )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys->end = mdate() + length; p_sys->end = vlc_tick_now() + length;
p_sys->length = length; p_sys->length = length;
p_demux->p_sys = p_sys; p_demux->p_sys = p_sys;
......
...@@ -223,7 +223,7 @@ static int DemuxOpen( vlc_object_t *p_this ) ...@@ -223,7 +223,7 @@ static int DemuxOpen( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
p_sys->i_state = STATE_NOSYNC; p_sys->i_state = STATE_NOSYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
/* SDI AR */ /* SDI AR */
unsigned int i_num, i_den; unsigned int i_num, i_den;
...@@ -1416,10 +1416,10 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1416,10 +1416,10 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,
const uint8_t *p_line; const uint8_t *p_line;
if ( p_sys->i_state != STATE_SYNC if ( p_sys->i_state != STATE_SYNC
&& p_sys->i_last_state_change < mdate() - RESYNC_TIMEOUT ) && p_sys->i_last_state_change < vlc_tick_now() - RESYNC_TIMEOUT )
{ {
p_sys->i_state = STATE_NOSYNC; p_sys->i_state = STATE_NOSYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
return VLC_EGENERIC; return VLC_EGENERIC;
} }
...@@ -1431,7 +1431,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1431,7 +1431,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,
if ( p_parser == NULL ) if ( p_parser == NULL )
break; break;
p_sys->i_state = STATE_STARTSYNC; p_sys->i_state = STATE_STARTSYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
case STATE_STARTSYNC: case STATE_STARTSYNC:
p_parser = FindReferenceCode( FIELD_1_VBLANK_EAV, p_parser, p_end ); p_parser = FindReferenceCode( FIELD_1_VBLANK_EAV, p_parser, p_end );
...@@ -1439,7 +1439,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1439,7 +1439,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,
break; break;
p_sys->i_anc_size = 0; p_sys->i_anc_size = 0;
p_sys->i_state = STATE_ANCSYNC; p_sys->i_state = STATE_ANCSYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
case STATE_ANCSYNC: case STATE_ANCSYNC:
p_parser = CountReference( &p_sys->i_anc_size, p_parser = CountReference( &p_sys->i_anc_size,
...@@ -1448,7 +1448,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1448,7 +1448,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,
break; break;
p_sys->i_active_size = 0; p_sys->i_active_size = 0;
p_sys->i_state = STATE_LINESYNC; p_sys->i_state = STATE_LINESYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
case STATE_LINESYNC: case STATE_LINESYNC:
p_parser = CountReference( &p_sys->i_active_size, p_parser = CountReference( &p_sys->i_active_size,
...@@ -1457,7 +1457,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1457,7 +1457,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,
break; break;
p_sys->i_picture_size = p_sys->i_anc_size + p_sys->i_active_size; p_sys->i_picture_size = p_sys->i_anc_size + p_sys->i_active_size;
p_sys->i_state = STATE_ACTIVESYNC; p_sys->i_state = STATE_ACTIVESYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
case STATE_ACTIVESYNC: case STATE_ACTIVESYNC:
p_parser = CountReference( &p_sys->i_picture_size, p_parser = CountReference( &p_sys->i_picture_size,
...@@ -1467,7 +1467,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1467,7 +1467,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,
p_sys->i_line_offset = p_sys->i_picture_size p_sys->i_line_offset = p_sys->i_picture_size
/ (p_sys->i_anc_size + p_sys->i_active_size); / (p_sys->i_anc_size + p_sys->i_active_size);
p_sys->i_state = STATE_VBLANKSYNC; p_sys->i_state = STATE_VBLANKSYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
case STATE_VBLANKSYNC: case STATE_VBLANKSYNC:
p_parser = CountReference( &p_sys->i_picture_size, p_parser = CountReference( &p_sys->i_picture_size,
...@@ -1475,7 +1475,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1475,7 +1475,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,
if ( p_parser == NULL ) if ( p_parser == NULL )
break; break;
p_sys->i_state = STATE_PICSYNC; p_sys->i_state = STATE_PICSYNC;
p_sys->i_last_state_change = mdate(); p_sys->i_last_state_change = vlc_tick_now();
case STATE_PICSYNC: case STATE_PICSYNC:
p_parser = CountReference( &p_sys->i_picture_size, p_parser = CountReference( &p_sys->i_picture_size,
...@@ -1490,7 +1490,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer, ...@@ -1490,7 +1490,7 @@ static int HandleSDBuffer( demux_t *p_demux, uint8_t *p_buffer,