[vlc-devel] [PATCH 5/7] libvlc: use a callback to select the plane to render to
Steve Lhomme
robux4 at ycbcr.xyz
Tue May 7 11:39:53 CEST 2019
We can now render to NV12/P010 externally. Only supported by D3D11 rendering.
---
include/vlc/libvlc_media_player.h | 17 +++++++++++++++++
lib/media_player.c | 3 +++
2 files changed, 20 insertions(+)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index cebe81f9fa..cb6816797a 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -736,6 +736,22 @@ typedef struct
*/
typedef bool( *libvlc_video_direct3d_start_end_rendering_cb )( void *opaque, bool enter, const libvlc_video_direct3d_hdr10_metadata_t *hdr10 );
+/** Tell the host the rendering for the given plane is about to start
+ *
+ * \param opaque private pointer passed to the @a libvlc_video_direct3d_set_callbacks() [IN]
+ * \param plane number of the rendering plane to select
+ * \return true on success
+ * \version LibVLC 4.0.0 or later
+ *
+ * \note This is only used with \ref libvlc_video_rendering_direct3d11.
+ *
+ * The host should call OMSetRenderTargets for Direct3D11.
+ *
+ * The number of planes depend on the DXGI_FORMAT returned during the
+ * \ref LIBVLC_VIDEO_UPDATE_OUTPUT call. It's usually one plane except for
+ * semi-planar formats like DXGI_FORMAT_NV12 or DXGI_FORMAT_P010.
+ */
+typedef bool( *libvlc_video_direct3d_select_plane_cb )( void *opaque, size_t plane );
/**
* Set callbacks and data to render decoded video to a custom Direct3D output
@@ -758,6 +774,7 @@ int libvlc_video_direct3d_set_callbacks( libvlc_media_player_t *mp,
libvlc_video_direct3d_update_output_cb update_output_cb,
libvlc_video_swap_cb swap_cb,
libvlc_video_direct3d_start_end_rendering_cb makeCurrent_cb,
+ libvlc_video_direct3d_select_plane_cb select_plane_cb,
void* opaque );
/**
diff --git a/lib/media_player.c b/lib/media_player.c
index 24f8b6fcd8..4060aa1f7e 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -646,6 +646,7 @@ 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-select-plane", VLC_VAR_ADDRESS );
var_Create (mp, "avcodec-hw", VLC_VAR_STRING);
var_Create (mp, "drawable-xid", VLC_VAR_INTEGER);
@@ -1209,6 +1210,7 @@ int libvlc_video_direct3d_set_callbacks( libvlc_media_player_t *mp,
libvlc_video_direct3d_update_output_cb update_output_cb,
libvlc_video_swap_cb swap_cb,
libvlc_video_direct3d_start_end_rendering_cb makeCurrent_cb,
+ libvlc_video_direct3d_select_plane_cb select_plane_cb,
void* opaque )
{
var_SetString( mp, "window", "wdummy");
@@ -1232,6 +1234,7 @@ int libvlc_video_direct3d_set_callbacks( libvlc_media_player_t *mp,
var_SetAddress( mp, "vout-cb-update-output", update_output_cb );
var_SetAddress( mp, "vout-cb-swap", swap_cb );
var_SetAddress( mp, "vout-cb-make-current", makeCurrent_cb );
+ var_SetAddress( mp, "vout-cb-select-plane", select_plane_cb );
return 1;
}
--
2.17.1
More information about the vlc-devel
mailing list