[vlc-commits] directx_va: allow not setting device manager callbacks
Steve Lhomme
git at videolan.org
Tue Jun 13 15:00:03 CEST 2017
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon May 29 09:50:53 2017 +0200| [038bea37bf93aae46f7584934f9c6556fc81fd13] | committer: Jean-Baptiste Kempf
directx_va: allow not setting device manager callbacks
It's not supported in Direct3D11
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=038bea37bf93aae46f7584934f9c6556fc81fd13
---
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 89cfd4dfb1..78fcdbf771 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 41df52bcc5..d07fc360cf 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -476,7 +476,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;
}
@@ -600,7 +601,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)
More information about the vlc-commits
mailing list