From 16430c45cdbdc8fd20b10bd1e8d277cd4d154598 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 19 Oct 2020 17:10:41 +0300 Subject: [PATCH] dxva2: Add GetCreationParameters(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dxva2/main.c | 31 +++++++++++++++++++++++++------ dlls/dxva2/tests/dxva2.c | 6 ++---- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c index af6ad25697b..6262531c7d1 100644 --- a/dlls/dxva2/main.c +++ b/dlls/dxva2/main.c @@ -71,6 +71,10 @@ struct video_processor LONG refcount; IDirectXVideoProcessorService *service; + GUID device; + DXVA2_VideoDesc video_desc; + D3DFORMAT rt_format; + unsigned int max_substreams; }; static BOOL dxva_array_reserve(void **elements, size_t *capacity, size_t count, size_t size) @@ -170,14 +174,25 @@ static HRESULT WINAPI video_processor_GetVideoProcessorService(IDirectXVideoProc } static HRESULT WINAPI video_processor_GetCreationParameters(IDirectXVideoProcessor *iface, - GUID *device, DXVA2_VideoDesc *video_desc, D3DFORMAT *rt_format, UINT *maxstreams) + GUID *device, DXVA2_VideoDesc *video_desc, D3DFORMAT *rt_format, UINT *max_substreams) { - FIXME("%p, %p, %p, %p, %p.\n", iface, device, video_desc, rt_format, maxstreams); + struct video_processor *processor = impl_from_IDirectXVideoProcessor(iface); - if (!device && !video_desc && !rt_format && !maxstreams) + TRACE("%p, %p, %p, %p, %p.\n", iface, device, video_desc, rt_format, max_substreams); + + if (!device && !video_desc && !rt_format && !max_substreams) return E_INVALIDARG; - return E_NOTIMPL; + if (device) + *device = processor->device; + if (video_desc) + *video_desc = processor->video_desc; + if (rt_format) + *rt_format = processor->rt_format; + if (max_substreams) + *max_substreams = processor->max_substreams; + + return S_OK; } static HRESULT WINAPI video_processor_GetVideoProcessorCaps(IDirectXVideoProcessor *iface, @@ -376,12 +391,12 @@ static HRESULT WINAPI device_manager_processor_service_GetFilterPropertyRange( } static HRESULT WINAPI device_manager_processor_service_CreateVideoProcessor(IDirectXVideoProcessorService *iface, - REFGUID deviceguid, const DXVA2_VideoDesc *video_desc, D3DFORMAT rt_format, UINT max_substreams, + REFGUID device, const DXVA2_VideoDesc *video_desc, D3DFORMAT rt_format, UINT max_substreams, IDirectXVideoProcessor **processor) { struct video_processor *object; - FIXME("%p, %s, %p, %d, %u, %p.\n", iface, debugstr_guid(deviceguid), video_desc, rt_format, max_substreams, + FIXME("%p, %s, %p, %d, %u, %p.\n", iface, debugstr_guid(device), video_desc, rt_format, max_substreams, processor); /* FIXME: validate render target format */ @@ -393,6 +408,10 @@ static HRESULT WINAPI device_manager_processor_service_CreateVideoProcessor(IDir object->refcount = 1; object->service = iface; IDirectXVideoProcessorService_AddRef(object->service); + object->device = *device; + object->video_desc = *video_desc; + object->rt_format = rt_format; + object->max_substreams = max_substreams; *processor = &object->IDirectXVideoProcessor_iface; diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c index 84ccd3b0190..f617bf74079 100644 --- a/dlls/dxva2/tests/dxva2.c +++ b/dlls/dxva2/tests/dxva2.c @@ -420,15 +420,13 @@ static void test_video_processor(void) ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); hr = IDirectXVideoProcessor_GetCreationParameters(processor, &guid, NULL, NULL, NULL); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(IsEqualGUID(&guid, &DXVA2_VideoProcSoftwareDevice), "Unexpected device guid.\n"); -} + hr = IDirectXVideoProcessor_GetCreationParameters(processor, NULL, NULL, &format, NULL); -todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(format == D3DFMT_A8R8G8B8, "Unexpected format %u.\n", format); -} + IDirectXVideoProcessor_Release(processor); IDirectXVideoProcessor_Release(processor2);