[vlc-devel] [PATCH 1/3] dxva2: let the decoder handle the device referencing
Steve Lhomme
robux4 at gmail.com
Thu May 28 16:27:44 CEST 2015
---
will make it easier for D3D11VA to handle the video context reference
in par with the device referencing
---
modules/codec/avcodec/directx_va.c | 14 +++++---------
modules/codec/avcodec/dxva2.c | 6 ++++++
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 305a3ce..e3d770a 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -423,16 +423,12 @@ int directx_va_Open(vlc_va_t *va, directx_sys_t *dx_sys,
}
msg_Dbg(va, "DLLs loaded");
- if (dx_sys->d3ddev) {
- msg_Dbg(va, "Reusing DirectX device");
- } else {
- /* */
- if (dx_sys->pf_create_device(va)) {
- msg_Err(va, "Failed to create DirectX device");
- goto error;
- }
- msg_Dbg(va, "CreateDevice succeed");
+ /* */
+ if (dx_sys->pf_create_device(va)) {
+ msg_Err(va, "Failed to create DirectX device");
+ goto error;
}
+ msg_Dbg(va, "CreateDevice succeed");
if (dx_sys->pf_create_device_manager(va)) {
msg_Err(va, "D3dCreateDeviceManager failed");
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 7ab4c9d..9b002c3 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -315,6 +315,12 @@ static int D3dCreateDevice(vlc_va_t *va)
{
vlc_va_sys_t *sys = va->sys;
+ if (sys->dx_sys.d3ddev) {
+ msg_Dbg(va, "Reusing Direct3D9 device");
+ IDirect3DDevice9_AddRef(sys->dx_sys.d3ddev);
+ return VLC_SUCCESS;
+ }
+
/* */
LPDIRECT3D9 (WINAPI *Create9)(UINT SDKVersion);
Create9 = (void *)GetProcAddress(sys->hd3d9_dll, "Direct3DCreate9");
--
2.4.0
More information about the vlc-devel
mailing list