[vlc-devel] [RFC 7/8] libvlc: add an engine context pointer to the callbacks structure

Steve Lhomme robux4 at ycbcr.xyz
Tue Nov 20 16:42:41 CET 2018


This will be necessary for Direct3D where we need the D3DDeviceContext from the
host to render into.
---
 include/vlc/libvlc_media_player.h | 2 ++
 lib/media_player.c                | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 5b0361bb55..dca339315a 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -511,6 +511,7 @@ typedef enum libvlc_video_engine_t {
  * The structure should be created by libvlc_video_engine_callbacks_get().
  *
  * \param engine the GPU engine to use
+ * \param engine_context is a context pointer that depends on the engine type
  * \param opaque private pointer passed to each callbacks
  * \param setup_cb callback called to initialize user data
  * \param cleanup_cb callback called to clean up user data
@@ -523,6 +524,7 @@ typedef enum libvlc_video_engine_t {
 typedef struct libvlc_video_engine_callbacks_t
 {
     libvlc_video_engine_t           engine;
+    void                            *engine_context;
 
     void                            *opaque;
 
diff --git a/lib/media_player.c b/lib/media_player.c
index 41a91b6ece..6da4887941 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -649,6 +649,8 @@ libvlc_media_player_new( libvlc_instance_t *instance )
     var_Create( mp, "vout-cb-start-render", VLC_VAR_ADDRESS );
     var_Create( mp, "vout-cb-end-render", VLC_VAR_ADDRESS );
 
+    var_Create( mp, "vout-engine-ctx", VLC_VAR_ADDRESS );
+
     var_Create (mp, "avcodec-hw", VLC_VAR_STRING);
     var_Create (mp, "drawable-xid", VLC_VAR_INTEGER);
 #if defined (_WIN32) || defined (__OS2__)
@@ -1192,6 +1194,8 @@ void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
     var_SetAddress( mp, "vout-cb-make-current", callbacks->makeCurrent_cb );
     var_SetAddress( mp, "vout-cb-start-render", callbacks->startRender_cb );
     var_SetAddress( mp, "vout-cb-end-render", callbacks->endRender_cb );
+
+    var_SetAddress( mp, "vout-engine-ctx", callbacks->engine_context );
 }
 
 libvlc_video_engine_callbacks_t *libvlc_video_engine_callbacks_get( libvlc_video_engine_t engine )
-- 
2.17.1



More information about the vlc-devel mailing list