[vlc-devel] [PATCH 04/14] d3d11_fmt: simplify the call to D3D11_CreateDevice()

Steve Lhomme robux4 at videolabs.io
Sat Nov 18 14:29:18 CET 2017


---
 modules/codec/avcodec/d3d11va.c         | 3 +--
 modules/video_chroma/d3d11_fmt.c        | 1 +
 modules/video_chroma/d3d11_fmt.h        | 1 +
 modules/video_output/win32/direct3d11.c | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 3c8ee18a3a..7ef0370604 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -428,8 +428,7 @@ static int D3dCreateDevice(vlc_va_t *va)
 
     /* */
     d3d11_device_t d3d_dev;
-    d3d11_handle_t hd3d = { .hdll = dx_sys->hdecoder_dll };
-    hr = D3D11_CreateDevice(va, &hd3d, true, &d3d_dev);
+    hr = D3D11_CreateDevice(va, dx_sys->hdecoder_dll, true, &d3d_dev);
     if (FAILED(hr)) {
         msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr);
         return VLC_EGENERIC;
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 695a47dd2b..cb55f32338 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -130,6 +130,7 @@ int AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
     return VLC_SUCCESS;
 }
 
+#undef D3D11_CreateDevice
 HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *hd3d,
                            bool hw_decoding, d3d11_device_t *out)
 {
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index 4793fe75ce..345c25206d 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -84,6 +84,7 @@ int AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
 
 HRESULT D3D11_CreateDevice(vlc_object_t *obj, d3d11_handle_t *,
                            bool hw_decoding, d3d11_device_t *out);
+#define D3D11_CreateDevice(a,b,c,d)  D3D11_CreateDevice( VLC_OBJECT(a), b, c, d )
 
 bool isXboxHardware(ID3D11Device *d3ddev);
 bool isNvidiaHardware(ID3D11Device *d3ddev);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index b98f6e372a..9594aa77c3 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1476,7 +1476,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
     //scd.Flags = 512; // DXGI_SWAP_CHAIN_FLAG_YUV_VIDEO;
     scd.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
 
-    hr = D3D11_CreateDevice(VLC_OBJECT(vd), &sys->hd3d,
+    hr = D3D11_CreateDevice(vd, &sys->hd3d,
                             is_d3d11_opaque(fmt->i_chroma),
                             &sys->d3d_dev);
     if (FAILED(hr)) {
-- 
2.14.2



More information about the vlc-devel mailing list