evr/mixer: Add support for MFT_SET_TYPE_TEST_ONLY for inputs.

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-09 13:54:39 +03:00 committed by Alexandre Julliard
parent 430c179fe8
commit 24c9d77cee
2 changed files with 19 additions and 5 deletions

View File

@ -611,12 +611,12 @@ static int rt_formats_sort_compare(const void *left, const void *right)
}
static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const DXVA2_VideoDesc *video_desc,
IDirectXVideoProcessorService *service, unsigned int device_count, const GUID *devices)
IDirectXVideoProcessorService *service, unsigned int device_count, const GUID *devices, unsigned int flags)
{
unsigned int i, j, format_count, count;
D3DFORMAT *rt_formats = NULL, *formats, *ptr;
HRESULT hr = MF_E_INVALIDMEDIATYPE;
GUID subtype;
HRESULT hr;
count = 0;
for (i = 0; i < device_count; ++i)
@ -640,7 +640,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
}
}
if (count)
if (count && !(flags & MFT_SET_TYPE_TEST_ONLY))
{
qsort(rt_formats, count, sizeof(*rt_formats), rt_formats_sort_compare);
@ -690,7 +690,8 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW
EnterCriticalSection(&mixer->cs);
video_mixer_clear_types(mixer);
if (!(flags & MFT_SET_TYPE_TEST_ONLY))
video_mixer_clear_types(mixer);
if (!mixer->device_manager)
hr = MF_E_NOT_INITIALIZED;
@ -708,7 +709,8 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW
if (SUCCEEDED(hr = IDirectXVideoProcessorService_GetVideoProcessorDeviceGuids(service, &video_desc,
&count, &guids)))
{
if (SUCCEEDED(hr = video_mixer_collect_output_types(mixer, &video_desc, service, count, guids)))
if (SUCCEEDED(hr = video_mixer_collect_output_types(mixer, &video_desc, service, count,
guids, flags)) && !(flags & MFT_SET_TYPE_TEST_ONLY))
{
GUID subtype = { 0 };

View File

@ -862,6 +862,9 @@ static void test_default_mixer_type_negotiation(void)
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_SetInputType(transform, 0, media_type, MFT_SET_TYPE_TEST_ONLY);
ok(hr == MF_E_NOT_INITIALIZED, "Unexpected hr %#x.\n", hr);
/* Now try with device manager. */
window = create_window();
@ -883,6 +886,9 @@ static void test_default_mixer_type_negotiation(void)
hr = IMFTransform_SetInputType(transform, 0, media_type, 0);
ok(hr == DXVA2_E_NOT_INITIALIZED, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_SetInputType(transform, 0, media_type, MFT_SET_TYPE_TEST_ONLY);
ok(hr == DXVA2_E_NOT_INITIALIZED, "Unexpected hr %#x.\n", hr);
hr = IDirect3DDeviceManager9_ResetDevice(manager, device, token);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@ -904,6 +910,12 @@ static void test_default_mixer_type_negotiation(void)
hr = IMFVideoMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_SetInputType(transform, 0, (IMFMediaType *)video_type, MFT_SET_TYPE_TEST_ONLY);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_GetInputCurrentType(transform, 0, &media_type);
ok(hr == MF_E_TRANSFORM_TYPE_NOT_SET, "Unexpected hr %#x.\n", hr);
hr = IMFTransform_SetInputType(transform, 0, (IMFMediaType *)video_type, 0);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);