evr/presenter: Initialize aspect ratio mode.

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-07 11:40:22 +03:00 committed by Alexandre Julliard
parent 59f3337a39
commit 6163b3331f
3 changed files with 65 additions and 4 deletions

View File

@ -64,6 +64,7 @@ struct video_presenter
DWORD rendering_prefs;
SIZE native_size;
SIZE native_ratio;
unsigned int ar_mode;
unsigned int state;
CRITICAL_SECTION cs;
};
@ -669,16 +670,34 @@ static HRESULT WINAPI video_presenter_control_GetVideoPosition(IMFVideoDisplayCo
static HRESULT WINAPI video_presenter_control_SetAspectRatioMode(IMFVideoDisplayControl *iface, DWORD mode)
{
FIXME("%p, %d.\n", iface, mode);
struct video_presenter *presenter = impl_from_IMFVideoDisplayControl(iface);
return E_NOTIMPL;
TRACE("%p, %#x.\n", iface, mode);
if (mode & ~MFVideoARMode_Mask)
return E_INVALIDARG;
EnterCriticalSection(&presenter->cs);
presenter->ar_mode = mode;
LeaveCriticalSection(&presenter->cs);
return S_OK;
}
static HRESULT WINAPI video_presenter_control_GetAspectRatioMode(IMFVideoDisplayControl *iface, DWORD *mode)
{
FIXME("%p, %p.\n", iface, mode);
struct video_presenter *presenter = impl_from_IMFVideoDisplayControl(iface);
return E_NOTIMPL;
TRACE("%p, %p.\n", iface, mode);
if (!mode)
return E_POINTER;
EnterCriticalSection(&presenter->cs);
*mode = presenter->ar_mode;
LeaveCriticalSection(&presenter->cs);
return S_OK;
}
static HRESULT WINAPI video_presenter_control_SetVideoWindow(IMFVideoDisplayControl *iface, HWND window)
@ -969,6 +988,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
object->outer_unk = outer ? outer : &object->IUnknown_inner;
object->refcount = 1;
object->src_rect.right = object->src_rect.bottom = 1.0f;
object->ar_mode = MFVideoARMode_PreservePicture | MFVideoARMode_PreservePixel;
InitializeCriticalSection(&object->cs);
if (FAILED(hr = DXVA2CreateDirect3DDeviceManager9(&object->reset_token, &object->device_manager)))

View File

@ -1654,6 +1654,37 @@ static void test_presenter_native_video_size(void)
IMFTransform_Release(mixer);
}
static void test_presenter_ar_mode(void)
{
IMFVideoDisplayControl *display_control;
HRESULT hr;
DWORD mode;
hr = MFCreateVideoPresenter(NULL, &IID_IDirect3DDevice9, &IID_IMFVideoDisplayControl, (void **)&display_control);
ok(hr == S_OK, "Failed to create default presenter, hr %#x.\n", hr);
hr = IMFVideoDisplayControl_GetAspectRatioMode(display_control, NULL);
ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
mode = 0;
hr = IMFVideoDisplayControl_GetAspectRatioMode(display_control, &mode);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(mode == (MFVideoARMode_PreservePicture | MFVideoARMode_PreservePixel), "Unexpected mode %#x.\n", mode);
hr = IMFVideoDisplayControl_SetAspectRatioMode(display_control, 0x100);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMFVideoDisplayControl_SetAspectRatioMode(display_control, MFVideoARMode_Mask);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
mode = 0;
hr = IMFVideoDisplayControl_GetAspectRatioMode(display_control, &mode);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(mode == MFVideoARMode_Mask, "Unexpected mode %#x.\n", mode);
IMFVideoDisplayControl_Release(display_control);
}
static void test_mixer_output_rectangle(void)
{
IMFVideoMixerControl *mixer_control;
@ -1836,6 +1867,7 @@ START_TEST(evr)
test_MFCreateVideoSampleAllocator();
test_presenter_video_position();
test_presenter_native_video_size();
test_presenter_ar_mode();
test_mixer_output_rectangle();
test_mixer_zorder();

View File

@ -228,6 +228,15 @@ interface IMFDesiredSample : IUnknown
void Clear();
}
typedef enum MFVideoAspectRatioMode
{
MFVideoARMode_None = 0x00000000,
MFVideoARMode_PreservePicture = 0x00000001,
MFVideoARMode_PreservePixel = 0x00000002,
MFVideoARMode_NonLinearStretch = 0x00000004,
MFVideoARMode_Mask = 0x00000007,
} MFVideoAspectRatioMode;
[
object,
uuid(a490b1e4-ab84-4d31-a1b2-181e03b1077a),