evr/presenter: Set VIDEO_ZOOM_RECT on SetVideoPosition().

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-05 15:26:44 +03:00 committed by Alexandre Julliard
parent f859a4d048
commit 94b2db85b6
2 changed files with 29 additions and 6 deletions

View File

@ -357,6 +357,25 @@ static ULONG WINAPI video_presenter_service_client_Release(IMFTopologyServiceLoo
return IMFVideoPresenter_Release(&presenter->IMFVideoPresenter_iface);
}
static void video_presenter_set_mixer_rect(struct video_presenter *presenter)
{
IMFAttributes *attributes;
HRESULT hr;
if (!presenter->mixer)
return;
if (SUCCEEDED(IMFTransform_GetAttributes(presenter->mixer, &attributes)))
{
if (FAILED(hr = IMFAttributes_SetBlob(attributes, &VIDEO_ZOOM_RECT, (const UINT8 *)&presenter->src_rect,
sizeof(presenter->src_rect))))
{
WARN("Failed to set zoom rectangle attribute, hr %#x.\n", hr);
}
IMFAttributes_Release(attributes);
}
}
static HRESULT video_presenter_attach_mixer(struct video_presenter *presenter, IMFTopologyServiceLookup *service_lookup)
{
IMFVideoDeviceID *device_id;
@ -389,6 +408,8 @@ static HRESULT video_presenter_attach_mixer(struct video_presenter *presenter, I
presenter->mixer = NULL;
}
video_presenter_set_mixer_rect(presenter);
return hr;
}
@ -528,7 +549,13 @@ static HRESULT WINAPI video_presenter_control_SetVideoPosition(IMFVideoDisplayCo
else
{
if (src_rect)
presenter->src_rect = *src_rect;
{
if (memcmp(&presenter->src_rect, src_rect, sizeof(*src_rect)))
{
presenter->src_rect = *src_rect;
video_presenter_set_mixer_rect(presenter);
}
}
if (dst_rect)
presenter->dst_rect = *dst_rect;
}

View File

@ -1414,16 +1414,13 @@ static void test_presenter_video_position(void)
hr = IMFAttributes_GetCount(mixer_attributes, &count);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
todo_wine
ok(count == 1, "Unexpected count %u.\n", count);
memset(&src_rect, 0, sizeof(src_rect));
hr = IMFAttributes_GetBlob(mixer_attributes, &VIDEO_ZOOM_RECT, (UINT8 *)&src_rect, sizeof(src_rect), NULL);
todo_wine {
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(src_rect.left == 0.0f && src_rect.top == 0.0f && src_rect.right == 1.0f &&
src_rect.bottom == 1.0f, "Unexpected source rectangle.\n");
}
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@ -1505,11 +1502,10 @@ todo_wine {
/* Presenter updates mixer attribute. */
memset(&src_rect, 0, sizeof(src_rect));
hr = IMFAttributes_GetBlob(mixer_attributes, &VIDEO_ZOOM_RECT, (UINT8 *)&src_rect, sizeof(src_rect), NULL);
todo_wine {
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(src_rect.left == 0.1f && src_rect.top == 0.2f && src_rect.right == 0.8f &&
src_rect.bottom == 0.9f, "Unexpected source rectangle.\n");
}
hr = IMFVideoDisplayControl_GetVideoPosition(display_control, &src_rect, &dst_rect);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(src_rect.left == 0.1f && src_rect.top == 0.2f && src_rect.right == 0.8f &&