vlc | branch: master | Thomas Guillem <tho...@gllm.fr> | Mon Sep 19 19:01:50 
2016 +0200| [08943f42144931c0b1b9f8a19199295a14f9ba6d] | committer: Thomas 
Guillem

libvlc: add libvlc_media_player_set_renderer

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

 include/vlc/libvlc_media_player.h | 16 ++++++++++++++++
 lib/Makefile.am                   |  1 +
 lib/audio.c                       |  1 +
 lib/media_list_player.c           |  1 +
 lib/media_player.c                | 17 +++++++++++++++++
 lib/video.c                       |  1 +
 6 files changed, 37 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h 
b/include/vlc/libvlc_media_player.h
index 9153196..9a73b4f 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -263,6 +263,22 @@ LIBVLC_API void libvlc_media_player_pause ( 
libvlc_media_player_t *p_mi );
 LIBVLC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
 
 /**
+ * Set a renderer to the media player
+ *
+ * \note must be called before the first call of libvlc_media_player_play() to
+ * take effect.
+ *
+ * \see libvlc_renderer_discoverer_new
+ *
+ * \param p_mi the Media Player
+ * \param p_item an item discovered by libvlc_renderer_discoverer_start()
+ * \return 0 on success, -1 on error.
+ * \version LibVLC 3.0.0 or later
+ */
+LIBVLC_API int libvlc_media_player_set_renderer( libvlc_media_player_t *p_mi,
+                                                 const libvlc_renderer_item_t 
*p_item );
+
+/**
  * Callback prototype to allocate and lock a picture buffer.
  *
  * Whenever a new video frame needs to be decoded, the lock callback is
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1562ad3..e32278a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -36,6 +36,7 @@ libvlc_la_SOURCES = \
        media_internal.h \
        media_list_internal.h \
        media_player_internal.h \
+       renderer_discoverer_internal.h \
        core.c \
        dialog.c \
        renderer_discoverer.c \
diff --git a/lib/audio.c b/lib/audio.c
index 7901c64..3aed6f5 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -30,6 +30,7 @@
 #include <math.h>
 
 #include <vlc/libvlc.h>
+#include <vlc/libvlc_renderer_discoverer.h>
 #include <vlc/libvlc_media.h>
 #include <vlc/libvlc_media_player.h>
 
diff --git a/lib/media_list_player.c b/lib/media_list_player.c
index c6f80f2..68e2cfa 100644
--- a/lib/media_list_player.c
+++ b/lib/media_list_player.c
@@ -28,6 +28,7 @@
 #endif
 
 #include <vlc/libvlc.h>
+#include <vlc/libvlc_renderer_discoverer.h>
 #include <vlc/libvlc_media.h>
 #include <vlc/libvlc_media_list.h>
 #include <vlc/libvlc_media_player.h>
diff --git a/lib/media_player.c b/lib/media_player.c
index 69d3523..9a8f73a 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -27,6 +27,7 @@
 #include <assert.h>
 
 #include <vlc/libvlc.h>
+#include <vlc/libvlc_renderer_discoverer.h>
 #include <vlc/libvlc_media.h>
 #include <vlc/libvlc_events.h>
 
@@ -39,6 +40,7 @@
 #include "libvlc_internal.h"
 #include "media_internal.h" // libvlc_media_set_state()
 #include "media_player_internal.h"
+#include "renderer_discoverer_internal.h"
 
 static int
 input_seekable_changed( vlc_object_t * p_this, char const * psz_cmd,
@@ -601,6 +603,8 @@ libvlc_media_player_new( libvlc_instance_t *instance )
 
     /* Input */
     var_Create (mp, "rate", VLC_VAR_FLOAT|VLC_VAR_DOINHERIT);
+    var_Create (mp, "sout", VLC_VAR_STRING);
+    var_Create (mp, "demux-filter", VLC_VAR_STRING);
 
     /* Video */
     var_Create (mp, "vout", VLC_VAR_STRING|VLC_VAR_DOINHERIT);
@@ -1052,6 +1056,19 @@ void libvlc_media_player_stop( libvlc_media_player_t 
*p_mi )
     unlock_input(p_mi);
 }
 
+int libvlc_media_player_set_renderer( libvlc_media_player_t *p_mi,
+                                      const libvlc_renderer_item_t *p_litem )
+{
+    const vlc_renderer_item_t *p_item = libvlc_renderer_item_to_vlc( p_litem );
+    char *psz_sout;
+    if( asprintf( &psz_sout, "#%s", vlc_renderer_item_sout( p_item ) ) == -1 )
+        return -1;
+
+    var_SetString( p_mi, "sout", psz_sout );
+    var_SetString( p_mi, "demux-filter", vlc_renderer_item_demux_filter( 
p_item ) );
+    free( psz_sout );
+    return 0;
+}
 
 void libvlc_video_set_callbacks( libvlc_media_player_t *mp,
     void *(*lock_cb) (void *, void **),
diff --git a/lib/video.c b/lib/video.c
index b2c9b34..8655a32 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -30,6 +30,7 @@
 #endif
 
 #include <vlc/libvlc.h>
+#include <vlc/libvlc_renderer_discoverer.h>
 #include <vlc/libvlc_media.h>
 #include <vlc/libvlc_media_player.h>
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to