mfplay: Update destination rectangle on SetVideoSourceRect().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-10-25 13:04:18 +03:00 committed by Alexandre Julliard
parent 98a91c2c25
commit 848f2a4be0
2 changed files with 48 additions and 2 deletions

View File

@ -1373,13 +1373,16 @@ static HRESULT WINAPI media_player_SetVideoSourceRect(IMFPMediaPlayer *iface,
{
struct media_player *player = impl_from_IMFPMediaPlayer(iface);
IMFVideoDisplayControl *display_control;
RECT dst_rect;
HRESULT hr;
TRACE("%p, %p.\n", iface, rect);
if (SUCCEEDED(hr = media_player_get_display_control(player, &display_control)))
if (!GetClientRect(player->output_window, &dst_rect))
hr = HRESULT_FROM_WIN32(GetLastError());
else if (SUCCEEDED(hr = media_player_get_display_control(player, &display_control)))
{
hr = IMFVideoDisplayControl_SetVideoPosition(display_control, rect, NULL);
hr = IMFVideoDisplayControl_SetVideoPosition(display_control, rect, &dst_rect);
IMFVideoDisplayControl_Release(display_control);
}

View File

@ -261,6 +261,49 @@ static void test_video_control(void)
hr = IMFPMediaPlayer_SetVideoSourceRect(player, &rect);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_SetVideoSourceRect(player, NULL);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_SetBorderColor(player, 0);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_SetAspectRatioMode(player, MFVideoARMode_None);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetVideoSourceRect(player, &rect);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetBorderColor(player, &color);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetAspectRatioMode(player, &mode);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetIdealVideoSize(player, &size, &size);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_GetNativeVideoSize(player, &size, &size);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_UpdateVideo(player);
todo_wine
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);
IMFPMediaPlayer_Release(player);
/* No active media item, no output window.*/
hr = MFPCreateMediaPlayer(NULL, FALSE, 0, NULL, NULL, &player);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
rect.left = rect.top = 0.0f;
rect.right = rect.bottom = 1.0f;
hr = IMFPMediaPlayer_SetVideoSourceRect(player, &rect);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_WINDOW_HANDLE), "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_SetVideoSourceRect(player, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_WINDOW_HANDLE), "Unexpected hr %#x.\n", hr);
hr = IMFPMediaPlayer_SetBorderColor(player, 0);
ok(hr == MF_E_INVALIDREQUEST, "Unexpected hr %#x.\n", hr);