Commit 64002dd1 authored by Laurent Aimar's avatar Laurent Aimar

Added input internal es_out_GetEsObjects to retreives decoder associated objects.

It will allow to removes vlc_object_find(_*) hacks.
parent d3354533
......@@ -624,6 +624,19 @@ size_t input_DecoderGetFifoSize( decoder_t *p_dec )
return block_FifoSize( p_owner->p_fifo );
}
void input_DecoderGetObjects( decoder_t *p_dec,
vout_thread_t **pp_vout, aout_instance_t **pp_aout )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
vlc_mutex_lock( &p_owner->lock );
if( pp_vout )
*pp_vout = vlc_object_hold( p_owner->p_vout );
if( pp_aout )
*pp_aout = vlc_object_hold( p_owner->p_aout );
vlc_mutex_unlock( &p_owner->lock );
}
/*****************************************************************************
* Internal functions
*****************************************************************************/
......
......@@ -104,4 +104,11 @@ bool input_DecoderHasFormatChanged( decoder_t *p_dec, es_format_t *p_fmt, vlc_me
*/
size_t input_DecoderGetFifoSize( decoder_t *p_dec );
/**
* This function returns the objects associated to a decoder
*
* They must be released using vlc_object_release().
*/
void input_DecoderGetObjects( decoder_t *, vout_thread_t **, aout_instance_t ** );
#endif
......@@ -2459,6 +2459,32 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return i_ret;
}
case ES_OUT_GET_ES_OBJECTS_BY_ID:
{
const int i_id = va_arg( args, int );
es_out_id_t *p_es = EsOutGetFromID( out, i_id );
if( !p_es )
return VLC_EGENERIC;
vlc_object_t **pp_decoder = va_arg( args, vlc_object_t ** );
vout_thread_t **pp_vout = va_arg( args, vout_thread_t ** );
aout_instance_t **pp_aout = va_arg( args, aout_instance_t ** );
if( es->p_dec )
{
if( pp_decoder )
*pp_decoder = vlc_object_hold( es->p_dec );
input_DecoderGetObjects( es->p_dec, pp_vout, pp_aout );
}
else
{
if( pp_vout )
*pp_vout = NULL;
if( pp_aout )
*pp_aout = NULL;
}
return VLC_SUCCESS;
}
case ES_OUT_GET_BUFFERING:
pb = (bool *)va_arg( args, bool* );
*pb = p_sys->b_buffering;
......
......@@ -55,6 +55,7 @@ enum es_out_query_private_e
ES_OUT_SET_ES_BY_ID,
ES_OUT_RESTART_ES_BY_ID,
ES_OUT_SET_ES_DEFAULT_BY_ID,
ES_OUT_GET_ES_OBJECTS_BY_ID, /* arg1=int id, vlc_object_t **dec, vout_thread_t **, aout_instance_t ** res=can fail*/
/* Get buffering state */
ES_OUT_GET_BUFFERING, /* arg1=bool* res=cannot fail */
......@@ -142,6 +143,11 @@ static inline void es_out_SetJitter( es_out_t *p_out, mtime_t i_pts_delay, int i
int i_ret = es_out_Control( p_out, ES_OUT_SET_JITTER, i_pts_delay, i_cr_average );
assert( !i_ret );
}
static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id,
vlc_object_t **pp_decoder, vout_thread_t **pp_vout, aout_instance_t **pp_aout )
{
return es_out_Control( p_out, ES_OUT_GET_ES_OBJECTS_BY_ID, i_id, pp_decoder, pp_vout, pp_aout );
}
es_out_t *input_EsOutNew( input_thread_t *, int i_rate );
......
......@@ -581,6 +581,7 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
case ES_OUT_SET_ES_BY_ID:
case ES_OUT_RESTART_ES_BY_ID:
case ES_OUT_SET_ES_DEFAULT_BY_ID:
case ES_OUT_GET_ES_OBJECTS_BY_ID:
case ES_OUT_SET_DELAY:
case ES_OUT_SET_RECORD_STATE:
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