Commit b2147ab9 authored by Christophe Massiot's avatar Christophe Massiot

* src/input: Added a --programs configuration option, allowing to select

   several coma-separated programs.
parent 289b82b0
...@@ -33,7 +33,8 @@ enum es_out_mode_e ...@@ -33,7 +33,8 @@ enum es_out_mode_e
{ {
ES_OUT_MODE_NONE, /* don't select anything */ ES_OUT_MODE_NONE, /* don't select anything */
ES_OUT_MODE_ALL, /* eg for stream output */ ES_OUT_MODE_ALL, /* eg for stream output */
ES_OUT_MODE_AUTO /* best audio/video or for input follow audio-channel, spu-channel */ ES_OUT_MODE_AUTO, /* best audio/video or for input follow audio-channel, spu-channel */
ES_OUT_MODE_PARTIAL /* select programs given after --programs */
}; };
enum es_out_query_e enum es_out_query_e
......
...@@ -73,6 +73,7 @@ struct es_out_sys_t ...@@ -73,6 +73,7 @@ struct es_out_sys_t
/* all programs */ /* all programs */
int i_pgrm; int i_pgrm;
es_out_pgrm_t **pgrm; es_out_pgrm_t **pgrm;
es_out_pgrm_t **pp_selected_pgrm; /* --programs */
es_out_pgrm_t *p_pgrm; /* Master program */ es_out_pgrm_t *p_pgrm; /* Master program */
/* all es */ /* all es */
...@@ -423,7 +424,7 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt ) ...@@ -423,7 +424,7 @@ static es_out_id_t *EsOutAdd( es_out_t *out, es_format_t *fmt )
if( fmt->i_group < 0 ) if( fmt->i_group < 0 )
{ {
msg_Err( p_input, "invakud group number" ); msg_Err( p_input, "invalid group number" );
return NULL; return NULL;
} }
...@@ -619,6 +620,22 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_force ) ...@@ -619,6 +620,22 @@ static void EsOutSelect( es_out_t *out, es_out_id_t *es, vlc_bool_t b_force )
if( !es->p_dec ) if( !es->p_dec )
EsSelect( out, es ); EsSelect( out, es );
} }
else if( p_sys->i_mode == ES_OUT_MODE_PARTIAL )
{
vlc_value_t val;
int i;
var_Get( p_sys->p_input, "programs", &val );
for ( i = 0; i < val.p_list->i_count; i++ )
{
if ( val.p_list->p_values[i].i_int == es->p_pgrm->i_id || b_force )
{
if( !es->p_dec )
EsSelect( out, es );
break;
}
}
var_Change( p_sys->p_input, "programs", VLC_VAR_FREELIST, &val, NULL );
}
else if( p_sys->i_mode == ES_OUT_MODE_AUTO ) else if( p_sys->i_mode == ES_OUT_MODE_AUTO )
{ {
int i_wanted = -1; int i_wanted = -1;
...@@ -843,7 +860,7 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args ) ...@@ -843,7 +860,7 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
case ES_OUT_SET_MODE: case ES_OUT_SET_MODE:
i = (int) va_arg( args, int ); i = (int) va_arg( args, int );
if( i == ES_OUT_MODE_NONE || i == ES_OUT_MODE_ALL || if( i == ES_OUT_MODE_NONE || i == ES_OUT_MODE_ALL ||
i == ES_OUT_MODE_AUTO ) i == ES_OUT_MODE_AUTO || i == ES_OUT_MODE_PARTIAL )
{ {
p_sys->i_mode = i; p_sys->i_mode = i;
......
...@@ -514,6 +514,7 @@ static int Init( input_thread_t * p_input ) ...@@ -514,6 +514,7 @@ static int Init( input_thread_t * p_input )
vlc_value_t val; vlc_value_t val;
double f_fps; double f_fps;
vlc_meta_t *p_meta, *p_meta_user; vlc_meta_t *p_meta, *p_meta_user;
int i_es_out_mode;
int i, i_delay; int i, i_delay;
/* Initialize optional stream output. (before access/demuxer) */ /* Initialize optional stream output. (before access/demuxer) */
...@@ -745,20 +746,45 @@ static int Init( input_thread_t * p_input ) ...@@ -745,20 +746,45 @@ static int Init( input_thread_t * p_input )
/* Set up es_out */ /* Set up es_out */
es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_TRUE ); es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_TRUE );
val.b_bool = VLC_FALSE; i_es_out_mode = ES_OUT_MODE_AUTO;
val.p_list = NULL;
if( p_input->p_sout ) if( p_input->p_sout )
{ {
var_Get( p_input, "sout-all", &val ); var_Get( p_input, "sout-all", &val );
if ( val.b_bool )
{
i_es_out_mode = ES_OUT_MODE_ALL;
val.p_list = NULL;
}
else
{
var_Get( p_input, "programs", &val );
if ( val.p_list && val.p_list->i_count )
{
i_es_out_mode = ES_OUT_MODE_PARTIAL;
/* Note : we should remove the "program" callback. */
}
else
var_Change( p_input, "programs", VLC_VAR_FREELIST, &val, NULL );
}
} }
es_out_Control( p_input->p_es_out, ES_OUT_SET_MODE, es_out_Control( p_input->p_es_out, ES_OUT_SET_MODE, i_es_out_mode );
val.b_bool ? ES_OUT_MODE_ALL : ES_OUT_MODE_AUTO );
/* Inform the demuxer about waited group (needed only for DVB) */ /* Inform the demuxer about waited group (needed only for DVB) */
if( val.b_bool ) if( i_es_out_mode == ES_OUT_MODE_ALL )
demux2_Control( p_input->input.p_demux, DEMUX_SET_GROUP, -1 ); {
demux2_Control( p_input->input.p_demux, DEMUX_SET_GROUP, -1, NULL );
}
else if( i_es_out_mode == ES_OUT_MODE_PARTIAL )
{
demux2_Control( p_input->input.p_demux, DEMUX_SET_GROUP, -1,
val.p_list );
}
else else
{
demux2_Control( p_input->input.p_demux, DEMUX_SET_GROUP, demux2_Control( p_input->input.p_demux, DEMUX_SET_GROUP,
(int) var_GetInteger( p_input, "program" ) ); (int) var_GetInteger( p_input, "program" ), NULL );
}
if( p_input->p_sout ) if( p_input->p_sout )
{ {
...@@ -1265,7 +1291,8 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type, ...@@ -1265,7 +1291,8 @@ static vlc_bool_t Control( input_thread_t *p_input, int i_type,
es_out_Control( p_input->p_es_out, es_out_Control( p_input->p_es_out,
ES_OUT_SET_GROUP, val.i_int ); ES_OUT_SET_GROUP, val.i_int );
demux2_Control( p_input->input.p_demux, DEMUX_SET_GROUP, val.i_int ); demux2_Control( p_input->input.p_demux, DEMUX_SET_GROUP, val.i_int,
NULL );
break; break;
case INPUT_CONTROL_SET_ES: case INPUT_CONTROL_SET_ES:
......
...@@ -130,6 +130,11 @@ void input_ControlVarInit ( input_thread_t *p_input ) ...@@ -130,6 +130,11 @@ void input_ControlVarInit ( input_thread_t *p_input )
var_Change( p_input, "program", VLC_VAR_SETTEXT, &text, NULL ); var_Change( p_input, "program", VLC_VAR_SETTEXT, &text, NULL );
var_AddCallback( p_input, "program", ProgramCallback, NULL ); var_AddCallback( p_input, "program", ProgramCallback, NULL );
/* Programs */
var_Create( p_input, "programs", VLC_VAR_LIST | VLC_VAR_DOINHERIT );
text.psz_string = _("Programs");
var_Change( p_input, "programs", VLC_VAR_SETTEXT, &text, NULL );
/* Title */ /* Title */
var_Create( p_input, "title", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE ); var_Create( p_input, "title", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
text.psz_string = _("Title"); text.psz_string = _("Title");
......
...@@ -281,6 +281,11 @@ static char *ppsz_align_descriptions[] = ...@@ -281,6 +281,11 @@ static char *ppsz_align_descriptions[] =
#define INPUT_PROGRAM_LONGTEXT N_( \ #define INPUT_PROGRAM_LONGTEXT N_( \
"Choose the program to select by giving its Service ID.") "Choose the program to select by giving its Service ID.")
#define INPUT_PROGRAMS_TEXT N_("Choose programs")
#define INPUT_PROGRAMS_LONGTEXT N_( \
"Choose the programs to select by giving a comma-separated list of" \
"SIDs.")
#define INPUT_AUDIO_TEXT N_("Choose audio") #define INPUT_AUDIO_TEXT N_("Choose audio")
#define INPUT_AUDIO_LONGTEXT N_( \ #define INPUT_AUDIO_LONGTEXT N_( \
"Give the default type of audio you want to use in a DVD. " \ "Give the default type of audio you want to use in a DVD. " \
...@@ -890,6 +895,8 @@ vlc_module_begin(); ...@@ -890,6 +895,8 @@ vlc_module_begin();
add_integer( "program", 0, NULL, add_integer( "program", 0, NULL,
INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT, VLC_TRUE ); INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT, VLC_TRUE );
add_string( "programs", "", NULL,
INPUT_PROGRAMS_TEXT, INPUT_PROGRAMS_LONGTEXT, VLC_FALSE );
add_integer( "audio-type", -1, NULL, add_integer( "audio-type", -1, NULL,
INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT, VLC_TRUE ); INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT, VLC_TRUE );
add_integer( "audio-channel", -1, NULL, add_integer( "audio-channel", -1, 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