[vlc-devel] [RFC 6/8] libvlc: add a callback to notify the host when the rendering starts/ends
Steve Lhomme
robux4 at ycbcr.xyz
Tue Nov 20 16:42:40 CET 2018
This is going to be necessary for Direct3D rendering as we will need to share
the rendering context on both sides.
---
include/vlc/libvlc_media_player.h | 21 +++++++++++++++++++++
lib/media_player.c | 4 ++++
2 files changed, 25 insertions(+)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 9158fc328b..5b0361bb55 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -480,6 +480,24 @@ typedef bool (*libvlc_video_makeCurrent_cb)(void* opaque, bool enter);
*/
typedef void* (*libvlc_video_getProcAddress_cb)(void* opaque, const char* fct_name);
+/**
+ * Callback prototype called to tell the host the rendering is about to start.
+ *
+ * \param opaque private pointer passed in the @a libvlc_video_engine_callbacks_t [IN]
+ * \return true on success
+ * \version LibVLC 4.0.0 or later
+ */
+typedef bool (*libvlc_video_start_render_cb)(void* opaque);
+
+
+/**
+ * Callback prototype called to tell the host the rendering has ended.
+ *
+ * \param opaque private pointer passed in the @a libvlc_video_engine_callbacks_t [IN]
+ * \version LibVLC 4.0.0 or later
+ */
+typedef void (*libvlc_video_end_render_cb)(void* opaque);
+
/**
* Enumeration of the Video engine to be used on output.
* can be passed to @a libvlc_video_set_output_callbacks
@@ -516,6 +534,9 @@ typedef struct libvlc_video_engine_callbacks_t
/* OpenGL/GLES2 specific callbacks */
libvlc_video_makeCurrent_cb makeCurrent_cb;
libvlc_video_getProcAddress_cb getProcAddress_cb;
+
+ libvlc_video_start_render_cb startRender_cb;
+ libvlc_video_end_render_cb endRender_cb;
} libvlc_video_engine_callbacks_t;
/**
diff --git a/lib/media_player.c b/lib/media_player.c
index ef9bc329fd..41a91b6ece 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -646,6 +646,8 @@ libvlc_media_player_new( libvlc_instance_t *instance )
var_Create( mp, "vout-cb-swap", VLC_VAR_ADDRESS );
var_Create( mp, "vout-cb-get-proc-address", VLC_VAR_ADDRESS );
var_Create( mp, "vout-cb-make-current", VLC_VAR_ADDRESS );
+ var_Create( mp, "vout-cb-start-render", VLC_VAR_ADDRESS );
+ var_Create( mp, "vout-cb-end-render", VLC_VAR_ADDRESS );
var_Create (mp, "avcodec-hw", VLC_VAR_STRING);
var_Create (mp, "drawable-xid", VLC_VAR_INTEGER);
@@ -1188,6 +1190,8 @@ void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
var_SetAddress( mp, "vout-cb-swap", callbacks->swap_cb );
var_SetAddress( mp, "vout-cb-get-proc-address", callbacks->getProcAddress_cb );
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 );
}
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