Commit 454a3688 authored by Laurent Aimar's avatar Laurent Aimar

Added es_out_ControlGetPcrSystem helper.

Original patch by Jean-Paul Saman.
parent ee3b7205
......@@ -85,6 +85,9 @@ enum es_out_query_e
/* Set global meta data (The vlc_meta_t is not modified nor released) */
ES_OUT_SET_META, /* arg1=const vlc_meta_t * */
/* PCR system clock manipulation for external clock synchronization */
ES_OUT_GET_PCR_SYSTEM, /* arg1=mtime_t * res=can fail */
/* First value usable for private control */
ES_OUT_PRIVATE_START = 0x10000,
};
......@@ -145,6 +148,11 @@ 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 );
}
static inline int es_out_ControlGetPcrSystem( es_out_t *out, mtime_t *pi_system )
{
return es_out_Control( out, ES_OUT_GET_PCR_SYSTEM, pi_system );
}
/**
* @}
*/
......
......@@ -495,6 +495,19 @@ void input_clock_ChangeSystemOrigin( input_clock_t *cl, mtime_t i_system )
vlc_mutex_unlock( &cl->lock );
}
mtime_t input_clock_GetSystemOrigin( input_clock_t *cl )
{
vlc_mutex_lock( &cl->lock );
assert( cl->b_has_reference );
const mtime_t i_system = cl->ref.i_system;
vlc_mutex_unlock( &cl->lock );
return i_system;
}
#warning "input_clock_SetJitter needs more work"
void input_clock_SetJitter( input_clock_t *cl,
mtime_t i_pts_delay, int i_cr_average )
......
......@@ -83,6 +83,12 @@ void input_clock_ChangeRate( input_clock_t *, int i_rate );
*/
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
* reference point (a valid reference point must have been set).
*/
mtime_t input_clock_GetSystemOrigin( input_clock_t * );
/**
* This function allows to rebase the original system value date.
* It can be called only imediatly after a input_clock_Update call.
......
......@@ -2566,6 +2566,20 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return VLC_SUCCESS;
}
case ES_OUT_GET_PCR_SYSTEM:
{
if( p_sys->b_buffering )
return VLC_EGENERIC;
es_out_pgrm_t *p_pgrm = p_sys->p_pgrm;
if( !p_pgrm )
return VLC_EGENERIC;
mtime_t *pi_system = va_arg( args, mtime_t *);
*pi_system = input_clock_GetSystemOrigin( p_pgrm->p_clock );
return VLC_SUCCESS;
}
default:
msg_Err( p_sys->p_input, "unknown query in es_out_Control" );
return VLC_EGENERIC;
......
......@@ -673,7 +673,14 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
{
return ControlLockedSetFrameNext( p_out );
}
case ES_OUT_GET_PCR_SYSTEM:
{
if( p_sys->b_delayed )
return VLC_EGENERIC;
mtime_t *pi_system = (mtime_t*)va_arg( args, mtime_t * );
return es_out_ControlGetPcrSystem( p_sys->p_out, pi_system );
}
default:
msg_Err( p_sys->p_input, "Unknown es_out_Control query !" );
assert(0);
......
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