[vlc-devel] [PATCH 8/9] libvlc: add callbacks to render to an external D3D11 surface

Steve Lhomme robux4 at ycbcr.xyz
Fri Jan 18 14:59:04 CET 2019


Instead of our own swapchain.
---
 include/vlc/libvlc_media_player.h | 19 +++++++++++++++++++
 lib/media_player.c                |  5 +++++
 2 files changed, 24 insertions(+)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index bcf9431b74..d4968ba0f8 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -506,6 +506,9 @@ typedef enum libvlc_video_engine_t {
     libvlc_video_engine_direct3d9, /* the engine_context must be a IDirect3DDevice9*
                                     * the device must be created with D3DPRESENT_PARAMETERS.hDeviceWindow set to 0
                                     */
+    libvlc_video_engine_direct3d11, /* the engine_context must be a ID3D11DeviceContext*
+                                     * The ID3D11Device used to create ID3D11DeviceContext must have multithreading enabled
+                                     */
 } libvlc_video_engine_t;
 
 /**
@@ -556,6 +559,22 @@ typedef enum libvlc_video_engine_t {
  * - D3DTSS_ALPHAOP
  * - D3DTSS_ALPHAARG1
  * - D3DTSS_ALPHAARG2
+ *
+ * For \ref libvlc_video_engine_direct3d11 the \ref engine_context must be a ID3D11DeviceContext*.
+ * Between start_render_cb and end_render_cb of Direct3D11 the following
+ * operations are called on the ID3D11DeviceContext:
+ * - IASetPrimitiveTopology()
+ * - IASetInputLayout()
+ * - IASetVertexBuffers()
+ * - IASetIndexBuffer()
+ * - VSSetConstantBuffers()
+ * - VSSetShader()
+ * - PSSetSamplers()
+ * - PSSetConstantBuffers()
+ * - PSSetShaderResources()
+ * - PSSetShader()
+ * - RSSetViewports()
+ * - DrawIndexed()
  */
 LIBVLC_API
 int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
diff --git a/lib/media_player.c b/lib/media_player.c
index 2365c4e76c..7e3b044772 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1190,6 +1190,11 @@ int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
         var_SetString ( mp, "vout", "direct3d9" );
         var_SetString ( mp, "avcodec-hw", "dxva2");
     }
+    else if ( engine == libvlc_video_engine_direct3d11 )
+    {
+        var_SetString ( mp, "vout", "direct3d11" );
+        var_SetString ( mp, "avcodec-hw", "d3d11va");
+    }
     else
 #endif
     if( engine == libvlc_video_engine_gles2 )
-- 
2.17.1



More information about the vlc-devel mailing list