From fd0d79c624afa66e4b4a71434797ffbc106a7649 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 21 Apr 2021 12:29:45 +0300 Subject: [PATCH] mfplay: Forward GetNativeVideoSize() to the session. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfplay/Makefile.in | 2 +- dlls/mfplay/player.c | 15 +++++++++++++-- dlls/mfplay/tests/mfplay.c | 4 ++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/dlls/mfplay/Makefile.in b/dlls/mfplay/Makefile.in index 8cd572bf638..303226f57f6 100644 --- a/dlls/mfplay/Makefile.in +++ b/dlls/mfplay/Makefile.in @@ -1,6 +1,6 @@ MODULE = mfplay.dll IMPORTLIB = mfplay -IMPORTS = mfplat mf ole32 user32 uuid mfuuid +IMPORTS = mfplat mf ole32 user32 uuid mfuuid strmiids EXTRADLLFLAGS = -mno-cygwin -Wb,--prefer-native diff --git a/dlls/mfplay/player.c b/dlls/mfplay/player.c index 831e9fa9781..80c88721c78 100644 --- a/dlls/mfplay/player.c +++ b/dlls/mfplay/player.c @@ -1251,9 +1251,20 @@ static HRESULT WINAPI media_player_GetNativeVideoSize(IMFPMediaPlayer *iface, static HRESULT WINAPI media_player_GetIdealVideoSize(IMFPMediaPlayer *iface, SIZE *min_size, SIZE *max_size) { - FIXME("%p, %p, %p.\n", iface, min_size, max_size); + struct media_player *player = impl_from_IMFPMediaPlayer(iface); + IMFVideoDisplayControl *display_control; + HRESULT hr; - return E_NOTIMPL; + TRACE("%p, %p, %p.\n", iface, min_size, max_size); + + if (SUCCEEDED(hr = MFGetService((IUnknown *)player->session, &MR_VIDEO_RENDER_SERVICE, + &IID_IMFVideoDisplayControl, (void **)&display_control))) + { + hr = IMFVideoDisplayControl_GetIdealVideoSize(display_control, min_size, max_size); + IMFVideoDisplayControl_Release(display_control); + } + + return hr; } static HRESULT WINAPI media_player_SetVideoSourceRect(IMFPMediaPlayer *iface, diff --git a/dlls/mfplay/tests/mfplay.c b/dlls/mfplay/tests/mfplay.c index 64a48cceaca..f11973ef939 100644 --- a/dlls/mfplay/tests/mfplay.c +++ b/dlls/mfplay/tests/mfplay.c @@ -122,6 +122,7 @@ static void test_create_player(void) static void test_shutdown(void) { + SIZE min_size, max_size; IMFPMediaPlayer *player; float slowest, fastest; HRESULT hr; @@ -156,6 +157,9 @@ static void test_shutdown(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); ok(state == MFP_MEDIAPLAYER_STATE_SHUTDOWN, "Unexpected state %d.\n", state); + hr = IMFPMediaPlayer_GetIdealVideoSize(player, &min_size, &max_size); + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + hr = IMFPMediaPlayer_CreateMediaItemFromURL(player, L"url", TRUE, 0, &item); ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);