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

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 )
*pb = EsIsSelected( es );
return VLC_SUCCESS;
case ES_OUT_SET_ACTIVE:
case ES_OUT_SET_MODE:
{
b = (bool) va_arg( args, int );
if( b && !p_sys->b_active && p_sys->i_es > 0 )
const int i_mode = va_arg( args, int );
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.
* 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 )
if( i >= p_sys->i_es )
input_resource_TerminateVout( p_sys->p_input->p->p_resource );
}
p_sys->b_active = b;
return VLC_SUCCESS;
}
p_sys->b_active = i_mode != ES_OUT_MODE_NONE;
p_sys->i_mode = i_mode;
case ES_OUT_SET_MODE:
i = (int) va_arg( args, int );
if( i == ES_OUT_MODE_NONE || i == ES_OUT_MODE_ALL ||
i == ES_OUT_MODE_AUTO || i == ES_OUT_MODE_PARTIAL )
/* Reapply policy mode */
for( i = 0; i < p_sys->i_es; i++ )
{
p_sys->i_mode = i;
/* Reapply policy mode */
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;
if( EsIsSelected( p_sys->es[i] ) )
EsUnselect( out, p_sys->es[i],
p_sys->es[i]->p_pgrm == p_sys->p_pgrm );
}
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_RESTART_ES:
......
......@@ -41,12 +41,8 @@ enum es_out_mode_e
enum es_out_query_private_e
{
/* activate application of mode */
ES_OUT_SET_ACTIVE = ES_OUT_PRIVATE_START, /* arg1= bool */
/* 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 */
ES_OUT_GET_WAKE_UP, /* arg1=mtime_t* res=cannot fail */
......@@ -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 */
};
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 )
{
mtime_t i_wu;
......
......@@ -588,7 +588,6 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
return VLC_EGENERIC;
/* Pass-through control */
case ES_OUT_SET_ACTIVE:
case ES_OUT_SET_MODE:
case ES_OUT_SET_GROUP:
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
switch( i_query )
{
/* 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_GROUP: /* arg1= int */
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 )
switch( i_query )
{
/* 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_GROUP: /* arg1= int */
case ES_OUT_DEL_GROUP: /* arg1=int i_group */
......
......@@ -1140,7 +1140,6 @@ static void InitPrograms( input_thread_t * p_input )
UpdatePtsDelay( p_input );
/* 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;
if( p_input->p->p_sout )
{
......@@ -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) */
if( i_es_out_mode == ES_OUT_MODE_ALL )
......@@ -1356,8 +1355,7 @@ static void End( input_thread_t * p_input )
input_ControlVarStop( p_input );
/* Stop es out activity */
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_ACTIVE, false );
es_out_Control( p_input->p->p_es_out, ES_OUT_SET_MODE, ES_OUT_MODE_NONE );
es_out_SetMode( p_input->p->p_es_out, ES_OUT_MODE_NONE );
/* Clean up master */
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