Commit 172c2460 authored by Laurent Aimar's avatar Laurent Aimar

Fixed --program behavior.

parent 3c1e28fa
...@@ -130,7 +130,8 @@ struct es_out_sys_t ...@@ -130,7 +130,8 @@ struct es_out_sys_t
int i_video; int i_video;
int i_sub; int i_sub;
/* es to select */ /* es/group to select */
int i_group_id;
int i_audio_last, i_audio_id; int i_audio_last, i_audio_id;
int i_sub_last, i_sub_id; int i_sub_last, i_sub_id;
int i_default_sub_id; /* As specified in container; if applicable */ int i_default_sub_id; /* As specified in container; if applicable */
...@@ -259,6 +260,8 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate ) ...@@ -259,6 +260,8 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, int i_rate )
p_sys->i_sub = 0; p_sys->i_sub = 0;
/* */ /* */
p_sys->i_group_id = var_GetInteger( p_input, "program" );
p_sys->i_audio_last = var_GetInteger( p_input, "audio-track" ); p_sys->i_audio_last = var_GetInteger( p_input, "audio-track" );
p_sys->i_sub_last = var_GetInteger( p_input, "sub-track" ); p_sys->i_sub_last = var_GetInteger( p_input, "sub-track" );
...@@ -978,6 +981,11 @@ static void EsOutESVarUpdate( es_out_t *out, es_out_id_t *es, ...@@ -978,6 +981,11 @@ static void EsOutESVarUpdate( es_out_t *out, es_out_id_t *es,
EsOutESVarUpdateGeneric( out, es->i_id, &es->fmt, es->psz_language, b_delete ); EsOutESVarUpdateGeneric( out, es->i_id, &es->fmt, es->psz_language, b_delete );
} }
static bool EsOutIsProgramVisible( es_out_t *out, int i_group )
{
return out->p_sys->i_group_id == 0 || out->p_sys->i_group_id == i_group;
}
/* EsOutProgramSelect: /* EsOutProgramSelect:
* Select a program and update the object variable * Select a program and update the object variable
*/ */
...@@ -1076,9 +1084,10 @@ static es_out_pgrm_t *EsOutProgramAdd( es_out_t *out, int i_group ) ...@@ -1076,9 +1084,10 @@ static es_out_pgrm_t *EsOutProgramAdd( es_out_t *out, int i_group )
TAB_APPEND( p_sys->i_pgrm, p_sys->pgrm, p_pgrm ); TAB_APPEND( p_sys->i_pgrm, p_sys->pgrm, p_pgrm );
/* Update "program" variable */ /* Update "program" variable */
input_SendEventProgramAdd( p_input, i_group, NULL ); if( EsOutIsProgramVisible( out, i_group ) )
input_SendEventProgramAdd( p_input, i_group, NULL );
if( i_group == var_GetInteger( p_input, "program" ) ) if( i_group == p_sys->i_group_id || ( !p_sys->p_pgrm && p_sys->i_group_id == 0 ) )
EsOutProgramSelect( out, p_pgrm ); EsOutProgramSelect( out, p_pgrm );
return p_pgrm; return p_pgrm;
...@@ -1184,6 +1193,8 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, const vlc_meta_t *p_me ...@@ -1184,6 +1193,8 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, const vlc_meta_t *p_me
return; return;
} }
/* Find program */ /* Find program */
if( !EsOutIsProgramVisible( out, i_group ) )
return;
p_pgrm = EsOutProgramFind( out, i_group ); p_pgrm = EsOutProgramFind( out, i_group );
if( !p_pgrm ) if( !p_pgrm )
return; return;
...@@ -1275,6 +1286,8 @@ static void EsOutProgramEpg( es_out_t *out, int i_group, const vlc_epg_t *p_epg ...@@ -1275,6 +1286,8 @@ static void EsOutProgramEpg( es_out_t *out, int i_group, const vlc_epg_t *p_epg
char *psz_cat; char *psz_cat;
/* Find program */ /* Find program */
if( !EsOutIsProgramVisible( out, i_group ) )
return;
p_pgrm = EsOutProgramFind( out, i_group ); p_pgrm = EsOutProgramFind( out, i_group );
if( !p_pgrm ) if( !p_pgrm )
return; return;
...@@ -2144,6 +2157,13 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args ) ...@@ -2144,6 +2157,13 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
return VLC_SUCCESS; return VLC_SUCCESS;
} }
case ES_OUT_GET_GROUP_FORCED:
{
int *pi_group = va_arg( args, int * );
*pi_group = p_sys->i_group_id;
return VLC_SUCCESS;
}
case ES_OUT_SET_MODE: case ES_OUT_SET_MODE:
{ {
const int i_mode = va_arg( args, int ); const int i_mode = va_arg( args, int );
......
...@@ -80,6 +80,9 @@ enum es_out_query_private_e ...@@ -80,6 +80,9 @@ enum es_out_query_private_e
/* Set jitter */ /* Set jitter */
ES_OUT_SET_JITTER, /* arg1=mtime_t i_pts_delay arg2= mtime_t i_pts_jitter, arg2=int i_cr_average res=cannot fail */ ES_OUT_SET_JITTER, /* arg1=mtime_t i_pts_delay arg2= mtime_t i_pts_jitter, arg2=int i_cr_average res=cannot fail */
/* Get forced group */
ES_OUT_GET_GROUP_FORCED, /* arg1=int * res=cannot fail */
}; };
static inline void es_out_SetMode( es_out_t *p_out, int i_mode ) static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
...@@ -153,6 +156,13 @@ static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id, ...@@ -153,6 +156,13 @@ static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id,
{ {
return es_out_Control( p_out, ES_OUT_GET_ES_OBJECTS_BY_ID, i_id, pp_decoder, pp_vout, pp_aout ); return es_out_Control( p_out, ES_OUT_GET_ES_OBJECTS_BY_ID, i_id, pp_decoder, pp_vout, pp_aout );
} }
static inline int es_out_GetGroupForced( es_out_t *p_out )
{
int i_group;
int i_ret = es_out_Control( p_out, ES_OUT_GET_GROUP_FORCED, &i_group );
assert( !i_ret );
return i_group;
}
es_out_t *input_EsOutNew( input_thread_t *, int i_rate ); es_out_t *input_EsOutNew( input_thread_t *, int i_rate );
......
...@@ -633,7 +633,6 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args ) ...@@ -633,7 +633,6 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
} }
return es_out_Control( p_sys->p_out, ES_OUT_GET_ES_STATE, p_es->p_es, pb_enabled ); return es_out_Control( p_sys->p_out, ES_OUT_GET_ES_STATE, p_es->p_es, pb_enabled );
} }
/* Special internal input control */ /* Special internal input control */
case ES_OUT_GET_EMPTY: case ES_OUT_GET_EMPTY:
{ {
...@@ -694,6 +693,13 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args ) ...@@ -694,6 +693,13 @@ static int ControlLocked( es_out_t *p_out, int i_query, va_list args )
return es_out_ControlModifyPcrSystem( p_sys->p_out, b_absolute, i_system ); return es_out_ControlModifyPcrSystem( p_sys->p_out, b_absolute, i_system );
} }
case ES_OUT_GET_GROUP_FORCED:
{
int *pi_group = va_arg( args, int * );
return es_out_Control( p_sys->p_out, ES_OUT_GET_GROUP_FORCED, pi_group );
}
default: default:
msg_Err( p_sys->p_input, "Unknown es_out_Control query !" ); msg_Err( p_sys->p_input, "Unknown es_out_Control query !" );
assert(0); assert(0);
......
...@@ -1193,7 +1193,7 @@ static void InitPrograms( input_thread_t * p_input ) ...@@ -1193,7 +1193,7 @@ static void InitPrograms( input_thread_t * p_input )
else else
{ {
demux_Control( p_input->p->input.p_demux, DEMUX_SET_GROUP, demux_Control( p_input->p->input.p_demux, DEMUX_SET_GROUP,
(int) var_GetInteger( p_input, "program" ), NULL ); es_out_GetGroupForced( p_input->p->p_es_out ), 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