[vlc-devel] [PATCH 16/18] libvlc: pass the select_plane callback to OpenGL as well
Steve Lhomme
robux4 at ycbcr.xyz
Tue Feb 4 16:26:11 CET 2020
So we have the same prototype between OpenGL and D3D setup functions.
---
doc/libvlc/QtGL/qtvlcwidget.cpp | 2 +-
doc/libvlc/sdl_opengl_player.cpp | 2 +-
include/vlc/libvlc_media_player.h | 42 ++++++++++++++++---------------
lib/media_player.c | 2 ++
4 files changed, 26 insertions(+), 22 deletions(-)
diff --git a/doc/libvlc/QtGL/qtvlcwidget.cpp b/doc/libvlc/QtGL/qtvlcwidget.cpp
index b8291f6dbc8..6aa81de6c7d 100644
--- a/doc/libvlc/QtGL/qtvlcwidget.cpp
+++ b/doc/libvlc/QtGL/qtvlcwidget.cpp
@@ -172,7 +172,7 @@ bool QtVLCWidget::playMedia(const char* url)
// Define the opengl rendering callbacks
libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl,
VLCVideo::setup, VLCVideo::cleanup, VLCVideo::resizeRenderTextures, VLCVideo::swap,
- VLCVideo::make_current, VLCVideo::get_proc_address,
+ VLCVideo::make_current, VLCVideo::get_proc_address, nullptr,
mVLC);
// Play the video
diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index 5ab8ef871e4..68f71b1195f 100644
--- a/doc/libvlc/sdl_opengl_player.cpp
+++ b/doc/libvlc/sdl_opengl_player.cpp
@@ -81,7 +81,7 @@ public:
// Define the opengl rendering callbacks
libvlc_video_set_output_callbacks(m_mp, libvlc_video_engine_opengl,
setup, cleanup, resize, swap,
- make_current, get_proc_address,
+ make_current, get_proc_address, nullptr,
this);
// Play the video
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index c5a0ab9e6eb..64c58ff4b42 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -681,6 +681,27 @@ typedef void( *libvlc_video_output_set_resize_cb )( void *opaque,
void (*report_size_change)(void *report_opaque, unsigned width, unsigned height),
void *report_opaque );
+/**
+ * Tell the host the rendering for the given plane is about to start
+ *
+ * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [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_direct3d_engine_d3d11.
+ *
+ * The host should call OMSetRenderTargets for Direct3D11. If this callback is
+ * not used (set to NULL in @a libvlc_video_direct3d_set_callbacks()) OMSetRenderTargets
+ * has to be set during the @a libvlc_video_makeCurrent_cb()
+ * entering call.
+ *
+ * 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 texture
*
@@ -714,6 +735,7 @@ bool libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
libvlc_video_swap_cb swap_cb,
libvlc_video_makeCurrent_cb makeCurrent_cb,
libvlc_video_getProcAddress_cb getProcAddress_cb,
+ libvlc_video_direct3d_select_plane_cb select_plane_cb,
void* opaque );
@@ -728,26 +750,6 @@ typedef enum libvlc_video_direct3d_engine_t {
libvlc_video_direct3d_engine_d3d9,
} libvlc_video_direct3d_engine_t;
-/** Tell the host the rendering for the given plane is about to start
- *
- * \param opaque private pointer set on the opaque parameter of @a libvlc_video_output_setup_cb() [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_direct3d_engine_d3d11.
- *
- * The host should call OMSetRenderTargets for Direct3D11. If this callback is
- * not used (set to NULL in @a libvlc_video_direct3d_set_callbacks()) OMSetRenderTargets
- * has to be set during the @a libvlc_video_makeCurrent_cb()
- * entering call.
- *
- * 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
*
diff --git a/lib/media_player.c b/lib/media_player.c
index a3501825d31..749d11ef5ac 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1040,6 +1040,7 @@ bool libvlc_video_set_output_callbacks(libvlc_media_player_t *mp,
libvlc_video_swap_cb swap_cb,
libvlc_video_makeCurrent_cb makeCurrent_cb,
libvlc_video_getProcAddress_cb getProcAddress_cb,
+ libvlc_video_direct3d_select_plane_cb select_plane_cb,
void *opaque)
{
#ifdef __ANDROID__
@@ -1070,6 +1071,7 @@ bool libvlc_video_set_output_callbacks(libvlc_media_player_t *mp,
var_SetAddress( mp, "vout-cb-swap", swap_cb );
var_SetAddress( mp, "vout-cb-get-proc-address", getProcAddress_cb );
var_SetAddress( mp, "vout-cb-make-current", makeCurrent_cb );
+ var_SetAddress( mp, "vout-cb-select-plane", select_plane_cb );
return true;
}
--
2.17.1
More information about the vlc-devel
mailing list