diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c index 8952de17b1e..4eefffd6052 100644 --- a/dlls/dxva2/main.c +++ b/dlls/dxva2/main.c @@ -377,6 +377,14 @@ static HRESULT WINAPI device_manager_processor_service_RegisterVideoProcessorSof return E_NOTIMPL; } +static BOOL dxva_is_supported_stream_format(const DXVA2_VideoDesc *video_desc) +{ + return video_desc->Format == D3DFMT_A8R8G8B8 || + video_desc->Format == D3DFMT_X8R8G8B8 || + video_desc->Format == D3DFMT_YUY2 || + video_desc->Format == MAKEFOURCC('A','Y','U','V'); +} + static HRESULT WINAPI device_manager_processor_service_GetVideoProcessorDeviceGuids( IDirectXVideoProcessorService *iface, const DXVA2_VideoDesc *video_desc, UINT *count, GUID **guids) { @@ -399,9 +407,7 @@ static HRESULT WINAPI device_manager_processor_service_GetVideoProcessorRenderTa if (IsEqualGUID(deviceguid, &DXVA2_VideoProcSoftwareDevice)) { - if (!(video_desc->Format == D3DFMT_A8R8G8B8 || - video_desc->Format == D3DFMT_X8R8G8B8 || - video_desc->Format == D3DFMT_YUY2)) + if (!dxva_is_supported_stream_format(video_desc)) { WARN("Unsupported content format %#x.\n", video_desc->Format); return E_FAIL; diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c index 1de1712d163..f785b2ce147 100644 --- a/dlls/dxva2/tests/dxva2.c +++ b/dlls/dxva2/tests/dxva2.c @@ -111,6 +111,7 @@ static void test_device_manager(void) D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8, D3DFMT_YUY2, + MAKEFOURCC('A','Y','U','V'), }; static const D3DFORMAT rt_unsupported_formats[] = { @@ -353,6 +354,12 @@ static void test_device_manager(void) { init_video_desc(&video_desc, rt_formats[i]); + count = 0; + hr = IDirectXVideoProcessorService_GetVideoProcessorDeviceGuids(proc_service, &video_desc, &count, &guids); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(count > 0, "Unexpected device count.\n"); + CoTaskMemFree(guids); + count = 0; hr = IDirectXVideoProcessorService_GetVideoProcessorRenderTargets(proc_service, &DXVA2_VideoProcSoftwareDevice, &video_desc, &count, &formats); @@ -371,6 +378,10 @@ static void test_device_manager(void) hr = IDirectXVideoProcessorService_GetVideoProcessorRenderTargets(proc_service, &DXVA2_VideoProcSoftwareDevice, &video_desc, &count, &formats); ok(hr == E_FAIL, "Unexpected hr %#x, format %d.\n", hr, rt_unsupported_formats[i]); + + hr = IDirectXVideoProcessorService_GetVideoProcessorDeviceGuids(proc_service, &video_desc, &count, &guids); + todo_wine + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); } IDirectXVideoProcessorService_Release(proc_service);