Commit 55365965 authored by Gildas Bazin's avatar Gildas Bazin

* src/input/input_programs.c: misc fixes/improvements to the video-es/audio-es/spu-es object variables.
parent 50cabe81
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2002 VideoLAN * Copyright (C) 1999-2002 VideoLAN
* $Id: input_programs.c,v 1.107 2003/05/05 22:48:23 gbazin Exp $ * $Id: input_programs.c,v 1.108 2003/05/10 11:08:07 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -56,7 +56,7 @@ static int ESCallback( vlc_object_t *, char const *, ...@@ -56,7 +56,7 @@ static int ESCallback( vlc_object_t *, char const *,
*****************************************************************************/ *****************************************************************************/
int input_InitStream( input_thread_t * p_input, size_t i_data_len ) int input_InitStream( input_thread_t * p_input, size_t i_data_len )
{ {
vlc_value_t val, text; vlc_value_t text;
p_input->stream.i_stream_id = 0; p_input->stream.i_stream_id = 0;
...@@ -108,11 +108,6 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len ) ...@@ -108,11 +108,6 @@ int input_InitStream( input_thread_t * p_input, size_t i_data_len )
text.psz_string = _("Subtitle track"); text.psz_string = _("Subtitle track");
var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL ); var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
val.i_int = -1; text.psz_string = _("Disable");
var_Change( p_input, "video-es", VLC_VAR_ADDCHOICE, &val, &text );
var_Change( p_input, "audio-es", VLC_VAR_ADDCHOICE, &val, &text );
var_Change( p_input, "spu-es", VLC_VAR_ADDCHOICE, &val, &text );
var_AddCallback( p_input, "program", ProgramCallback, NULL ); var_AddCallback( p_input, "program", ProgramCallback, NULL );
var_AddCallback( p_input, "title", TitleCallback, NULL ); var_AddCallback( p_input, "title", TitleCallback, NULL );
var_AddCallback( p_input, "chapter", ChapterCallback, NULL ); var_AddCallback( p_input, "chapter", ChapterCallback, NULL );
...@@ -553,7 +548,6 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, ...@@ -553,7 +548,6 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
/* Init its values */ /* Init its values */
p_es->i_id = i_es_id; p_es->i_id = i_es_id;
p_es->psz_desc = psz_desc ? strdup( psz_desc ) : NULL;
p_es->p_pes = NULL; p_es->p_pes = NULL;
p_es->p_decoder_fifo = NULL; p_es->p_decoder_fifo = NULL;
p_es->i_cat = i_category; p_es->i_cat = i_category;
...@@ -608,8 +602,32 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, ...@@ -608,8 +602,32 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
if( psz_var ) if( psz_var )
{ {
/* Get the number of ES already added */
var_Change( p_input, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 0 )
{
vlc_value_t val2;
/* First one, we need to add the "Disable" choice */
val2.i_int = -1; text.psz_string = _("Disable");
var_Change( p_input, psz_var, VLC_VAR_ADDCHOICE, &val2, &text );
val.i_int++;
}
/* Take care of the ES description */
if( psz_desc )
{
p_es->psz_desc = strdup( psz_desc );
}
else
{
p_es->psz_desc = malloc( strlen( _("Track %i") ) + 20 );
if( p_es->psz_desc )
sprintf( p_es->psz_desc, _("Track %i"), val.i_int );
}
val.i_int = p_es->i_id; val.i_int = p_es->i_id;
text.psz_string = (char *)psz_desc; text.psz_string = p_es->psz_desc;
var_Change( p_input, psz_var, VLC_VAR_ADDCHOICE, &val, &text ); var_Change( p_input, psz_var, VLC_VAR_ADDCHOICE, &val, &text );
} }
...@@ -623,7 +641,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -623,7 +641,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
{ {
unsigned int i_index, i_es_index; unsigned int i_index, i_es_index;
pgrm_descriptor_t * p_pgrm; pgrm_descriptor_t * p_pgrm;
char * psz_var; char * psz_var = NULL;
vlc_value_t val; vlc_value_t val;
/* Find the ES in the ES table */ /* Find the ES in the ES table */
...@@ -651,13 +669,24 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -651,13 +669,24 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
psz_var = "spu-es"; psz_var = "spu-es";
break; break;
case VIDEO_ES: case VIDEO_ES:
default:
psz_var = "video-es"; psz_var = "video-es";
break; break;
} }
if( psz_var )
{
val.i_int = p_es->i_id; val.i_int = p_es->i_id;
var_Change( p_input, psz_var, VLC_VAR_DELCHOICE, &val, NULL ); var_Change( p_input, psz_var, VLC_VAR_DELCHOICE, &val, NULL );
/* Remove the "Disable" entry if needed */
var_Change( p_input, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 1 )
{
val.i_int = -1;
var_Change( p_input, psz_var, VLC_VAR_DELCHOICE, &val, NULL );
}
}
/* Kill associated decoder, if any. */ /* Kill associated decoder, if any. */
if( p_es->p_decoder_fifo != NULL ) if( p_es->p_decoder_fifo != NULL )
{ {
...@@ -727,6 +756,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -727,6 +756,7 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
{ {
vlc_value_t val; vlc_value_t val;
char *psz_var = NULL;
if( p_es == NULL ) if( p_es == NULL )
{ {
...@@ -769,8 +799,24 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -769,8 +799,24 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
} }
/* Update the es variable without triggering a callback */ /* Update the es variable without triggering a callback */
switch( p_es->i_cat )
{
case AUDIO_ES:
psz_var = "audio-es";
break;
case SPU_ES:
psz_var = "spu-es";
break;
case VIDEO_ES:
psz_var = "video-es";
break;
}
if( psz_var )
{
val.i_int = p_es->i_id; val.i_int = p_es->i_id;
var_Change( p_input, "audio-es", VLC_VAR_SETVALUE, &val, NULL ); var_Change( p_input, psz_var, VLC_VAR_SETVALUE, &val, NULL );
}
return 0; return 0;
} }
...@@ -780,8 +826,9 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -780,8 +826,9 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es )
*****************************************************************************/ *****************************************************************************/
int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es ) int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es )
{ {
unsigned int i_index = 0; unsigned int i_index = 0;
vlc_value_t val;
char *psz_var = NULL;
if( p_es == NULL ) if( p_es == NULL )
{ {
...@@ -797,6 +844,27 @@ int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -797,6 +844,27 @@ int input_UnselectES( input_thread_t * p_input, es_descriptor_t * p_es )
return( -1 ); return( -1 );
} }
/* Update the es variable without triggering a callback */
switch( p_es->i_cat )
{
case AUDIO_ES:
psz_var = "audio-es";
break;
case SPU_ES:
psz_var = "spu-es";
break;
case VIDEO_ES:
psz_var = "video-es";
break;
}
if( psz_var )
{
val.i_int = -1;
var_Change( p_input, psz_var, VLC_VAR_SETVALUE, &val, NULL );
}
/* Actually unselect the ES */
input_EndDecoder( p_input, p_es ); input_EndDecoder( p_input, p_es );
p_es->p_pes = NULL; p_es->p_pes = 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