[vlc-devel] [PATCH 07/13] further callback of the new hotkey. comments added.
Aaron Wang
hughwung at gmail.com
Wed Sep 16 15:49:45 CEST 2015
---
src/input/var.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/src/input/var.c b/src/input/var.c
index 47f4b88..6b81f99 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -103,6 +103,7 @@ static const vlc_input_callback_t p_input_callbacks[] =
CALLBACK( "video-es", ESCallback ),
CALLBACK( "audio-es", ESCallback ),
CALLBACK( "spu-es", ESCallback ),
+ CALLBACK( "spu-es2", ESCallback ),
CALLBACK( "record", RecordCallback ),
CALLBACK( "frame-next", FrameNextCallback ),
@@ -200,6 +201,11 @@ void input_ControlVarInit ( input_thread_t *p_input )
var_Create( p_input, "spu-es", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );
text.psz_string = _("Subtitle Track");
var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
+ /*the 2nd Spu Es the choices are the same*/
+ var_Create( p_input, "spu-es2", VLC_VAR_INTEGER);
+ text.psz_string = _("2nd Subtitle Track");
+ var_Change( p_input, "spu-es2", VLC_VAR_SETTEXT, &text, NULL );
+
var_Create( p_input, "spu-choice", VLC_VAR_INTEGER );
var_SetInteger( p_input, "spu-choice", -1 );
@@ -740,27 +746,38 @@ static int ESCallback( vlc_object_t *p_this, char const *psz_cmd,
input_thread_t *p_input = (input_thread_t*)p_this;
VLC_UNUSED(oldval); VLC_UNUSED(p_data);
- if( newval.i_int < 0 )
+ int i_type = INPUT_CONTROL_SET_ES;
+ if( !strcmp( psz_cmd, "spu-es2" ))
+ {
+ i_type = INPUT_CONTROL_SET_ES2;
+ msg_Dbg(p_input, "ESCallback spu-es2 val %d", newval.i_int);
+ }
+ if( !strcmp( psz_cmd, "spu-es" ))
+ {
+ i_type = INPUT_CONTROL_SET_ES;
+ msg_Dbg(p_input, "ESCallback spu-es val %d", newval.i_int);
+ }
+ if( newval.i_int < 0 )//if set to negative, only cat matters
{
vlc_value_t v;
/* Hack */
- if( !strcmp( psz_cmd, "audio-es" ) )
+ if( !strcmp( psz_cmd, "audio-es" ) )//it's not cmd, variable name actually
v.i_int = -AUDIO_ES;
else if( !strcmp( psz_cmd, "video-es" ) )
v.i_int = -VIDEO_ES;
- else if( !strcmp( psz_cmd, "spu-es" ) )
- v.i_int = -SPU_ES;
+ else if( !strcmp( psz_cmd, "spu-es" )|| !strcmp(psz_cmd, "spu-es2") )
+ v.i_int = -SPU_ES; //-1 is the id for disable
else
v.i_int = 0;
- if( v.i_int != 0 )
- input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &v );
+ if( v.i_int != 0 )//push it, so input thread will process it later
+ input_ControlPush( p_input, i_type, &v );
}
else
{
- input_ControlPush( p_input, INPUT_CONTROL_SET_ES, &newval );
+ input_ControlPush( p_input, i_type, &newval );
}
- return VLC_SUCCESS;
+ return VLC_SUCCESS;//the val will go to es_out_Control later
}
static int EsDelayCallback ( vlc_object_t *p_this, char const *psz_cmd,
--
1.9.1
More information about the vlc-devel
mailing list