From 0289b9c23a6998369d6a04dd1c88d3427aec9777 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 11 Apr 2022 11:23:12 +0300 Subject: [PATCH] evr/mixer: Implement GetAvailableVideoProcessorModes(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/evr/mixer.c | 22 ++++++++++++++++++++-- dlls/evr/tests/evr.c | 16 ++++++++-------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index 0b957e7b6bd..c7e3033f2d1 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -1930,9 +1930,27 @@ static ULONG WINAPI video_mixer_processor_Release(IMFVideoProcessor *iface) static HRESULT WINAPI video_mixer_processor_GetAvailableVideoProcessorModes(IMFVideoProcessor *iface, UINT *count, GUID **modes) { - FIXME("%p, %p, %p.\n", iface, count, modes); + struct video_mixer *mixer = impl_from_IMFVideoProcessor(iface); + IDirectXVideoProcessorService *service; + DXVA2_VideoDesc video_desc; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %p, %p.\n", iface, count, modes); + + EnterCriticalSection(&mixer->cs); + + if (!mixer->inputs[0].media_type || !mixer->output.media_type) + hr = MF_E_TRANSFORM_TYPE_NOT_SET; + else if (SUCCEEDED(hr = video_mixer_get_processor_service(mixer, &service))) + { + video_mixer_init_dxva_videodesc(mixer->inputs[0].media_type, &video_desc); + hr = IDirectXVideoProcessorService_GetVideoProcessorDeviceGuids(service, &video_desc, count, modes); + IDirectXVideoProcessorService_Release(service); + } + + LeaveCriticalSection(&mixer->cs); + + return hr; } static HRESULT WINAPI video_mixer_processor_GetVideoProcessorCaps(IMFVideoProcessor *iface, GUID *mode, diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index ea67ff5b584..bd280836046 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -654,7 +654,6 @@ static void test_default_mixer(void) ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); hr = IMFVideoProcessor_GetAvailableVideoProcessorModes(processor, &count, &guids); - todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); IMFVideoProcessor_Release(processor); @@ -1071,6 +1070,9 @@ static void test_default_mixer_type_negotiation(void) hr = MFCreateVideoMixer(NULL, &IID_IDirect3DDevice9, &IID_IMFTransform, (void **)&transform); ok(hr == S_OK, "Failed to create default mixer, hr %#lx.\n", hr); + hr = IMFTransform_QueryInterface(transform, &IID_IMFVideoProcessor, (void **)&processor); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_GetInputAvailableType(transform, 0, 0, &media_type); ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr); @@ -1095,6 +1097,9 @@ static void test_default_mixer_type_negotiation(void) hr = IMFTransform_SetInputType(transform, 0, media_type, MFT_SET_TYPE_TEST_ONLY); ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoProcessor_GetAvailableVideoProcessorModes(processor, &count, &guids); + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); + /* Now try with device manager. */ window = create_window(); @@ -1282,9 +1287,6 @@ static void test_default_mixer_type_negotiation(void) IMFMediaType_Release(media_type2); IMFMediaType_Release(media_type); - hr = IMFTransform_QueryInterface(transform, &IID_IMFVideoProcessor, (void **)&processor); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFVideoProcessor_GetVideoProcessorMode(processor, &guid); todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); @@ -1302,7 +1304,6 @@ static void test_default_mixer_type_negotiation(void) IMFMediaType_Release(media_type); hr = IMFVideoProcessor_GetAvailableVideoProcessorModes(processor, &count, &guids); - todo_wine ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#lx.\n", hr); hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); @@ -1319,10 +1320,9 @@ static void test_default_mixer_type_negotiation(void) ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr); hr = IMFVideoProcessor_GetAvailableVideoProcessorModes(processor, &count, &guids); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (SUCCEEDED(hr)) - CoTaskMemFree(guids); + ok(count > 0 && !!guids, "Unexpected modes data.\n"); + CoTaskMemFree(guids); hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type2); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);