[vlc-devel] [PATCH v2 16/18] lib/media_player: Add variables for NaCl handles

Dennis Hamester dennis.hamester at startmail.com
Mon Mar 13 11:11:50 CET 2017


From: Julian Scheel <julian at jusst.de>

The NaCl/PPAPI plugins need an instance handle and a resource getter
function pointer to be functional. Expose these variables through
libvlc.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 NEWS                              |  3 +++
 include/vlc/libvlc_media_player.h | 35 ++++++++++++++++++++++++++++
 lib/libvlc.sym                    |  3 +++
 lib/media_player.c                | 48 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+)

diff --git a/NEWS b/NEWS
index e972abc205..757489f747 100644
--- a/NEWS
+++ b/NEWS
@@ -245,6 +245,9 @@ libVLC:
  * Add libvlc_media_player_add_slave to replace libvlc_video_set_subtitle_file,
    working with MRL and supporting also audio slaves
  * Add vlc_epg_event_(New|Delete|Duplicate), vlc_epg_AddEvent, vlc_epg_Duplicate
+ * Add libvlc_media_player_set_nacl_pp_instance
+ * Add libvlc_media_player_set_nacl_get_ppb_interface
+ * Add libvlc_media_player_set_nacl_pp_view
 
 Logging
  * Support for the SystemD Journal
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 97069f795b..111019e7ce 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -586,6 +586,41 @@ LIBVLC_API void libvlc_media_player_set_android_context( libvlc_media_player_t *
 LIBVLC_API int libvlc_media_player_set_evas_object( libvlc_media_player_t *p_mi,
                                                     void *p_evas_object );
 
+/**
+ * Set the NaCl PP Instance handle
+ *
+ * \version LibVLC 3.0.0 and later.
+ *
+ * \param p_mi the media player
+ * \param pp_instance the PP_Instance id
+ * \return -1 if an error was detected, 0 otherwise.
+ */
+LIBVLC_API int libvlc_media_player_set_nacl_pp_instance( libvlc_media_player_t *p_mi,
+                                                         int pp_instance );
+
+/**
+ * Set the NaCl PPB Interface accessor
+ *
+ * \version LibVLC 3.0.0 and later.
+ *
+ * \param p_mi the media player
+ * \param p_get_ppb_interface PPB_GetInterface function pointer
+ * \return -1 if an error was detected, 0 otherwise.
+ */
+LIBVLC_API int libvlc_media_player_set_nacl_get_ppb_interface ( libvlc_media_player_t *p_mi,
+                                                                void *p_get_ppb_interface );
+
+/**
+ * Set the NaCl View resource
+ *
+ * \version LibVLC 3.0.0 and later.
+ *
+ * \param p_mi the media player
+ * \param pp_view the PP_Resource of the current view
+ * \return -1 if an error was detected, 0 otherwise.
+ */
+LIBVLC_API int libvlc_media_player_set_nacl_pp_view( libvlc_media_player_t *p_mi,
+                                                     int pp_view );
 
 /**
  * Callback prototype for audio playback.
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index caa55981bf..d36883a74e 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -192,6 +192,9 @@ libvlc_media_player_set_equalizer
 libvlc_media_player_set_evas_object
 libvlc_media_player_set_hwnd
 libvlc_media_player_set_media
+libvlc_media_player_set_nacl_pp_instance
+libvlc_media_player_set_nacl_get_ppb_interface
+libvlc_media_player_set_nacl_pp_view
 libvlc_media_player_set_nsobject
 libvlc_media_player_set_position
 libvlc_media_player_set_rate
diff --git a/lib/media_player.c b/lib/media_player.c
index 1ed1d84c15..2f309b2e4e 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -633,6 +633,11 @@ libvlc_media_player_new( libvlc_instance_t *instance )
 #ifdef HAVE_EVAS
     var_Create (mp, "drawable-evasobject", VLC_VAR_ADDRESS);
 #endif
+#ifdef __native_client__
+    var_Create (mp, "ppapi-instance", VLC_VAR_INTEGER);
+    var_Create (mp, "ppapi-ppb-get-interface", VLC_VAR_ADDRESS);
+    var_Create (mp, "ppapi-view", VLC_VAR_INTEGER);
+#endif
 
     var_Create (mp, "keyboard-events", VLC_VAR_BOOL);
     var_SetBool (mp, "keyboard-events", true);
@@ -1255,6 +1260,49 @@ int libvlc_media_player_set_evas_object( libvlc_media_player_t *p_mi,
 #endif
 }
 
+/**************************************************************************
+ * set_nacl handles
+ **************************************************************************/
+int libvlc_media_player_set_nacl_pp_instance( libvlc_media_player_t *p_mi,
+                                              int pp_instance )
+{
+#ifdef __native_client__
+    var_SetInteger(p_mi, "ppapi-instance", pp_instance);
+    return 0;
+#else
+    VLC_UNUSED(p_mi);
+    VLC_UNUSED(pp_instance);
+    return VLC_EGENERIC;
+#endif
+}
+
+int libvlc_media_player_set_nacl_get_ppb_interface ( libvlc_media_player_t *p_mi,
+                                                     void *p_get_ppb_interface )
+{
+#ifdef __native_client__
+    var_SetInteger(p_mi, "ppapi-ppb-get-interface", p_get_ppb_interface);
+    return 0;
+#else
+    VLC_UNUSED(p_mi);
+    VLC_UNUSED(p_get_ppb_interface);
+    return VLC_EGENERIC;
+#endif
+}
+
+int libvlc_media_player_set_nacl_pp_view( libvlc_media_player_t *p_mi,
+                                          int pp_view )
+{
+#ifdef __native_client__
+    var_SetString(p_mi, "vout", "gles2");
+    var_SetInteger(p_mi, "ppapi-view", pp_view);
+    return 0;
+#else
+    VLC_UNUSED(p_mi);
+    VLC_UNUSED(pp_view);
+    return VLC_EGENERIC;
+#endif
+}
+
 void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
                                  libvlc_audio_play_cb play_cb,
                                  libvlc_audio_pause_cb pause_cb,
-- 
2.12.0



More information about the vlc-devel mailing list