[vlc-commits] hw:d3d11: add a basic D3D11_CreateProcessor()

Steve Lhomme git at videolan.org
Mon May 28 13:24:58 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Nov 30 10:35:23 2017 +0100| [c146d93936d69899ca80fb140e67180b17ed5103] | committer: Steve Lhomme

hw:d3d11: add a basic D3D11_CreateProcessor()

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c146d93936d69899ca80fb140e67180b17ed5103
---

 modules/hw/d3d11/d3d11_processor.c | 24 ++++++++++++++++++++++++
 modules/hw/d3d11/d3d11_processor.h |  3 +++
 2 files changed, 27 insertions(+)

diff --git a/modules/hw/d3d11/d3d11_processor.c b/modules/hw/d3d11/d3d11_processor.c
index 43b4840e90..cff2096f30 100644
--- a/modules/hw/d3d11/d3d11_processor.c
+++ b/modules/hw/d3d11/d3d11_processor.c
@@ -36,6 +36,30 @@
 #include "d3d11_processor.h"
 
 #if defined(ID3D11VideoContext_VideoProcessorBlt)
+#undef D3D11_CreateProcessor
+int D3D11_CreateProcessor(vlc_object_t *o, d3d11_device_t *d3d_dev, d3d11_processor_t *out)
+{
+    HRESULT hr;
+    *out = (d3d11_processor_t) { 0 };
+
+    hr = ID3D11Device_QueryInterface(d3d_dev->d3ddevice, &IID_ID3D11VideoDevice, (void **)&out->d3dviddev);
+    if (FAILED(hr)) {
+       msg_Err(o, "Could not Query ID3D11VideoDevice Interface. (hr=0x%lX)", hr);
+       goto error;
+    }
+
+    hr = ID3D11DeviceContext_QueryInterface(d3d_dev->d3dcontext, &IID_ID3D11VideoContext, (void **)&out->d3dvidctx);
+    if (FAILED(hr)) {
+       msg_Err(o, "Could not Query ID3D11VideoContext Interface. (hr=0x%lX)", hr);
+       goto error;
+    }
+
+    return VLC_SUCCESS;
+error:
+    D3D11_ReleaseProcessor(out);
+    return VLC_ENOMOD;
+}
+
 void D3D11_ReleaseProcessor(d3d11_processor_t *out)
 {
     if (out->videoProcessor)
diff --git a/modules/hw/d3d11/d3d11_processor.h b/modules/hw/d3d11/d3d11_processor.h
index d239aead73..b2b9023589 100644
--- a/modules/hw/d3d11/d3d11_processor.h
+++ b/modules/hw/d3d11/d3d11_processor.h
@@ -36,6 +36,9 @@ typedef struct
     ID3D11VideoProcessor           *videoProcessor;
 } d3d11_processor_t;
 
+int D3D11_CreateProcessor(vlc_object_t *, d3d11_device_t *, d3d11_processor_t *out);
+#define D3D11_CreateProcessor(a,b,c) D3D11_CreateProcessor(VLC_OBJECT(a),b,c)
+
 void D3D11_ReleaseProcessor(d3d11_processor_t *);
 #endif
 



More information about the vlc-commits mailing list