[PATCH 4/5] evr/mixer: Add support for MFT_SET_TYPE_TEST_ONLY for inputs.

Nikolay Sivov nsivov at codeweavers.com
Fri Oct 9 05:54:39 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/evr/mixer.c     | 12 +++++++-----
 dlls/evr/tests/evr.c | 12 ++++++++++++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c
index 107438b1f17..54da3a9ce1c 100644
--- a/dlls/evr/mixer.c
+++ b/dlls/evr/mixer.c
@@ -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 };
 
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 7ad011d2a09..175c30e8188 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -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);
 
-- 
2.28.0




More information about the wine-devel mailing list