Skip to content

Commit

Permalink
libvlc: change libvlc_media_player_add_slave arguments
Browse files Browse the repository at this point in the history
The last boolean argument is used to force the selection of a slave.
  • Loading branch information
tguillem committed Jun 7, 2016
1 parent 09e53a4 commit f81b16e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion include/vlc/libvlc_media_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -967,13 +967,14 @@ LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player
* \param p_mi the media player
* \param i_type subtitle or audio
* \param psz_uri Uri of the slave (should contain a valid scheme).
* \param b_select True if this slave should be selected when it's loaded
*
* \return 0 on success, -1 on error.
*/
LIBVLC_API
int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
libvlc_media_slave_type_t i_type,
const char *psz_uri );
const char *psz_uri, bool b_select );

/**
* Release (free) libvlc_track_description_t
Expand Down
6 changes: 3 additions & 3 deletions include/vlc_input.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,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= const char * */
INPUT_ADD_SLAVE, /* arg1= enum slave_type, arg2= const char *, arg3= bool */
INPUT_ADD_SUBTITLE, /* arg1= const char *, arg2=bool b_check_extension */

/* On the fly record while playing */
Expand Down Expand Up @@ -604,9 +604,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 )
const char *psz_uri, bool b_forced )
{
return input_Control( p_input, INPUT_ADD_SLAVE, type, psz_uri );
return input_Control( p_input, INPUT_ADD_SLAVE, type, psz_uri, b_forced );
}


Expand Down
4 changes: 2 additions & 2 deletions lib/media_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,7 @@ void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, l

int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
libvlc_media_slave_type_t i_type,
const char *psz_uri )
const char *psz_uri, bool b_select )
{
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );

Expand All @@ -1911,7 +1911,7 @@ int libvlc_media_player_add_slave( libvlc_media_player_t *p_mi,
}
else
{
int i_ret = input_AddSlave( p_input_thread, i_type, psz_uri );
int i_ret = input_AddSlave( p_input_thread, i_type, psz_uri, b_select );
vlc_object_release( p_input_thread );

return i_ret == VLC_SUCCESS ? 0 : -1;
Expand Down
2 changes: 2 additions & 0 deletions src/input/control.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,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 = (char*)va_arg( args, char * );
b_bool = (bool)va_arg( args, int );

if( !psz || ( type != SLAVE_TYPE_SPU && type != SLAVE_TYPE_AUDIO ) )
return VLC_EGENERIC;
Expand All @@ -441,6 +442,7 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
input_item_slave_New( psz, type, SLAVE_PRIORITY_USER );
if( !p_slave )
return VLC_ENOMEM;
p_slave->b_forced = b_bool;

val.p_address = p_slave;
input_ControlPush( p_input, INPUT_CONTROL_ADD_SLAVE, &val );
Expand Down

0 comments on commit f81b16e

Please sign in to comment.