vlc | branch: master | Steve Lhomme <[email protected]> | Thu Jan 19 11:10:46 
2017 +0100| [7f1afca6d6b00c1363b2ea692240e09dc04f55a0] | committer: 
Jean-Baptiste Kempf

d3d11: use D3D11DeviceAdapter() where possible

to simplify the code

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

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

 modules/codec/avcodec/d3d11va.c         | 14 ++------------
 modules/video_output/win32/direct3d11.c | 12 ++----------
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 53ddd30..deed0e7 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -607,16 +607,8 @@ static char *DxDescribe(directx_sys_t *dx_sys)
         { 0, "" }
     };
 
-    IDXGIDevice *pDXGIDevice = NULL;
-    HRESULT hr = ID3D11Device_QueryInterface( (ID3D11Device*) dx_sys->d3ddev, 
&IID_IDXGIDevice, (void **)&pDXGIDevice);
-    if (FAILED(hr)) {
-       return NULL;
-    }
-
-    IDXGIAdapter *p_adapter;
-    hr = IDXGIDevice_GetAdapter(pDXGIDevice, &p_adapter);
-    if (FAILED(hr)) {
-        IDXGIDevice_Release(pDXGIDevice);
+    IDXGIAdapter *p_adapter = D3D11DeviceAdapter((ID3D11Device*) 
dx_sys->d3ddev);
+    if (!p_adapter) {
        return NULL;
     }
 
@@ -636,12 +628,10 @@ static char *DxDescribe(directx_sys_t *dx_sys)
                      adapterDesc.VendorId, vendor, adapterDesc.DeviceId, 
adapterDesc.Revision) < 0)
             return NULL;
         IDXGIAdapter_Release(p_adapter);
-        IDXGIDevice_Release(pDXGIDevice);
         return description;
     }
 
     IDXGIAdapter_Release(p_adapter);
-    IDXGIDevice_Release(pDXGIDevice);
     return NULL;
 }
 
diff --git a/modules/video_output/win32/direct3d11.c 
b/modules/video_output/win32/direct3d11.c
index 7b87255..24f566d 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1195,17 +1195,9 @@ static int Direct3D11Open(vout_display_t *vd, 
video_format_t *fmt)
        return VLC_EGENERIC;
     }
 
-    IDXGIDevice *pDXGIDevice = NULL;
-    hr = ID3D11Device_QueryInterface(sys->d3ddevice, &IID_IDXGIDevice, (void 
**)&pDXGIDevice);
+    dxgiadapter = D3D11DeviceAdapter(sys->d3ddevice);
     if (FAILED(hr)) {
-       msg_Err(vd, "Could not Query DXGI Interface. (hr=0x%lX)", hr);
-       return VLC_EGENERIC;
-    }
-
-    hr = IDXGIDevice_GetAdapter(pDXGIDevice, &dxgiadapter);
-    IDXGIAdapter_Release(pDXGIDevice);
-    if (FAILED(hr)) {
-       msg_Err(vd, "Could not get the DXGI Adapter. (hr=0x%lX)", hr);
+       msg_Err(vd, "Could not get the DXGI Adapter");
        return VLC_EGENERIC;
     }
 

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to