Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/mixer.c | 28 +++++++++++++++++++++++----- dlls/evr/tests/evr.c | 24 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index d92bb6c1704..d9f86a7fc91 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -70,11 +70,9 @@ struct video_mixer struct output_stream output;
COLORREF bkgnd_color; - IDirect3DDeviceManager9 *device_manager; - IMediaEventSink *event_sink; - + IMFAttributes *attributes; CRITICAL_SECTION cs; };
@@ -246,6 +244,8 @@ static ULONG WINAPI video_mixer_inner_Release(IUnknown *iface) video_mixer_clear_types(mixer); if (mixer->device_manager) IDirect3DDeviceManager9_Release(mixer->device_manager); + if (mixer->attributes) + IMFAttributes_Release(mixer->attributes); DeleteCriticalSection(&mixer->cs); free(mixer); } @@ -360,9 +360,17 @@ static HRESULT WINAPI video_mixer_transform_GetOutputStreamInfo(IMFTransform *if
static HRESULT WINAPI video_mixer_transform_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) { - FIXME("%p, %p.\n", iface, attributes); + struct video_mixer *mixer = impl_from_IMFTransform(iface);
- return E_NOTIMPL; + TRACE("%p, %p.\n", iface, attributes); + + if (!attributes) + return E_POINTER; + + *attributes = mixer->attributes; + IMFAttributes_AddRef(*attributes); + + return S_OK; }
static HRESULT WINAPI video_mixer_transform_GetInputStreamAttributes(IMFTransform *iface, DWORD id, @@ -1317,6 +1325,8 @@ HRESULT WINAPI MFCreateVideoMixer(IUnknown *owner, REFIID riid_device, REFIID ri HRESULT evr_mixer_create(IUnknown *outer, void **out) { struct video_mixer *object; + MFVideoNormalizedRect rect; + HRESULT hr;
if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY; @@ -1335,6 +1345,14 @@ HRESULT evr_mixer_create(IUnknown *outer, void **out) object->input_count = 1; video_mixer_init_input(&object->inputs[0]); InitializeCriticalSection(&object->cs); + if (FAILED(hr = MFCreateAttributes(&object->attributes, 0))) + { + IUnknown_Release(&object->IUnknown_inner); + return hr; + } + rect.left = rect.top = 0.0f; + rect.right = rect.bottom = 1.0f; + IMFAttributes_SetBlob(object->attributes, &VIDEO_ZOOM_RECT, (const UINT8 *)&rect, sizeof(rect));
*out = &object->IUnknown_inner;
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 6a5d80df416..ba97eba53d1 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -419,6 +419,7 @@ static void test_default_mixer(void) DWORD input_count, output_count; IMFVideoProcessor *processor; IMFVideoDeviceID *deviceid; + MFVideoNormalizedRect rect; DWORD input_id, output_id; IMFTransform *transform; DXVA2_ValueRange range; @@ -508,6 +509,29 @@ todo_wine hr = IMFTransform_QueryInterface(transform, &IID_IMFVideoDeviceID, (void **)&deviceid); ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
+ hr = IMFTransform_GetAttributes(transform, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_GetAttributes(transform, &attributes); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_GetAttributes(transform, &attributes2); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(attributes == attributes2, "Unexpected attributes instance.\n"); + IMFAttributes_Release(attributes2); + + hr = IMFAttributes_GetCount(attributes, &count); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(count == 1, "Unexpected attribute count %u.\n", count); + + memset(&rect, 0, sizeof(rect)); + hr = IMFAttributes_GetBlob(attributes, &VIDEO_ZOOM_RECT, (UINT8 *)&rect, sizeof(rect), NULL); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(rect.left == 0.0f && rect.top == 0.0f && rect.right == 1.0f && rect.bottom == 1.0f, + "Unexpected zoom rect (%f, %f) - (%f, %f).\n", rect.left, rect.top, rect.right, rect.bottom); + + IMFAttributes_Release(attributes); + hr = IMFVideoDeviceID_GetDeviceID(deviceid, NULL); ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);