libvlc: add libvlc_media_player_add_slave

In order to add a slave when the media player is playing.
This commit is contained in:
Thomas Guillem 2016-05-27 12:05:33 +02:00
parent c46ebe14de
commit bfbeee7e5c
3 changed files with 47 additions and 1 deletions

View File

@ -786,9 +786,9 @@ libvlc_media_type_t libvlc_media_get_type( libvlc_media_t *p_md );
* \version LibVLC 3.0.0 and later.
*
* \param p_md media descriptor object
* \param psz_uri Uri of the slave (should contain a valid scheme).
* \param i_type subtitle or audio
* \param i_priority from 0 (low priority) to 4 (high priority)
* \param psz_uri Uri of the slave (should contain a valid scheme).
*
* \return 0 on success, -1 on error.
*/

View File

@ -954,6 +954,27 @@ LIBVLC_API void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
*/
LIBVLC_API void libvlc_media_player_set_video_title_display( libvlc_media_player_t *p_mi, libvlc_position_t position, unsigned int timeout );
/**
* Add a slave to the current media player.
*
* \note If the player is playing, the slave will be added directly. This call
* will also update the slave list of the attached libvlc_media_t.
*
* \version LibVLC 3.0.0 and later.
*
* \see libvlc_media_slaves_add
*
* \param p_mi the media player
* \param i_type subtitle or audio
* \param psz_uri Uri of the slave (should contain a valid scheme).
*
* \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 );
/**
* Release (free) libvlc_track_description_t
*

View File

@ -1891,6 +1891,31 @@ 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 )
{
input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
if( p_input_thread == NULL )
{
libvlc_media_t *p_media = libvlc_media_player_get_media( p_mi );
if( p_media == NULL )
return -1;
int i_ret = libvlc_media_slaves_add( p_media, i_type, 4, psz_uri );
libvlc_media_release( p_media );
return i_ret;
}
else
{
int i_ret = input_AddSlave( p_input_thread, i_type, psz_uri );
vlc_object_release( p_input_thread );
return i_ret == VLC_SUCCESS ? 0 : -1;
}
}
/**
* Maximum size of a formatted equalizer amplification band frequency value.
*