[vlc-commits] libvlc: change libvlc_media_player_add_slave arguments

Thomas Guillem git at videolan.org
Tue Jun 7 18:26:00 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jun  7 18:18:00 2016 +0200| [f81b16e5ad8de96eeb1bca2603042aaf844adf5f] | committer: Thomas Guillem

libvlc: change libvlc_media_player_add_slave arguments

The last boolean argument is used to force the selection of a slave.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f81b16e5ad8de96eeb1bca2603042aaf844adf5f
---

 include/vlc/libvlc_media_player.h |    3 ++-
 include/vlc_input.h               |    6 +++---
 lib/media_player.c                |    4 ++--
 src/input/control.c               |    2 ++
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 5e6b5b8..2323b4d 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -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
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 7633e9d..16a6a49 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -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 */
@@ -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 );
 }
 
 
diff --git a/lib/media_player.c b/lib/media_player.c
index e740705..a0860da 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -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 );
 
@@ -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;
diff --git a/src/input/control.c b/src/input/control.c
index 16f5186..be5ecca 100644
--- a/src/input/control.c
+++ b/src/input/control.c
@@ -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;
@@ -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 );



More information about the vlc-commits mailing list