Commit 2a399242 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

dxva2: move the device check in dxva since it's the only one that supports it

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent f7d5f497
......@@ -183,24 +183,6 @@ static int Extract(vlc_va_t *va, picture_t *output, uint8_t *data)
return VLC_SUCCESS;
}
static int CheckDevice(vlc_va_t *va)
{
VLC_UNUSED(va);
#ifdef TODO
/* Check the device */
/* see MFCreateDXGIDeviceManager in mfplat.dll, not avail in Win7 */
HRESULT hr = IDirect3DDeviceManager9_TestDevice(sys->devmng, sys->device);
if (hr == DXVA2_E_NEW_VIDEO_DEVICE) {
if (DxResetVideoDecoder(va))
return VLC_EGENERIC;
} else if (FAILED(hr)) {
msg_Err(va, "IDirect3DDeviceManager9_TestDevice %u", (unsigned)hr);
return VLC_EGENERIC;
}
#endif
return VLC_SUCCESS;
}
static void d3d11_pic_context_destroy(struct picture_context_t *opaque)
{
struct va_pic_context *pic_ctx = (struct va_pic_context*)opaque;
......@@ -383,7 +365,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
dx_sys = &sys->dx_sys;
dx_sys->va_pool.pf_check_device = CheckDevice;
dx_sys->va_pool.pf_create_device = D3dCreateDevice;
dx_sys->va_pool.pf_destroy_device = D3dDestroyDevice;
dx_sys->va_pool.pf_create_video_service = DxCreateVideoService;
......
......@@ -182,22 +182,6 @@ static int Extract(vlc_va_t *va, picture_t *picture, uint8_t *data)
return VLC_SUCCESS;
}
static int CheckDevice(vlc_va_t *va)
{
vlc_va_sys_t *sys = va->sys;
/* Check the device */
HRESULT hr = IDirect3DDeviceManager9_TestDevice(sys->devmng, sys->device);
if (hr == DXVA2_E_NEW_VIDEO_DEVICE) {
if (DxResetVideoDecoder(va))
return VLC_EGENERIC;
} else if (FAILED(hr)) {
msg_Err(va, "IDirect3DDeviceManager9_TestDevice %u", (unsigned)hr);
return VLC_EGENERIC;
}
return VLC_SUCCESS;
}
static void d3d9_pic_context_destroy(struct picture_context_t *opaque)
{
struct va_pic_context *pic_ctx = (struct va_pic_context*)opaque;
......@@ -233,7 +217,19 @@ static struct picture_context_t *CreatePicContext(vlc_va_surface_t *va_surface)
static int Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
{
vlc_va_surface_t *va_surface = va_pool_Get(va, &va->sys->dx_sys.va_pool);
vlc_va_sys_t *sys = va->sys;
/* Check the device */
HRESULT hr = IDirect3DDeviceManager9_TestDevice(sys->devmng, sys->device);
if (hr == DXVA2_E_NEW_VIDEO_DEVICE) {
if (DxResetVideoDecoder(va))
return VLC_EGENERIC;
} else if (FAILED(hr)) {
msg_Err(va, "IDirect3DDeviceManager9_TestDevice %u", (unsigned)hr);
return VLC_EGENERIC;
}
vlc_va_surface_t *va_surface = va_pool_Get(va, &sys->dx_sys.va_pool);
if (unlikely(va_surface==NULL))
return VLC_EGENERIC;
pic->context = CreatePicContext(va_surface);
......@@ -304,7 +300,6 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
dx_sys = &sys->dx_sys;
dx_sys->va_pool.pf_check_device = CheckDevice;
dx_sys->va_pool.pf_create_device = D3dCreateDevice;
dx_sys->va_pool.pf_destroy_device = D3dDestroyDevice;
dx_sys->va_pool.pf_create_device_manager = D3dCreateDeviceManager;
......
......@@ -128,10 +128,6 @@ static vlc_va_surface_t *GetSurface(va_pool_t *va_pool)
vlc_va_surface_t *va_pool_Get(vlc_va_t *va, va_pool_t *va_pool)
{
/* Check the device */
if (va_pool->pf_check_device(va)!=VLC_SUCCESS)
return NULL;
unsigned tries = (CLOCK_FREQ + VOUT_OUTMEM_SLEEP) / VOUT_OUTMEM_SLEEP;
vlc_va_surface_t *field;
......
......@@ -47,11 +47,6 @@ typedef struct
vlc_va_surface_t *surface[MAX_SURFACE_COUNT];
D3D_DecoderSurface *hw_surface[MAX_SURFACE_COUNT];
/**
* Check that the decoder device is still available
*/
int (*pf_check_device)(vlc_va_t *);
int (*pf_create_device)(vlc_va_t *);
void (*pf_destroy_device)(vlc_va_t *);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment