evr/mixer: Implement SetOutputType().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-10-12 14:17:28 +03:00 committed by Alexandre Julliard
parent 11594f563f
commit b8e003c0e0
2 changed files with 45 additions and 4 deletions

View File

@ -738,9 +738,43 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW
static HRESULT WINAPI video_mixer_transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) static HRESULT WINAPI video_mixer_transform_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags)
{ {
FIXME("%p, %u, %p, %#x.\n", iface, id, type, flags); const unsigned int equality_flags = MF_MEDIATYPE_EQUAL_MAJOR_TYPES |
MF_MEDIATYPE_EQUAL_FORMAT_TYPES | MF_MEDIATYPE_EQUAL_FORMAT_DATA;
struct video_mixer *mixer = impl_from_IMFTransform(iface);
HRESULT hr = MF_E_INVALIDMEDIATYPE;
unsigned int i, compare_flags;
return E_NOTIMPL; TRACE("%p, %u, %p, %#x.\n", iface, id, type, flags);
if (id)
return MF_E_INVALIDSTREAMNUMBER;
EnterCriticalSection(&mixer->cs);
for (i = 0; i < mixer->output.type_count; ++i)
{
compare_flags = 0;
if (FAILED(IMFMediaType_IsEqual(type, mixer->output.media_types[i], &compare_flags)))
continue;
if ((compare_flags & equality_flags) == equality_flags)
{
hr = S_OK;
break;
}
}
if (SUCCEEDED(hr) && !(flags & MFT_SET_TYPE_TEST_ONLY))
{
if (mixer->output.media_type)
IMFMediaType_Release(mixer->output.media_type);
mixer->output.media_type = type;
IMFMediaType_AddRef(mixer->output.media_type);
}
LeaveCriticalSection(&mixer->cs);
return hr;
} }
static HRESULT WINAPI video_mixer_transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) static HRESULT WINAPI video_mixer_transform_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type)

View File

@ -958,10 +958,11 @@ todo_wine
hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type); hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_SetOutputType(transform, 1, media_type, 0);
ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_SetOutputType(transform, 0, media_type, 0); hr = IMFTransform_SetOutputType(transform, 0, media_type, 0);
todo_wine
ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IMFMediaType_Release(media_type);
hr = IMFVideoProcessor_GetVideoProcessorMode(processor, &guid); hr = IMFVideoProcessor_GetVideoProcessorMode(processor, &guid);
todo_wine todo_wine
@ -973,6 +974,12 @@ todo_wine
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
CoTaskMemFree(guids); CoTaskMemFree(guids);
hr = IMFTransform_GetOutputCurrentType(transform, 0, &media_type2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(media_type == media_type2, "Unexpected media type instance.\n");
IMFMediaType_Release(media_type2);
IMFMediaType_Release(media_type);
IMFVideoProcessor_Release(processor); IMFVideoProcessor_Release(processor);
IMFVideoMediaType_Release(video_type); IMFVideoMediaType_Release(video_type);