From 7980d049e8e785a92631a74b0153eb716dd40ca8 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 26 Oct 2021 19:58:31 +0300 Subject: [PATCH] evr/presenter: Invalidate media type on destination rectangle change. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/evr/presenter.c | 8 +++++++- dlls/evr/tests/evr.c | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index b8b18638185..5b262e7c663 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -1295,8 +1295,14 @@ static HRESULT WINAPI video_presenter_control_SetVideoPosition(IMFVideoDisplayCo video_presenter_set_mixer_rect(presenter); } } - if (dst_rect) + if (dst_rect && !EqualRect(dst_rect, &presenter->dst_rect)) + { presenter->dst_rect = *dst_rect; + hr = video_presenter_invalidate_media_type(presenter); + /* Mixer's input type hasn't been configured yet, this is not an error. */ + if (hr == MF_E_TRANSFORM_TYPE_NOT_SET) hr = S_OK; + /* FIXME: trigger repaint */ + } } LeaveCriticalSection(&presenter->cs); diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 01edda7bc9b..5bf03fa49f8 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -2190,9 +2190,6 @@ static void test_presenter_media_type(void) hr = IMFTransform_ProcessMessage(mixer, MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)manager); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - hr = IMFTransform_SetInputType(mixer, 0, input_type, 0); - ok(hr == S_OK, "Unexpected hr %#x.\n", hr); - hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); @@ -2204,12 +2201,20 @@ static void test_presenter_media_type(void) hr = IMFVideoDisplayControl_SetVideoWindow(display_control, window); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + /* Set destination rectangle before mixer types are configured. */ + SetRect(&dst, 0, 0, 101, 51); + hr = IMFVideoDisplayControl_SetVideoPosition(display_control, NULL, &dst); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFTransform_SetInputType(mixer, 0, input_type, 0); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_INVALIDATEMEDIATYPE, 0); ok(hr == S_OK, "Unexpected hr %#x.\n", hr); get_output_aperture(mixer, &frame_size, &aperture); - ok(frame_size.cx == 100 && frame_size.cy == 50, "Unexpected frame size %u x %u.\n", frame_size.cx, frame_size.cy); - ok(aperture.Area.cx == 100 && aperture.Area.cy == 50, "Unexpected size %u x %u.\n", aperture.Area.cx, aperture.Area.cy); + ok(frame_size.cx == 101 && frame_size.cy == 51, "Unexpected frame size %u x %u.\n", frame_size.cx, frame_size.cy); + ok(aperture.Area.cx == 101 && aperture.Area.cy == 51, "Unexpected size %u x %u.\n", aperture.Area.cx, aperture.Area.cy); ok(!aperture.OffsetX.value && !aperture.OffsetX.fract && !aperture.OffsetY.value && !aperture.OffsetY.fract, "Unexpected offset %u x %u.\n", aperture.OffsetX.value, aperture.OffsetY.value); @@ -2218,10 +2223,8 @@ static void test_presenter_media_type(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); get_output_aperture(mixer, &frame_size, &aperture); -todo_wine { ok(frame_size.cx == 199 && frame_size.cy == 298, "Unexpected frame size %u x %u.\n", frame_size.cx, frame_size.cy); ok(aperture.Area.cx == 199 && aperture.Area.cy == 298, "Unexpected size %u x %u.\n", aperture.Area.cx, aperture.Area.cy); -} ok(!aperture.OffsetX.value && !aperture.OffsetX.fract && !aperture.OffsetY.value && !aperture.OffsetY.fract, "Unexpected offset %u x %u.\n", aperture.OffsetX.value, aperture.OffsetY.value); @@ -2229,10 +2232,8 @@ todo_wine { ok(hr == S_OK, "Unexpected hr %#x.\n", hr); get_output_aperture(mixer, &frame_size, &aperture); -todo_wine { ok(frame_size.cx == 199 && frame_size.cy == 298, "Unexpected frame size %u x %u.\n", frame_size.cx, frame_size.cy); ok(aperture.Area.cx == 199 && aperture.Area.cy == 298, "Unexpected size %u x %u.\n", aperture.Area.cx, aperture.Area.cy); -} ok(!aperture.OffsetX.value && !aperture.OffsetX.fract && !aperture.OffsetY.value && !aperture.OffsetY.fract, "Unexpected offset %u x %u.\n", aperture.OffsetX.value, aperture.OffsetY.value); -- 2.11.4.GIT