[vlc-commits] lib: add libvlc_media_player_set_android_context

Thomas Guillem git at videolan.org
Thu Jun 25 19:08:46 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jun 25 13:52:59 2015 +0200| [63dbabfda7fabbcb4fcfcb98548f470900a0d24d] | committer: Thomas Guillem

lib: add libvlc_media_player_set_android_context

Used to pass the Java VM and a org.videolan.libvlc.IAWindowNativeHandler
jobject.

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

 include/vlc/libvlc_media_player.h |   15 +++++++++++++++
 lib/media_player.c                |   20 ++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index d24392d..3bccb5b 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -514,6 +514,21 @@ LIBVLC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void
 LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
 
 /**
+ * Set the android context.
+ *
+ * \version LibVLC 3.0.0 and later.
+ *
+ * \param p_mi the media player
+ * \param p_jvm the Java VM of the android process.
+ * \param awindow_handler org.videolan.libvlc.IAWindowNativeHandler jobject
+ *        implemented by the org.videolan.libvlc.MediaPlayer class from the
+ *        libvlc-android project.
+ */
+LIBVLC_API void libvlc_media_player_set_android_context( libvlc_media_player_t *p_mi,
+                                                         void *p_jvm,
+                                                         void *p_awindow_handler );
+
+/**
  * Callback prototype for audio playback.
  * \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
  * \param samples pointer to the first audio sample to play back [IN]
diff --git a/lib/media_player.c b/lib/media_player.c
index 885c3f1..09e3975 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -515,6 +515,10 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create (mp, "drawable-agl", VLC_VAR_INTEGER);
     var_Create (mp, "drawable-nsobject", VLC_VAR_ADDRESS);
 #endif
+#ifdef __ANDROID__
+    var_Create (mp, "android-jvm", VLC_VAR_ADDRESS);
+    var_Create (mp, "drawable-androidwindow", VLC_VAR_ADDRESS);
+#endif
 
     var_Create (mp, "keyboard-events", VLC_VAR_BOOL);
     var_SetBool (mp, "keyboard-events", true);
@@ -1093,6 +1097,22 @@ void *libvlc_media_player_get_hwnd( libvlc_media_player_t *p_mi )
 #endif
 }
 
+/**************************************************************************
+ * set_android_context
+ **************************************************************************/
+void libvlc_media_player_set_android_context( libvlc_media_player_t *p_mi,
+                                              void *p_jvm,
+                                              void *p_awindow_handler )
+{
+    assert (p_mi != NULL);
+#ifdef __ANDROID__
+    var_SetAddress (p_mi, "android-jvm", p_jvm);
+    var_SetAddress (p_mi, "drawable-androidwindow", p_awindow_handler);
+#else
+    (void) p_mi; (void) p_jvm; (void) p_awindow_handler;
+#endif
+}
+
 void libvlc_audio_set_callbacks( libvlc_media_player_t *mp,
                                  libvlc_audio_play_cb play_cb,
                                  libvlc_audio_pause_cb pause_cb,



More information about the vlc-commits mailing list