[vlc-devel] [PATCH 03/21] libvlc: merge direct3d_start_end_rendering_cb and makeCurrent_cb

Steve Lhomme robux4 at ycbcr.xyz
Wed Feb 5 16:13:11 CET 2020


They have the same prototype and serve the same purpose.
---
 include/vlc/libvlc_media_player.h       | 49 +++++++++++--------------
 lib/media_player.c                      |  2 +-
 modules/video_output/win32/direct3d11.c |  2 +-
 modules/video_output/win32/direct3d9.c  |  2 +-
 4 files changed, 24 insertions(+), 31 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 1d3870c08e6..94a939c3a16 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -541,12 +541,29 @@ typedef void (*libvlc_video_update_output_cb)(void* opaque, unsigned width, unsi
 typedef void (*libvlc_video_swap_cb)(void* opaque);
 
 /**
- * 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]
  * \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);
 
@@ -739,30 +756,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
- * \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 );
-
 /** 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]
@@ -774,7 +767,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
@@ -814,7 +807,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_frameMetadata_cb metadata_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 9fa894ed8eb..2ea8e15cef6 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1080,7 +1080,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_frameMetadata_cb metadata_cb,
                                          libvlc_video_direct3d_select_plane_cb select_plane_cb,
                                          void *opaque)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 416bf0b7d30..62f293f8887 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_frameMetadata_cb            sendMetadataCb;
     libvlc_video_direct3d_select_plane_cb    selectPlaneCb;
 };
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 8878054b9c1..552e7dcef1b 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