Commit b6bbe81d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

input: Allow input_AddSlave to notify of the addition

parent 6e309636
......@@ -460,7 +460,7 @@ enum input_query_e
INPUT_GET_ATTACHMENT, /* arg1=input_attachment_t**, arg2=char* res=can fail */
/* On the fly input slave */
INPUT_ADD_SLAVE, /* arg1= enum slave_type, arg2= const char *, arg3= bool */
INPUT_ADD_SLAVE, /* arg1= enum slave_type, arg2= const char *, arg3= bool, arg4= bool */
INPUT_ADD_SUBTITLE, /* arg1= const char *, arg2=bool b_check_extension */
/* On the fly record while playing */
......@@ -598,9 +598,9 @@ static inline int input_AddSubtitleOSD( input_thread_t *p_input, const char *psz
#define input_AddSubtitle(a, b, c) input_AddSubtitleOSD(a, b, c, false)
static inline int input_AddSlave( input_thread_t *p_input, enum slave_type type,
const char *psz_uri, bool b_forced )
const char *psz_uri, bool b_forced, bool b_notify )
{
return input_Control( p_input, INPUT_ADD_SLAVE, type, psz_uri, b_forced );
return input_Control( p_input, INPUT_ADD_SLAVE, type, psz_uri, b_forced, b_notify );
}
/**
......
......@@ -1941,7 +1941,7 @@ int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
else
{
int i_ret = input_AddSlave( p_input_thread, (enum slave_type) i_type,
psz_uri, b_select );
psz_uri, b_select, false );
vlc_object_release( p_input_thread );
return i_ret == VLC_SUCCESS ? 0 : -1;
......
......@@ -411,6 +411,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
enum slave_type type = (enum slave_type) va_arg( args, enum slave_type );
psz = va_arg( args, char * );
b_bool = va_arg( args, int );
bool b_notify = va_arg( args, int );
if( !psz || ( type != SLAVE_TYPE_SPU && type != SLAVE_TYPE_AUDIO ) )
return VLC_EGENERIC;
......@@ -423,6 +424,25 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
val.p_address = p_slave;
input_ControlPush( p_input, INPUT_CONTROL_ADD_SLAVE, &val );
if( b_notify )
{
vout_thread_t *p_vout = input_GetVout( p_input );
if( p_vout )
{
switch( type )
{
case SLAVE_TYPE_AUDIO:
vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s",
vlc_gettext("Audio track added"));
break;
case SLAVE_TYPE_SPU:
vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s",
vlc_gettext("Subtitle track added"));
break;
}
vlc_object_release( (vlc_object_t *)p_vout );
}
}
return VLC_SUCCESS;
}
......
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