[vlc-devel] [PATCH 12/39] directx_va: allow not setting device manager callbacks
Steve Lhomme
robux4 at videolabs.io
Fri Jun 2 16:46:15 CEST 2017
It's not supported in Direct3D11
---
modules/codec/avcodec/d3d11va.c | 56 --------------------------------------
modules/codec/avcodec/directx_va.c | 6 ++--
2 files changed, 4 insertions(+), 58 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index c5d27b9591..8cba76ff6f 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -143,9 +143,6 @@ static int D3dCreateDevice(vlc_va_t *);
static void D3dDestroyDevice(vlc_va_t *);
static char *DxDescribe(directx_sys_t *);
-static int D3dCreateDeviceManager(vlc_va_t *);
-static void D3dDestroyDeviceManager(vlc_va_t *);
-
static int DxCreateVideoService(vlc_va_t *);
static void DxDestroyVideoService(vlc_va_t *);
static int DxGetInputList(vlc_va_t *, input_list_t *);
@@ -407,8 +404,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
dx_sys->pf_check_device = CheckDevice;
dx_sys->pf_create_device = D3dCreateDevice;
dx_sys->pf_destroy_device = D3dDestroyDevice;
- dx_sys->pf_create_device_manager = D3dCreateDeviceManager;
- dx_sys->pf_destroy_device_manager = D3dDestroyDeviceManager;
dx_sys->pf_create_video_service = DxCreateVideoService;
dx_sys->pf_destroy_video_service = DxDestroyVideoService;
dx_sys->pf_create_decoder_surfaces = DxCreateDecoderSurfaces;
@@ -613,57 +608,6 @@ static char *DxDescribe(directx_sys_t *dx_sys)
}
/**
- * It creates a Direct3D device manager
- */
-static int D3dCreateDeviceManager(vlc_va_t *va)
-{
- VLC_UNUSED(va);
-#if 0
- vlc_va_sys_t *sys = va->sys;
-
- HRESULT (WINAPI *CreateDeviceManager9)(UINT *pResetToken,
- IDirect3DDeviceManager9 **);
- CreateDeviceManager9 =
- (void *)GetProcAddress(sys->hdxva2_dll,
- "DXVA2CreateDirect3DDeviceManager9");
-
- if (!CreateDeviceManager9) {
- msg_Err(va, "cannot load function");
- return VLC_EGENERIC;
- }
- msg_Dbg(va, "OurDirect3DCreateDeviceManager9 Success!");
-
- UINT token;
- IDirect3DDeviceManager9 *devmng;
- if (FAILED(CreateDeviceManager9(&token, &devmng))) {
- msg_Err(va, " OurDirect3DCreateDeviceManager9 failed");
- return VLC_EGENERIC;
- }
- sys->token = token;
- sys->devmng = devmng;
- msg_Info(va, "obtained IDirect3DDeviceManager9");
-
- HRESULT hr = IDirect3DDeviceManager9_ResetDevice(devmng, dx_sys->d3ddev, token);
- if (FAILED(hr)) {
- msg_Err(va, "IDirect3DDeviceManager9_ResetDevice failed: %08x", (unsigned)hr);
- return VLC_EGENERIC;
- }
-#endif
- return VLC_SUCCESS;
-}
-/**
- * It destroys a Direct3D device manager
- */
-static void D3dDestroyDeviceManager(vlc_va_t *va)
-{
- VLC_UNUSED(va);
-#if 0
- if (va->devmng)
- IDirect3DDeviceManager9_Release(va->devmng);
-#endif
-}
-
-/**
* It creates a DirectX video service
*/
static int DxCreateVideoService(vlc_va_t *va)
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index 95a0abdb8c..7b99ab3c41 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -470,7 +470,8 @@ int directx_va_Open(vlc_va_t *va, directx_sys_t *dx_sys,
}
msg_Dbg(va, "CreateDevice succeed");
- if (dx_sys->pf_create_device_manager(va)) {
+ if (dx_sys->pf_create_device_manager &&
+ dx_sys->pf_create_device_manager(va) != VLC_SUCCESS) {
msg_Err(va, "CreateDeviceManager failed");
goto error;
}
@@ -594,7 +595,8 @@ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys, const
void DestroyDeviceManager(vlc_va_t *va, directx_sys_t *dx_sys)
{
- dx_sys->pf_destroy_device_manager(va);
+ if (dx_sys->pf_destroy_device_manager)
+ dx_sys->pf_destroy_device_manager(va);
}
void DestroyDevice(vlc_va_t *va, directx_sys_t *dx_sys)
--
2.12.1
More information about the vlc-devel
mailing list