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 */
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" );
if( i_stream_duration <= i_buffering_duration && !b_forced )
{
- const double f_level = (double)i_stream_duration / i_buffering_duration;
+ const double f_level = __MAX( (double)i_stream_duration / i_buffering_duration, 0 );
input_SendEventCache( p_sys->p_input, f_level );
msg_Dbg( p_sys->p_input, "Buffering %d%%", (int)(100 * f_level) );
{
if( psz_language && *psz_language )
{
- if( asprintf( &text.psz_string, "%s %i - [%s]", _( "Track" ), val.i_int, psz_language ) == -1 )
+ if( asprintf( &text.psz_string, "%s %"PRId64" - [%s]", _( "Track" ), val.i_int, psz_language ) == -1 )
text.psz_string = NULL;
}
else
{
- if( asprintf( &text.psz_string, "%s %i", _( "Track" ), val.i_int ) == -1 )
+ if( asprintf( &text.psz_string, "%s %"PRId64, _( "Track" ), val.i_int ) == -1 )
text.psz_string = NULL;
}
}
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
*/
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;
return;
}
/* Find program */
+ if( !EsOutIsProgramVisible( out, i_group ) )
+ return;
p_pgrm = EsOutProgramFind( out, i_group );
if( !p_pgrm )
return;
char **ppsz_all_keys = vlc_meta_CopyExtraNames(p_meta );
info_category_t *p_cat = NULL;
- if( psz_provider || *ppsz_all_keys[0] )
+ if( psz_provider || ( ppsz_all_keys[0] && *ppsz_all_keys[0] ) )
{
char *psz_cat = EsOutProgramGetMetaName( p_pgrm );
if( psz_cat )
char *psz_cat;
/* Find program */
+ if( !EsOutIsProgramVisible( out, i_group ) )
+ return;
p_pgrm = EsOutProgramFind( out, i_group );
if( !p_pgrm )
return;
es->fmt.i_id = out->p_sys->i_id;
if( !es->fmt.i_original_fourcc )
es->fmt.i_original_fourcc = es->fmt.i_codec;
- es->fmt.i_codec = vlc_fourcc_GetCodec( es->fmt.i_cat, es->fmt.i_codec );
+ if( es->fmt.i_cat == AUDIO_ES )
+ es->fmt.i_codec = vlc_fourcc_GetCodecAudio( es->fmt.i_codec,
+ es->fmt.audio.i_bitspersample );
+ else
+ es->fmt.i_codec = vlc_fourcc_GetCodec( es->fmt.i_cat,
+ es->fmt.i_codec );
es->i_id = es->fmt.i_id;
es->i_meta_id = out->p_sys->i_id;
}
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++ )
+ char *prgms = var_GetNonEmptyString( p_sys->p_input, "programs" );
+ if( prgms != NULL )
{
- if ( val.p_list->p_values[i].i_int == es->p_pgrm->i_id || b_force )
+ char *buf;
+
+ for ( const char *prgm = strtok_r( prgms, ",", &buf );
+ prgm != NULL;
+ prgm = strtok_r( NULL, ",", &buf ) )
{
- if( !EsIsSelected( es ) )
- EsSelect( out, es );
- break;
+ if( atoi( prgm ) == es->p_pgrm->i_id || b_force )
+ {
+ if( !EsIsSelected( es ) )
+ EsSelect( out, es );
+ break;
+ }
}
+ free( prgms );
}
- var_FreeList( &val, NULL );
}
else if( p_sys->i_mode == ES_OUT_MODE_AUTO )
{
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 );
{
const iso639_lang_t *pl;
- if( psz_code == NULL )
+ if( psz_code == NULL || !strcmp( psz_code, "und" ) )
{
return strdup( "" );
}
if( !p_cat )
return;
- /* Add informations */
+ /* Add information */
const char *psz_type;
switch( fmt->i_cat )
{
const char *psz_codec_description =
vlc_fourcc_GetDescription( p_fmt_es->i_cat, p_fmt_es->i_codec );
- const vlc_fourcc_t i_codec_fourcc = p_fmt_es->i_original_fourcc ?: p_fmt_es->i_codec;
+ const vlc_fourcc_t i_codec_fourcc = ( p_fmt_es->i_original_fourcc )?
+ p_fmt_es->i_original_fourcc : p_fmt_es->i_codec;
if( psz_codec_description )
info_category_AddInfo( p_cat, _("Codec"), "%s (%.4s)",
psz_codec_description, (char*)&i_codec_fourcc );