evr/mixer: Keep one input sample per stream.

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-19 17:10:42 +03:00 committed by Alexandre Julliard
parent 16430c45cd
commit 60bf1b2548
2 changed files with 47 additions and 2 deletions

View File

@ -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,

View File

@ -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);