Commit 6163b333 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

evr/presenter: Initialize aspect ratio mode.

parent 59f3337a
...@@ -64,6 +64,7 @@ struct video_presenter ...@@ -64,6 +64,7 @@ struct video_presenter
DWORD rendering_prefs; DWORD rendering_prefs;
SIZE native_size; SIZE native_size;
SIZE native_ratio; SIZE native_ratio;
unsigned int ar_mode;
unsigned int state; unsigned int state;
CRITICAL_SECTION cs; CRITICAL_SECTION cs;
}; };
...@@ -669,16 +670,34 @@ static HRESULT WINAPI video_presenter_control_GetVideoPosition(IMFVideoDisplayCo ...@@ -669,16 +670,34 @@ static HRESULT WINAPI video_presenter_control_GetVideoPosition(IMFVideoDisplayCo
static HRESULT WINAPI video_presenter_control_SetAspectRatioMode(IMFVideoDisplayControl *iface, DWORD mode) 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) 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) static HRESULT WINAPI video_presenter_control_SetVideoWindow(IMFVideoDisplayControl *iface, HWND window)
...@@ -969,6 +988,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out) ...@@ -969,6 +988,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
object->outer_unk = outer ? outer : &object->IUnknown_inner; object->outer_unk = outer ? outer : &object->IUnknown_inner;
object->refcount = 1; object->refcount = 1;
object->src_rect.right = object->src_rect.bottom = 1.0f; object->src_rect.right = object->src_rect.bottom = 1.0f;
object->ar_mode = MFVideoARMode_PreservePicture | MFVideoARMode_PreservePixel;
InitializeCriticalSection(&object->cs); InitializeCriticalSection(&object->cs);
if (FAILED(hr = DXVA2CreateDirect3DDeviceManager9(&object->reset_token, &object->device_manager))) if (FAILED(hr = DXVA2CreateDirect3DDeviceManager9(&object->reset_token, &object->device_manager)))
......
...@@ -1654,6 +1654,37 @@ static void test_presenter_native_video_size(void) ...@@ -1654,6 +1654,37 @@ static void test_presenter_native_video_size(void)
IMFTransform_Release(mixer); 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) static void test_mixer_output_rectangle(void)
{ {
IMFVideoMixerControl *mixer_control; IMFVideoMixerControl *mixer_control;
...@@ -1836,6 +1867,7 @@ START_TEST(evr) ...@@ -1836,6 +1867,7 @@ START_TEST(evr)
test_MFCreateVideoSampleAllocator(); test_MFCreateVideoSampleAllocator();
test_presenter_video_position(); test_presenter_video_position();
test_presenter_native_video_size(); test_presenter_native_video_size();
test_presenter_ar_mode();
test_mixer_output_rectangle(); test_mixer_output_rectangle();
test_mixer_zorder(); test_mixer_zorder();
......
...@@ -228,6 +228,15 @@ interface IMFDesiredSample : IUnknown ...@@ -228,6 +228,15 @@ interface IMFDesiredSample : IUnknown
void Clear(); void Clear();
} }
typedef enum MFVideoAspectRatioMode
{
MFVideoARMode_None = 0x00000000,
MFVideoARMode_PreservePicture = 0x00000001,
MFVideoARMode_PreservePixel = 0x00000002,
MFVideoARMode_NonLinearStretch = 0x00000004,
MFVideoARMode_Mask = 0x00000007,
} MFVideoAspectRatioMode;
[ [
object, object,
uuid(a490b1e4-ab84-4d31-a1b2-181e03b1077a), uuid(a490b1e4-ab84-4d31-a1b2-181e03b1077a),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment