Commit 028ea651 authored by Laurent Aimar's avatar Laurent Aimar

Extended input_GetPcrSystem to also return the current delay.

parent b06569fa
...@@ -86,7 +86,7 @@ enum es_out_query_e ...@@ -86,7 +86,7 @@ enum es_out_query_e
ES_OUT_SET_META, /* arg1=const vlc_meta_t * */ ES_OUT_SET_META, /* arg1=const vlc_meta_t * */
/* PCR system clock manipulation for external clock synchronization */ /* PCR system clock manipulation for external clock synchronization */
ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t * res=can fail */ ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=mtime_t, res=can fail */ ES_OUT_MODIFY_PCR_SYSTEM, /* arg1=int is_absolute, arg2=mtime_t, res=can fail */
/* First value usable for private control */ /* First value usable for private control */
...@@ -147,9 +147,9 @@ static inline int es_out_ControlSetMeta( es_out_t *out, const vlc_meta_t *p_meta ...@@ -147,9 +147,9 @@ static inline int es_out_ControlSetMeta( es_out_t *out, const vlc_meta_t *p_meta
return es_out_Control( out, ES_OUT_SET_META, p_meta ); return es_out_Control( out, ES_OUT_SET_META, p_meta );
} }
static inline int es_out_ControlGetPcrSystem( es_out_t *out, mtime_t *pi_system ) static inline int es_out_ControlGetPcrSystem( es_out_t *out, mtime_t *pi_system, mtime_t *pi_delay )
{ {
return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system ); return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system, pi_delay );
} }
static inline int es_out_ControlModifyPcrSystem( es_out_t *out, bool b_absolute, mtime_t i_system ) static inline int es_out_ControlModifyPcrSystem( es_out_t *out, bool b_absolute, mtime_t i_system )
{ {
......
...@@ -516,7 +516,7 @@ enum input_query_e ...@@ -516,7 +516,7 @@ enum input_query_e
INPUT_GET_ES_OBJECTS, /* arg1=int id, vlc_object_t **dec, vout_thread_t **, aout_instance_t ** */ INPUT_GET_ES_OBJECTS, /* arg1=int id, vlc_object_t **dec, vout_thread_t **, aout_instance_t ** */
/* External clock managments */ /* External clock managments */
INPUT_GET_PCR_SYSTEM, /* arg1=mtime_t * res=can fail */ INPUT_GET_PCR_SYSTEM, /* arg1=mtime_t *, arg2=mtime_t * res=can fail */
INPUT_MODIFY_PCR_SYSTEM,/* arg1=int absolute, arg2=mtime_t res=can fail */ INPUT_MODIFY_PCR_SYSTEM,/* arg1=int absolute, arg2=mtime_t res=can fail */
}; };
...@@ -622,9 +622,9 @@ static inline int input_GetEsObjects( input_thread_t *p_input, int i_id, ...@@ -622,9 +622,9 @@ static inline int input_GetEsObjects( input_thread_t *p_input, int i_id,
/** /**
* \see input_clock_GetSystemOrigin * \see input_clock_GetSystemOrigin
*/ */
static inline int input_GetPcrSystem( input_thread_t *p_input, mtime_t *pi_system ) static inline int input_GetPcrSystem( input_thread_t *p_input, mtime_t *pi_system, mtime_t *pi_delay )
{ {
return input_Control( p_input, INPUT_GET_PCR_SYSTEM, pi_system ); return input_Control( p_input, INPUT_GET_PCR_SYSTEM, pi_system, pi_delay );
} }
/** /**
* \see input_clock_ChangeSystemOrigin * \see input_clock_ChangeSystemOrigin
......
...@@ -164,8 +164,9 @@ void Close(vlc_object_t *object) ...@@ -164,8 +164,9 @@ void Close(vlc_object_t *object)
static mtime_t GetPcrSystem(input_thread_t *input) static mtime_t GetPcrSystem(input_thread_t *input)
{ {
int canc = vlc_savecancel(); int canc = vlc_savecancel();
/* TODO use the delay */
mtime_t system; mtime_t system;
if (input_GetPcrSystem(input, &system)) if (input_GetPcrSystem(input, &system, NULL))
system = -1; system = -1;
vlc_restorecancel(canc); vlc_restorecancel(canc);
...@@ -251,7 +252,7 @@ static void *Slave(void *handle) ...@@ -251,7 +252,7 @@ static void *Slave(void *handle)
int canc = vlc_savecancel(); int canc = vlc_savecancel();
mtime_t client_system; mtime_t client_system;
if (!input_GetPcrSystem(sys->input, &client_system)) { if (!input_GetPcrSystem(sys->input, &client_system, NULL)) {
const mtime_t diff_system = client_system - master_system - diff_date; const mtime_t diff_system = client_system - master_system - diff_date;
if (diff_system != 0) { if (diff_system != 0) {
input_ModifyPcrSystem(sys->input, true, master_system - diff_date); input_ModifyPcrSystem(sys->input, true, master_system - diff_date);
......
...@@ -515,17 +515,17 @@ void input_clock_ChangeSystemOrigin( input_clock_t *cl, bool b_absolute, mtime_t ...@@ -515,17 +515,17 @@ void input_clock_ChangeSystemOrigin( input_clock_t *cl, bool b_absolute, mtime_t
vlc_mutex_unlock( &cl->lock ); vlc_mutex_unlock( &cl->lock );
} }
mtime_t input_clock_GetSystemOrigin( input_clock_t *cl ) void input_clock_GetSystemOrigin( input_clock_t *cl, mtime_t *pi_system, mtime_t *pi_delay )
{ {
vlc_mutex_lock( &cl->lock ); vlc_mutex_lock( &cl->lock );
assert( cl->b_has_reference ); assert( cl->b_has_reference );
const mtime_t i_system = cl->ref.i_system; *pi_system = cl->ref.i_system;
if( pi_delay )
*pi_delay = cl->i_pts_delay;
vlc_mutex_unlock( &cl->lock ); vlc_mutex_unlock( &cl->lock );
return i_system;
} }
#warning "input_clock_SetJitter needs more work" #warning "input_clock_SetJitter needs more work"
......
...@@ -84,10 +84,10 @@ void input_clock_ChangeRate( input_clock_t *, int i_rate ); ...@@ -84,10 +84,10 @@ void input_clock_ChangeRate( input_clock_t *, int i_rate );
void input_clock_ChangePause( input_clock_t *, bool b_paused, mtime_t i_date ); void input_clock_ChangePause( input_clock_t *, bool b_paused, mtime_t i_date );
/** /**
* This function returns the original system value date for the current * This function returns the original system value date and the delay for the current
* reference point (a valid reference point must have been set). * reference point (a valid reference point must have been set).
*/ */
mtime_t input_clock_GetSystemOrigin( input_clock_t * ); void input_clock_GetSystemOrigin( input_clock_t *, mtime_t *pi_system, mtime_t *pi_delay );
/** /**
* This function allows to rebase the original system value date (a valid * This function allows to rebase the original system value date (a valid
......
...@@ -466,7 +466,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) ...@@ -466,7 +466,8 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
case INPUT_GET_PCR_SYSTEM: case INPUT_GET_PCR_SYSTEM:
{ {
mtime_t *pi_system = va_arg( args, mtime_t * ); mtime_t *pi_system = va_arg( args, mtime_t * );
return es_out_ControlGetPcrSystem( p_input->p->p_es_out_display, pi_system ); mtime_t *pi_delay = va_arg( args, mtime_t * );
return es_out_ControlGetPcrSystem( p_input->p->p_es_out_display, pi_system, pi_delay );
} }
case INPUT_MODIFY_PCR_SYSTEM: case INPUT_MODIFY_PCR_SYSTEM:
......
...@@ -2624,7 +2624,8 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args ) ...@@ -2624,7 +2624,8 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return VLC_EGENERIC; return VLC_EGENERIC;
mtime_t *pi_system = va_arg( args, mtime_t *); mtime_t *pi_system = va_arg( args, mtime_t *);
*pi_system = input_clock_GetSystemOrigin( p_pgrm->p_clock ); mtime_t *pi_delay = va_arg( args, mtime_t *);
input_clock_GetSystemOrigin( p_pgrm->p_clock, pi_system, pi_delay );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -678,7 +678,8 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args ) ...@@ -678,7 +678,8 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
return VLC_EGENERIC; return VLC_EGENERIC;
mtime_t *pi_system = (mtime_t*)va_arg( args, mtime_t * ); mtime_t *pi_system = (mtime_t*)va_arg( args, mtime_t * );
return es_out_ControlGetPcrSystem( p_sys->p_out, pi_system ); mtime_t *pi_delay = (mtime_t*)va_arg( args, mtime_t * );
return es_out_ControlGetPcrSystem( p_sys->p_out, pi_system, pi_delay );
} }
case ES_OUT_MODIFY_PCR_SYSTEM: case ES_OUT_MODIFY_PCR_SYSTEM:
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment