return out;
}
-es_out_id_t *input_EsOutGetFromID( es_out_t *out, int i_id )
-{
- int i;
- if( i_id < 0 )
- {
- /* Special HACK, -i_id is the cat of the stream */
- return (es_out_id_t*)((uint8_t*)NULL-i_id);
- }
-
- for( i = 0; i < out->p_sys->i_es; i++ )
- {
- if( out->p_sys->es[i]->i_id == i_id )
- return out->p_sys->es[i];
- }
- return NULL;
-}
-
void input_EsOutChangeRate( es_out_t *out, int i_rate )
{
es_out_sys_t *p_sys = out->p_sys;
return input_clock_GetWakeup( p_sys->p_pgrm->p_clock );
}
+static es_out_id_t *EsOutGetFromID( es_out_t *out, int i_id )
+{
+ int i;
+ if( i_id < 0 )
+ {
+ /* Special HACK, -i_id is the cat of the stream */
+ return (es_out_id_t*)((uint8_t*)NULL-i_id);
+ }
+
+ for( i = 0; i < out->p_sys->i_es; i++ )
+ {
+ if( out->p_sys->es[i]->i_id == i_id )
+ return out->p_sys->es[i];
+ }
+ return NULL;
+}
static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
{
return VLC_SUCCESS;
}
+ case ES_OUT_SET_ES_BY_ID:
+ case ES_OUT_RESTART_ES_BY_ID:
+ case ES_OUT_SET_ES_DEFAULT_BY_ID:
+ {
+ const int i_id = (int)va_arg( args, int );
+ es_out_id_t *p_es = EsOutGetFromID( out, i_id );
+ int i_new_query;
+
+ switch( i_query )
+ {
+ case ES_OUT_SET_ES_BY_ID: i_new_query = ES_OUT_SET_ES; break;
+ case ES_OUT_RESTART_ES_BY_ID: i_new_query = ES_OUT_RESTART_ES; break;
+ case ES_OUT_SET_ES_DEFAULT_BY_ID: i_new_query = ES_OUT_SET_ES_DEFAULT; break;
+ default:
+ assert(0);
+ }
+ /* TODO if the lock is made non recursive it should be changed */
+ return es_out_Control( out, i_new_query, p_es );
+ }
+
default:
msg_Err( p_sys->p_input, "unknown query in es_out_Control" );
return VLC_EGENERIC;
/* Get date to wait before demuxing more data */
ES_OUT_GET_WAKE_UP = ES_OUT_PRIVATE_START, /* arg1=mtime_t* res=cannot fail */
+ /* Wrapper for some ES command to work with id */
+ ES_OUT_SET_ES_BY_ID,
+ ES_OUT_RESTART_ES_BY_ID,
+ ES_OUT_SET_ES_DEFAULT_BY_ID,
};
static inline mtime_t es_out_GetWakeup( es_out_t *p_out )
es_out_t *input_EsOutNew( input_thread_t *, int i_rate );
-es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id );
void input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
int input_EsOutSetRecord( es_out_t *, bool b_record );
void input_EsOutChangeRate( es_out_t *, int );
case INPUT_CONTROL_SET_ES:
/* No need to force update, es_out does it if needed */
- es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES,
- input_EsOutGetFromID( p_input->p->p_es_out, val.i_int ) );
+ es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES_BY_ID, val.i_int );
break;
case INPUT_CONTROL_RESTART_ES:
- es_out_Control( p_input->p->p_es_out, ES_OUT_RESTART_ES,
- input_EsOutGetFromID( p_input->p->p_es_out, val.i_int ) );
+ es_out_Control( p_input->p->p_es_out, ES_OUT_RESTART_ES_BY_ID, val.i_int );
break;
case INPUT_CONTROL_SET_AUDIO_DELAY:
if( count.i_int < list.p_list->i_count )
{
- int i_id = list.p_list->p_values[count.i_int].i_int;
+ const int i_id = list.p_list->p_values[count.i_int].i_int;
- input_EsOutLock( p_input->p->p_es_out );
- es_out_id_t *p_es = input_EsOutGetFromID( p_input->p->p_es_out, i_id );
-
- es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES_DEFAULT, p_es );
- es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES, p_es );
- input_EsOutUnlock( p_input->p->p_es_out );
+ es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES_DEFAULT_BY_ID, i_id );
+ es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES_BY_ID, i_id );
}
var_Change( p_input, "spu-es", VLC_VAR_FREELIST, &list, NULL );
}