Commit 719d408b authored by Laurent Aimar's avatar Laurent Aimar

Removed the need of input_EsOutGetFromID.

parent a03e58ee
...@@ -310,23 +310,6 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate ) ...@@ -310,23 +310,6 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
return out; 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 ) void input_EsOutChangeRate( es_out_t *out, int i_rate )
{ {
es_out_sys_t *p_sys = out->p_sys; es_out_sys_t *p_sys = out->p_sys;
...@@ -670,6 +653,22 @@ static mtime_t EsOutGetWakeup( es_out_t *out ) ...@@ -670,6 +653,22 @@ static mtime_t EsOutGetWakeup( es_out_t *out )
return input_clock_GetWakeup( p_sys->p_pgrm->p_clock ); 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 ) static void EsOutDecodersStopBuffering( es_out_t *out, bool b_forced )
{ {
...@@ -2290,6 +2289,26 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args ) ...@@ -2290,6 +2289,26 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return VLC_SUCCESS; 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: default:
msg_Err( p_sys->p_input, "unknown query in es_out_Control" ); msg_Err( p_sys->p_input, "unknown query in es_out_Control" );
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -36,6 +36,10 @@ enum es_out_query_private_e ...@@ -36,6 +36,10 @@ enum es_out_query_private_e
/* Get date to wait before demuxing more data */ /* Get date to wait before demuxing more data */
ES_OUT_GET_WAKE_UP = ES_OUT_PRIVATE_START, /* arg1=mtime_t* res=cannot fail */ 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 ) static inline mtime_t es_out_GetWakeup( es_out_t *p_out )
...@@ -49,7 +53,6 @@ static inline mtime_t es_out_GetWakeup( es_out_t *p_out ) ...@@ -49,7 +53,6 @@ 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_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 ); void input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
int input_EsOutSetRecord( es_out_t *, bool b_record ); int input_EsOutSetRecord( es_out_t *, bool b_record );
void input_EsOutChangeRate( es_out_t *, int ); void input_EsOutChangeRate( es_out_t *, int );
......
...@@ -1811,13 +1811,11 @@ static bool Control( input_thread_t *p_input, int i_type, ...@@ -1811,13 +1811,11 @@ static bool Control( input_thread_t *p_input, int i_type,
case INPUT_CONTROL_SET_ES: case INPUT_CONTROL_SET_ES:
/* No need to force update, es_out does it if needed */ /* No need to force update, es_out does it if needed */
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES, es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ES_BY_ID, val.i_int );
input_EsOutGetFromID( p_input->p->p_es_out, val.i_int ) );
break; break;
case INPUT_CONTROL_RESTART_ES: case INPUT_CONTROL_RESTART_ES:
es_out_Control( p_input->p->p_es_out, ES_OUT_RESTART_ES, es_out_Control( p_input->p->p_es_out, ES_OUT_RESTART_ES_BY_ID, val.i_int );
input_EsOutGetFromID( p_input->p->p_es_out, val.i_int ) );
break; break;
case INPUT_CONTROL_SET_AUDIO_DELAY: case INPUT_CONTROL_SET_AUDIO_DELAY:
...@@ -3107,14 +3105,10 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for ...@@ -3107,14 +3105,10 @@ static void SubtitleAdd( input_thread_t *p_input, char *psz_subtitle, bool b_for
if( count.i_int < list.p_list->i_count ) 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_Control( p_input->p->p_es_out, ES_OUT_SET_ES_DEFAULT_BY_ID, i_id );
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_BY_ID, 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 );
} }
var_Change( p_input, "spu-es", VLC_VAR_FREELIST, &list, NULL ); var_Change( p_input, "spu-es", VLC_VAR_FREELIST, &list, NULL );
} }
......
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