[vlc-commits] commit: Fixed --program behavior. (Laurent Aimar )
git at videolan.org
git at videolan.org
Tue Jul 6 13:13:50 CEST 2010
vlc/vlc-1.1 | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Jun 28 02:49:41 2010 +0200| [2941c7aae6cc245c8ca55cb8c1b305d582c56bcb] | committer: Jean-Baptiste Kempf
Fixed --program behavior.
(cherry picked from commit 172c2460bc35a33a22b3bf257650482711275573)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=2941c7aae6cc245c8ca55cb8c1b305d582c56bcb
---
src/input/es_out.c | 26 +++++++++++++++++++++++---
src/input/es_out.h | 10 ++++++++++
src/input/es_out_timeshift.c | 8 +++++++-
src/input/input.c | 2 +-
4 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index afc8c47..37c6304 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -130,7 +130,8 @@ struct es_out_sys_t
int i_video;
int i_sub;
- /* es to select */
+ /* es/group to select */
+ int i_group_id;
int i_audio_last, i_audio_id;
int i_sub_last, i_sub_id;
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 )
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_sub_last = var_GetInteger( p_input, "sub-track" );
@@ -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 );
}
+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:
* 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 )
TAB_APPEND( p_sys->i_pgrm, p_sys->pgrm, p_pgrm );
/* 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 );
return p_pgrm;
@@ -1184,6 +1193,8 @@ static void EsOutProgramMeta( es_out_t *out, int i_group, const vlc_meta_t *p_me
return;
}
/* Find program */
+ if( !EsOutIsProgramVisible( out, i_group ) )
+ return;
p_pgrm = EsOutProgramFind( out, i_group );
if( !p_pgrm )
return;
@@ -1275,6 +1286,8 @@ static void EsOutProgramEpg( es_out_t *out, int i_group, const vlc_epg_t *p_epg
char *psz_cat;
/* Find program */
+ if( !EsOutIsProgramVisible( out, i_group ) )
+ return;
p_pgrm = EsOutProgramFind( out, i_group );
if( !p_pgrm )
return;
@@ -2144,6 +2157,13 @@ static int EsOutControlLocked( es_out_t *out, int i_query, va_list args )
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:
{
const int i_mode = va_arg( args, int );
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 89ece06..d0b8111 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -80,6 +80,9 @@ enum es_out_query_private_e
/* 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 */
+
+ /* 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 )
@@ -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 );
}
+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 );
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 4aa997f..3ac19d5 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -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 );
}
-
/* Special internal input control */
case ES_OUT_GET_EMPTY:
{
@@ -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 );
}
+ 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:
msg_Err( p_sys->p_input, "Unknown es_out_Control query !" );
assert(0);
diff --git a/src/input/input.c b/src/input/input.c
index 085bd25..11c137d 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -1197,7 +1197,7 @@ static void InitPrograms( input_thread_t * p_input )
else
{
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 );
}
}
More information about the vlc-commits
mailing list