From d63ff3403b323cf03522ca0a41b29446f6f11b98 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 22 Oct 2020 14:02:45 +0300 Subject: [PATCH] evr/mixer: Implement GetOutputStatus(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/evr/mixer.c | 32 +++++++++++++++++++++++++++++--- dlls/evr/tests/evr.c | 20 ++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index b87b621835e..2c2fda51cd1 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -934,11 +934,37 @@ static HRESULT WINAPI video_mixer_transform_GetInputStatus(IMFTransform *iface, return hr; } -static HRESULT WINAPI video_mixer_transform_GetOutputStatus(IMFTransform *iface, DWORD *flags) +static HRESULT WINAPI video_mixer_transform_GetOutputStatus(IMFTransform *iface, DWORD *status) { - FIXME("%p, %p.\n", iface, flags); + struct video_mixer *mixer = impl_from_IMFTransform(iface); + HRESULT hr = S_OK; + unsigned int i; - return E_NOTIMPL; + TRACE("%p, %p.\n", iface, status); + + if (!status) + return E_POINTER; + + EnterCriticalSection(&mixer->cs); + + if (!mixer->output.media_type) + hr = MF_E_TRANSFORM_TYPE_NOT_SET; + else + { + *status = MFT_OUTPUT_STATUS_SAMPLE_READY; + for (i = 0; i < mixer->input_count; ++i) + { + if (!mixer->inputs[i].sample) + { + *status = 0; + break; + } + } + } + + LeaveCriticalSection(&mixer->cs); + + return hr; } static HRESULT WINAPI video_mixer_transform_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper) diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 776f61bbbe7..7cf127d4d8c 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -2098,6 +2098,12 @@ static void test_mixer_samples(void) hr = IMFTransform_GetInputStatus(mixer, 1, &status); ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr); + hr = IMFTransform_GetOutputStatus(mixer, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_GetOutputStatus(mixer, &status); + ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr); + /* Configure device and media types. */ hr = DXVA2CreateDirect3DDeviceManager9(&token, &manager); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); @@ -2132,6 +2138,11 @@ static void test_mixer_samples(void) hr = IMFTransform_GetInputStatus(mixer, 1, &status); ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr); + status = ~0u; + hr = IMFTransform_GetOutputStatus(mixer, &status); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!status, "Unexpected status %#x.\n", status); + IMFMediaType_Release(video_type); memset(&buffer, 0, sizeof(buffer)); @@ -2190,6 +2201,11 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(status == MFT_INPUT_STATUS_ACCEPT_DATA, "Unexpected status %#x.\n", status); + status = ~0u; + hr = IMFTransform_GetOutputStatus(mixer, &status); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(!status, "Unexpected status %#x.\n", status); + hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); @@ -2198,6 +2214,10 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(!status, "Unexpected status %#x.\n", status); + hr = IMFTransform_GetOutputStatus(mixer, &status); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(status == MFT_OUTPUT_STATUS_SAMPLE_READY, "Unexpected status %#x.\n", status); + hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); ok(hr == MF_E_NOTACCEPTING, "Unexpected hr %#x.\n", hr);