[vlc-devel] [PATCH 3/9] libvlc: add an engine context pointer to the callbacks structure

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 18 14:58:59 CET 2019


This will be necessary for Direct3D where we need the D3DDeviceContext from the
host to render into.
---
 doc/libvlc/sdl_opengl_player.cpp  | 1 +
 include/vlc/libvlc_media_player.h | 3 +++
 lib/media_player.c                | 5 +++++
 3 files changed, 9 insertions(+)

diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index 901adafbe2..0dd2f9654d 100644
--- a/doc/libvlc/sdl_opengl_player.cpp
+++ b/doc/libvlc/sdl_opengl_player.cpp
@@ -80,6 +80,7 @@ public:
         }
         // Define the opengl rendering callbacks
         libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl,
+            NULL,
             setup, cleanup, resize, swap,
             make_current, get_proc_address,
             NULL, NULL,
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 9b80ac3b74..3572714ee3 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -515,6 +515,8 @@ typedef enum libvlc_video_engine_t {
  *
  * \param mp the media player
  * \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
  * \param update_output_cb callback called to get the size of the video
@@ -530,6 +532,7 @@ typedef enum libvlc_video_engine_t {
 LIBVLC_API
 int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
                                         libvlc_video_engine_t engine,
+                                        void *engine_context,
                                         libvlc_video_setup_cb setup_cb,
                                         libvlc_video_cleanup_cb cleanup_cb,
                                         libvlc_video_update_output_cb update_output_cb,
diff --git a/lib/media_player.c b/lib/media_player.c
index 4264484aa3..04dfb67302 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__)
@@ -1164,6 +1166,7 @@ void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
 
 int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
                                         libvlc_video_engine_t engine,
+                                        void *engine_context,
                                         libvlc_video_setup_cb setup_cb,
                                         libvlc_video_cleanup_cb cleanup_cb,
                                         libvlc_video_update_output_cb update_output_cb,
@@ -1203,6 +1206,8 @@ int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
     var_SetAddress( mp, "vout-cb-make-current", makeCurrent_cb );
     var_SetAddress( mp, "vout-cb-start-render", startRender_cb );
     var_SetAddress( mp, "vout-cb-end-render", endRender_cb );
+
+    var_SetAddress( mp, "vout-engine-ctx", engine_context );
     return 1;
 }
 
-- 
2.17.1



More information about the vlc-devel mailing list