[vlc-devel] [PATCH 02/18] libvlc: merge direct3d_start_end_rendering_cb and makeCurrent_cb

Steve Lhomme robux4 at ycbcr.xyz
Tue Feb 4 16:25:57 CET 2020


---
 doc/libvlc/d3d11_player.cpp                  |  2 +-
 doc/libvlc/d3d9_player.c                     |  2 +-
 include/vlc/libvlc_media_player.h            | 50 ++++++++------------
 lib/media_player.c                           |  2 +-
 modules/video_output/win32/d3d11_swapchain.c |  2 +-
 modules/video_output/win32/d3d11_swapchain.h |  2 +-
 modules/video_output/win32/direct3d11.c      |  4 +-
 modules/video_output/win32/direct3d9.c       |  2 +-
 8 files changed, 29 insertions(+), 37 deletions(-)

diff --git a/doc/libvlc/d3d11_player.cpp b/doc/libvlc/d3d11_player.cpp
index 6ce84fad993..a7aa522750f 100644
--- a/doc/libvlc/d3d11_player.cpp
+++ b/doc/libvlc/d3d11_player.cpp
@@ -417,7 +417,7 @@ static void Swap_cb( void* opaque )
     ctx->swapchain->Present( 0, 0 );
 }
 
-static bool StartRendering_cb( void *opaque, bool enter, const libvlc_video_direct3d_hdr10_metadata_t *hdr10 )
+static bool StartRendering_cb( void *opaque, bool enter, const libvlc_video_frame_hdr10_metadata_t *hdr10 )
 {
     struct render_context *ctx = static_cast<struct render_context *>( opaque );
     if ( enter )
diff --git a/doc/libvlc/d3d9_player.c b/doc/libvlc/d3d9_player.c
index ec3dbf806fb..46a088377d4 100644
--- a/doc/libvlc/d3d9_player.c
+++ b/doc/libvlc/d3d9_player.c
@@ -256,7 +256,7 @@ static void Swap_cb( void* opaque )
  *
  * This is called outside of the UI thread (in the VLC rendering thread).
  */
-static bool StartRendering_cb( void *opaque, bool enter, const libvlc_video_direct3d_hdr10_metadata_t *hdr10 )
+static bool StartRendering_cb( void *opaque, bool enter, const libvlc_video_frame_hdr10_metadata_t *hdr10 )
 {
     struct render_context *ctx = opaque;
     if ( enter )
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 02ca8b5fd54..70970f8c104 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -554,13 +554,30 @@ typedef struct
 } libvlc_video_frame_hdr10_metadata_t;
 
 /**
- * Callback prototype to set up the OpenGL context for rendering
+ * Callback prototype to set up the OpenGL context for rendering.
+ * Tell the host the rendering is about to start/has finished.
  *
- * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() [IN]
+ * \param opaque private pointer passed to the @a libvlc_video_set_output_callbacks() or
+ *          @a libvlc_video_direct3d_device_setup_cb() [IN]
  * \param enter true to set the context as current, false to unset it [IN]
  * \param hdr10 libvlc_video_frame_hdr10_metadata_t* or NULL [IN]
  * \return true on success
  * \version LibVLC 4.0.0 or later
+ *
+ * On Direct3D11 the following may change on the provided ID3D11DeviceContext*
+ * between \ref enter being true and \ref enter being false:
+ * - IASetPrimitiveTopology()
+ * - IASetInputLayout()
+ * - IASetVertexBuffers()
+ * - IASetIndexBuffer()
+ * - VSSetConstantBuffers()
+ * - VSSetShader()
+ * - PSSetSamplers()
+ * - PSSetConstantBuffers()
+ * - PSSetShaderResources()
+ * - PSSetShader()
+ * - RSSetViewports()
+ * - DrawIndexed()
  */
 typedef bool (*libvlc_video_makeCurrent_cb)(void* opaque, bool enter, const libvlc_video_frame_hdr10_metadata_t *hdr10);
 
@@ -726,31 +743,6 @@ typedef bool( *libvlc_video_direct3d_update_output_cb )( void *opaque,
                                                          const libvlc_video_direct3d_cfg_t *cfg,
                                                          libvlc_video_output_cfg_t *output );
 
-/** Tell the host the rendering is about to start/has finished.
- *
- * \param opaque private pointer set on the opaque parameter of @a libvlc_video_direct3d_device_setup_cb() [IN]
- * \param enter true if the rendering is about to start, false if it's finished
- * \param hdr10 libvlc_video_frame_hdr10_metadata_t* or NULL [IN]
- * \return true on success
- * \version LibVLC 4.0.0 or later
- *
- * On Direct3D11 the following may change on the provided ID3D11DeviceContext*
- * between \ref enter being true and \ref enter being false:
- * - IASetPrimitiveTopology()
- * - IASetInputLayout()
- * - IASetVertexBuffers()
- * - IASetIndexBuffer()
- * - VSSetConstantBuffers()
- * - VSSetShader()
- * - PSSetSamplers()
- * - PSSetConstantBuffers()
- * - PSSetShaderResources()
- * - PSSetShader()
- * - RSSetViewports()
- * - DrawIndexed()
- */
-typedef bool( *libvlc_video_direct3d_start_end_rendering_cb )( void *opaque, bool enter, const libvlc_video_frame_hdr10_metadata_t *hdr10 );
-
 /** 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_direct3d_device_setup_cb() [IN]
@@ -762,7 +754,7 @@ typedef bool( *libvlc_video_direct3d_start_end_rendering_cb )( void *opaque, boo
  *
  * 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_direct3d_start_end_rendering_cb()
+ * 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
@@ -801,7 +793,7 @@ bool libvlc_video_direct3d_set_callbacks( libvlc_media_player_t *mp,
                                          libvlc_video_direct3d_set_resize_cb resize_cb,
                                          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_makeCurrent_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 cdb6ba0b8c5..e2e52354ce8 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1079,7 +1079,7 @@ bool libvlc_video_direct3d_set_callbacks(libvlc_media_player_t *mp,
                                          libvlc_video_direct3d_set_resize_cb resize_cb,
                                          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_makeCurrent_cb makeCurrent_cb,
                                          libvlc_video_direct3d_select_plane_cb select_plane_cb,
                                          void *opaque)
 {
diff --git a/modules/video_output/win32/d3d11_swapchain.c b/modules/video_output/win32/d3d11_swapchain.c
index 71112e876b9..7115b559c2f 100644
--- a/modules/video_output/win32/d3d11_swapchain.c
+++ b/modules/video_output/win32/d3d11_swapchain.c
@@ -483,7 +483,7 @@ bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_direct3d_cfg_t
     return true;
 }
 
-bool LocalSwapchainStartEndRendering( void *opaque, bool enter, const libvlc_video_direct3d_hdr10_metadata_t *p_hdr10 )
+bool LocalSwapchainStartEndRendering( void *opaque, bool enter, const libvlc_video_frame_hdr10_metadata_t *p_hdr10 )
 {
     struct d3d11_local_swapchain *display = opaque;
 
diff --git a/modules/video_output/win32/d3d11_swapchain.h b/modules/video_output/win32/d3d11_swapchain.h
index 6a4bbae5ea7..b7cf0b6d290 100644
--- a/modules/video_output/win32/d3d11_swapchain.h
+++ b/modules/video_output/win32/d3d11_swapchain.h
@@ -33,7 +33,7 @@ void *CreateLocalSwapchainHandle(vlc_object_t *, HWND, ID3D11DeviceContext *);
 void LocalSwapchainCleanupDevice( void *opaque );
 void LocalSwapchainSwap( void *opaque );
 bool LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_direct3d_cfg_t *cfg, libvlc_video_output_cfg_t *out );
-bool LocalSwapchainStartEndRendering( void *opaque, bool enter, const libvlc_video_direct3d_hdr10_metadata_t *p_hdr10 );
+bool LocalSwapchainStartEndRendering( void *opaque, bool enter, const libvlc_video_frame_hdr10_metadata_t *p_hdr10 );
 bool LocalSwapchainSelectPlane( void *opaque, size_t plane );
 
 #endif /* VLC_D3D11_SWAPCHAIN_H */
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index c5f6a63fcde..258d906550a 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -121,7 +121,7 @@ struct vout_display_sys_t
     void *outside_opaque;
     libvlc_video_direct3d_update_output_cb   updateOutputCb;
     libvlc_video_swap_cb                     swapCb;
-    libvlc_video_direct3d_start_end_rendering_cb startEndRenderingCb;
+    libvlc_video_makeCurrent_cb              startEndRenderingCb;
     libvlc_video_direct3d_select_plane_cb    selectPlaneCb;
 };
 
@@ -688,7 +688,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
 
     VLC_UNUSED(date);
 
-    libvlc_video_direct3d_hdr10_metadata_t hdr10;
+    libvlc_video_frame_hdr10_metadata_t hdr10;
     if (picture->format.mastering.max_luminance)
     {
         hdr10.GreenPrimary[0] = picture->format.mastering.primaries[0];
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 9e36eb19184..8af69f5a296 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -173,7 +173,7 @@ struct vout_display_sys_t
     void *outside_opaque;
     libvlc_video_direct3d_update_output_cb   updateOutputCb;
     libvlc_video_swap_cb                     swapCb;
-    libvlc_video_direct3d_start_end_rendering_cb startEndRenderingCb;
+    libvlc_video_makeCurrent_cb              startEndRenderingCb;
 };
 
 /* */
-- 
2.17.1



More information about the vlc-devel mailing list