Commit 92410cb5 authored by Laurent Aimar's avatar Laurent Aimar

Merged ES_OUT_SET_ACTIVE/_MODE.

parent 484ac6f6
...@@ -2111,10 +2111,13 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args ) ...@@ -2111,10 +2111,13 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
*pb = EsIsSelected( es ); *pb = EsIsSelected( es );
return VLC_SUCCESS; return VLC_SUCCESS;
case ES_OUT_SET_ACTIVE: case ES_OUT_SET_MODE:
{ {
b = (bool) va_arg( args, int ); const int i_mode = va_arg( args, int );
if( b && !p_sys->b_active && p_sys->i_es > 0 ) assert( i_mode == ES_OUT_MODE_NONE || i_mode == ES_OUT_MODE_ALL ||
i_mode == ES_OUT_MODE_AUTO || i_mode == ES_OUT_MODE_PARTIAL );
if( i_mode != ES_OUT_MODE_NONE && !p_sys->b_active && p_sys->i_es > 0 )
{ {
/* XXX Terminate vout if there are tracks but no video one. /* XXX Terminate vout if there are tracks but no video one.
* This one is not mandatory but is he earliest place where it * This one is not mandatory but is he earliest place where it
...@@ -2128,33 +2131,20 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args ) ...@@ -2128,33 +2131,20 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
if( i >= p_sys->i_es ) if( i >= p_sys->i_es )
input_resource_TerminateVout( p_sys->p_input->p->p_resource ); input_resource_TerminateVout( p_sys->p_input->p->p_resource );
} }
p_sys->b_active = b; p_sys->b_active = i_mode != ES_OUT_MODE_NONE;
return VLC_SUCCESS; p_sys->i_mode = i_mode;
}
case ES_OUT_SET_MODE: /* Reapply policy mode */
i = (int) va_arg( args, int ); for( i = 0; i < p_sys->i_es; i++ )
if( i == ES_OUT_MODE_NONE || i == ES_OUT_MODE_ALL ||
i == ES_OUT_MODE_AUTO || i == ES_OUT_MODE_PARTIAL )
{ {
p_sys->i_mode = i; if( EsIsSelected( p_sys->es[i] ) )
EsUnselect( out, p_sys->es[i],
/* Reapply policy mode */ p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
for( i = 0; i < p_sys->i_es; i++ )
{
if( EsIsSelected( p_sys->es[i] ) )
{
EsUnselect( out, p_sys->es[i],
p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
}
}
for( i = 0; i < p_sys->i_es; i++ )
{
EsOutSelect( out, p_sys->es[i], false );
}
return VLC_SUCCESS;
} }
return VLC_EGENERIC; for( i = 0; i < p_sys->i_es; i++ )
EsOutSelect( out, p_sys->es[i], false );
return VLC_SUCCESS;
}
case ES_OUT_SET_ES: case ES_OUT_SET_ES:
case ES_OUT_RESTART_ES: case ES_OUT_RESTART_ES:
......
...@@ -41,12 +41,8 @@ enum es_out_mode_e ...@@ -41,12 +41,8 @@ enum es_out_mode_e
enum es_out_query_private_e enum es_out_query_private_e
{ {
/* activate application of mode */
ES_OUT_SET_ACTIVE = ES_OUT_PRIVATE_START, /* arg1= bool */
/* set/get mode */ /* set/get mode */
ES_OUT_SET_MODE, /* arg1= int */ ES_OUT_SET_MODE = ES_OUT_PRIVATE_START, /* arg1= int */
/* Get date to wait before demuxing more data */ /* Get date to wait before demuxing more data */
ES_OUT_GET_WAKE_UP, /* arg1=mtime_t* res=cannot fail */ ES_OUT_GET_WAKE_UP, /* arg1=mtime_t* res=cannot fail */
...@@ -85,6 +81,11 @@ enum es_out_query_private_e ...@@ -85,6 +81,11 @@ enum es_out_query_private_e
ES_OUT_SET_JITTER, /* arg1=mtime_t i_pts_delay arg2=int i_cr_average res=cannot fail */ ES_OUT_SET_JITTER, /* arg1=mtime_t i_pts_delay arg2=int i_cr_average res=cannot fail */
}; };
static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
{
int i_ret = es_out_Control( p_out, ES_OUT_SET_MODE, i_mode );
assert( !i_ret );
}
static inline mtime_t es_out_GetWakeup( es_out_t *p_out ) static inline mtime_t es_out_GetWakeup( es_out_t *p_out )
{ {
mtime_t i_wu; mtime_t i_wu;
......
...@@ -588,7 +588,6 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args ) ...@@ -588,7 +588,6 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
return VLC_EGENERIC; return VLC_EGENERIC;
/* Pass-through control */ /* Pass-through control */
case ES_OUT_SET_ACTIVE:
case ES_OUT_SET_MODE: case ES_OUT_SET_MODE:
case ES_OUT_SET_GROUP: case ES_OUT_SET_GROUP:
case ES_OUT_SET_PCR: case ES_OUT_SET_PCR:
...@@ -1305,10 +1304,6 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co ...@@ -1305,10 +1304,6 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
switch( i_query ) switch( i_query )
{ {
/* Pass-through control */ /* Pass-through control */
case ES_OUT_SET_ACTIVE: /* arg1= bool */
p_cmd->u.control.u.b_bool = (bool)va_arg( args, int );
break;
case ES_OUT_SET_MODE: /* arg1= int */ case ES_OUT_SET_MODE: /* arg1= int */
case ES_OUT_SET_GROUP: /* arg1= int */ case ES_OUT_SET_GROUP: /* arg1= int */
case ES_OUT_DEL_GROUP: /* arg1=int i_group */ case ES_OUT_DEL_GROUP: /* arg1=int i_group */
...@@ -1450,9 +1445,6 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd ) ...@@ -1450,9 +1445,6 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
switch( i_query ) switch( i_query )
{ {
/* Pass-through control */ /* Pass-through control */
case ES_OUT_SET_ACTIVE: /* arg1= bool */
return es_out_Control( p_out, i_query, p_cmd->u.control.u.b_bool );
case ES_OUT_SET_MODE: /* arg1= int */ case ES_OUT_SET_MODE: /* arg1= int */
case ES_OUT_SET_GROUP: /* arg1= int */ case ES_OUT_SET_GROUP: /* arg1= int */
case ES_OUT_DEL_GROUP: /* arg1=int i_group */ case ES_OUT_DEL_GROUP: /* arg1=int i_group */
......
...@@ -1140,7 +1140,6 @@ static void InitPrograms( input_thread_t * p_input ) ...@@ -1140,7 +1140,6 @@ static void InitPrograms( input_thread_t * p_input )
UpdatePtsDelay( p_input ); UpdatePtsDelay( p_input );
/* Set up es_out */ /* Set up es_out */
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ACTIVE, true );
i_es_out_mode = ES_OUT_MODE_AUTO; i_es_out_mode = ES_OUT_MODE_AUTO;
if( p_input->p->p_sout ) if( p_input->p->p_sout )
{ {
...@@ -1162,7 +1161,7 @@ static void InitPrograms( input_thread_t * p_input ) ...@@ -1162,7 +1161,7 @@ static void InitPrograms( input_thread_t * p_input )
} }
} }
} }
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_MODE, i_es_out_mode ); es_out_SetMode( p_input->p->p_es_out, i_es_out_mode );
/* Inform the demuxer about waited group (needed only for DVB) */ /* Inform the demuxer about waited group (needed only for DVB) */
if( i_es_out_mode == ES_OUT_MODE_ALL ) if( i_es_out_mode == ES_OUT_MODE_ALL )
...@@ -1356,8 +1355,7 @@ static void End( input_thread_t * p_input ) ...@@ -1356,8 +1355,7 @@ static void End( input_thread_t * p_input )
input_ControlVarStop( p_input ); input_ControlVarStop( p_input );
/* Stop es out activity */ /* Stop es out activity */
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ACTIVE, false ); es_out_SetMode( p_input->p->p_es_out, ES_OUT_MODE_NONE );
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
/* Clean up master */ /* Clean up master */
InputSourceClean( &p_input->p->input ); InputSourceClean( &p_input->p->input );
......
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