[PATCH 4/5] evr/mixer: Keep one input sample per stream.

Nikolay Sivov nsivov at codeweavers.com
Mon Oct 19 09:10:42 CDT 2020


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

diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c
index 9969c8187db..b93510c991e 100644
--- a/dlls/evr/mixer.c
+++ b/dlls/evr/mixer.c
@@ -43,6 +43,7 @@ struct input_stream
     IMFMediaType *media_type;
     MFVideoNormalizedRect rect;
     unsigned int zorder;
+    IMFSample *sample;
 };
 
 struct output_stream
@@ -172,6 +173,9 @@ static void video_mixer_clear_types(struct video_mixer *mixer)
         if (mixer->inputs[i].media_type)
             IMFMediaType_Release(mixer->inputs[i].media_type);
         mixer->inputs[i].media_type = NULL;
+        if (mixer->inputs[i].sample)
+            IMFSample_Release(mixer->inputs[i].sample);
+        mixer->inputs[i].sample = NULL;
     }
     for (i = 0; i < mixer->output.type_count; ++i)
     {
@@ -899,9 +903,33 @@ static HRESULT WINAPI video_mixer_transform_ProcessMessage(IMFTransform *iface,
 
 static HRESULT WINAPI video_mixer_transform_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags)
 {
-    FIXME("%p, %u, %p, %#x.\n", iface, id, sample, flags);
+    struct video_mixer *mixer = impl_from_IMFTransform(iface);
+    struct input_stream *input;
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    TRACE("%p, %u, %p, %#x.\n", iface, id, sample, flags);
+
+    if (!sample)
+        return E_POINTER;
+
+    EnterCriticalSection(&mixer->cs);
+
+    if (SUCCEEDED(hr = video_mixer_get_input(mixer, id, &input)))
+    {
+        if (!input->media_type || !mixer->output.media_type)
+            hr = MF_E_TRANSFORM_TYPE_NOT_SET;
+        else if (input->sample)
+            hr = MF_E_NOTACCEPTING;
+        else
+        {
+            input->sample = sample;
+            IMFSample_AddRef(input->sample);
+        }
+    }
+
+    LeaveCriticalSection(&mixer->cs);
+
+    return hr;
 }
 
 static HRESULT WINAPI video_mixer_transform_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 9124109c07f..182280d0a39 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -2154,6 +2154,23 @@ todo_wine
 todo_wine
     ok(!color, "Unexpected color %#x.\n", color);
 
+    IMFDesiredSample_Clear(desired);
+
+    hr = IMFTransform_ProcessInput(mixer, 0, NULL, 0);
+    ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
+
+    hr = IMFTransform_ProcessInput(mixer, 5, NULL, 0);
+    ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
+
+    hr = IMFTransform_ProcessInput(mixer, 0, sample, 0);
+    ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+
+    hr = IMFTransform_ProcessInput(mixer, 0, sample, 0);
+    ok(hr == MF_E_NOTACCEPTING, "Unexpected hr %#x.\n", hr);
+
+    hr = IMFTransform_ProcessInput(mixer, 5, sample, 0);
+    ok(hr == MF_E_INVALIDSTREAMNUMBER, "Unexpected hr %#x.\n", hr);
+
     IMFSample_Release(sample);
 
     IDirect3DSurface9_Release(surface);
-- 
2.28.0




More information about the wine-devel mailing list