evr/presenter: Add IDirect3DDeviceManager9 as a supported interface.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-11-17 13:41:38 +03:00 committed by Alexandre Julliard
parent fcb08263a5
commit 81ba626545
2 changed files with 108 additions and 1 deletions

View File

@ -68,6 +68,7 @@ struct video_presenter
IMFVideoPositionMapper IMFVideoPositionMapper_iface; IMFVideoPositionMapper IMFVideoPositionMapper_iface;
IQualProp IQualProp_iface; IQualProp IQualProp_iface;
IMFQualityAdvise IMFQualityAdvise_iface; IMFQualityAdvise IMFQualityAdvise_iface;
IDirect3DDeviceManager9 IDirect3DDeviceManager9_iface;
IMFVideoSampleAllocatorNotify allocator_cb; IMFVideoSampleAllocatorNotify allocator_cb;
IUnknown IUnknown_inner; IUnknown IUnknown_inner;
IUnknown *outer_unk; IUnknown *outer_unk;
@ -152,6 +153,11 @@ static struct video_presenter *impl_from_IMFQualityAdvise(IMFQualityAdvise *ifac
return CONTAINING_RECORD(iface, struct video_presenter, IMFQualityAdvise_iface); return CONTAINING_RECORD(iface, struct video_presenter, IMFQualityAdvise_iface);
} }
static struct video_presenter *impl_from_IDirect3DDeviceManager9(IDirect3DDeviceManager9 *iface)
{
return CONTAINING_RECORD(iface, struct video_presenter, IDirect3DDeviceManager9_iface);
}
static void video_presenter_notify_renderer(struct video_presenter *presenter, static void video_presenter_notify_renderer(struct video_presenter *presenter,
LONG event, LONG_PTR param1, LONG_PTR param2) LONG event, LONG_PTR param1, LONG_PTR param2)
{ {
@ -480,6 +486,10 @@ static HRESULT WINAPI video_presenter_inner_QueryInterface(IUnknown *iface, REFI
{ {
*obj = &presenter->IMFQualityAdvise_iface; *obj = &presenter->IMFQualityAdvise_iface;
} }
else if (IsEqualIID(riid, &IID_IDirect3DDeviceManager9))
{
*obj = &presenter->IDirect3DDeviceManager9_iface;
}
else else
{ {
WARN("Unimplemented interface %s.\n", debugstr_guid(riid)); WARN("Unimplemented interface %s.\n", debugstr_guid(riid));
@ -1486,6 +1496,85 @@ static const IMFQualityAdviseVtbl video_presenter_quality_advise_vtbl =
video_presenter_quality_advise_DropTime, video_presenter_quality_advise_DropTime,
}; };
static HRESULT WINAPI video_presenter_device_manager_QueryInterface(IDirect3DDeviceManager9 *iface,
REFIID riid, void **obj)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IMFVideoPresenter_QueryInterface(&presenter->IMFVideoPresenter_iface, riid, obj);
}
static ULONG WINAPI video_presenter_device_manager_AddRef(IDirect3DDeviceManager9 *iface)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IMFVideoPresenter_AddRef(&presenter->IMFVideoPresenter_iface);
}
static ULONG WINAPI video_presenter_device_manager_Release(IDirect3DDeviceManager9 *iface)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IMFVideoPresenter_Release(&presenter->IMFVideoPresenter_iface);
}
static HRESULT WINAPI video_presenter_device_manager_ResetDevice(IDirect3DDeviceManager9 *iface,
IDirect3DDevice9 *device, UINT token)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IDirect3DDeviceManager9_ResetDevice(presenter->device_manager, device, token);
}
static HRESULT WINAPI video_presenter_device_manager_OpenDeviceHandle(IDirect3DDeviceManager9 *iface, HANDLE *hdevice)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IDirect3DDeviceManager9_OpenDeviceHandle(presenter->device_manager, hdevice);
}
static HRESULT WINAPI video_presenter_device_manager_CloseDeviceHandle(IDirect3DDeviceManager9 *iface, HANDLE hdevice)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IDirect3DDeviceManager9_CloseDeviceHandle(presenter->device_manager, hdevice);
}
static HRESULT WINAPI video_presenter_device_manager_TestDevice(IDirect3DDeviceManager9 *iface, HANDLE hdevice)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IDirect3DDeviceManager9_TestDevice(presenter->device_manager, hdevice);
}
static HRESULT WINAPI video_presenter_device_manager_LockDevice(IDirect3DDeviceManager9 *iface, HANDLE hdevice,
IDirect3DDevice9 **device, BOOL block)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IDirect3DDeviceManager9_LockDevice(presenter->device_manager, hdevice, device, block);
}
static HRESULT WINAPI video_presenter_device_manager_UnlockDevice(IDirect3DDeviceManager9 *iface, HANDLE hdevice,
BOOL savestate)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IDirect3DDeviceManager9_UnlockDevice(presenter->device_manager, hdevice, savestate);
}
static HRESULT WINAPI video_presenter_device_manager_GetVideoService(IDirect3DDeviceManager9 *iface, HANDLE hdevice,
REFIID riid, void **service)
{
struct video_presenter *presenter = impl_from_IDirect3DDeviceManager9(iface);
return IDirect3DDeviceManager9_GetVideoService(presenter->device_manager, hdevice, riid, service);
}
static const IDirect3DDeviceManager9Vtbl video_presenter_device_manager_vtbl =
{
video_presenter_device_manager_QueryInterface,
video_presenter_device_manager_AddRef,
video_presenter_device_manager_Release,
video_presenter_device_manager_ResetDevice,
video_presenter_device_manager_OpenDeviceHandle,
video_presenter_device_manager_CloseDeviceHandle,
video_presenter_device_manager_TestDevice,
video_presenter_device_manager_LockDevice,
video_presenter_device_manager_UnlockDevice,
video_presenter_device_manager_GetVideoService,
};
HRESULT WINAPI MFCreateVideoPresenter(IUnknown *owner, REFIID riid_device, REFIID riid, void **obj) HRESULT WINAPI MFCreateVideoPresenter(IUnknown *owner, REFIID riid_device, REFIID riid, void **obj)
{ {
TRACE("%p, %s, %s, %p.\n", owner, debugstr_guid(riid_device), debugstr_guid(riid), obj); TRACE("%p, %s, %s, %p.\n", owner, debugstr_guid(riid_device), debugstr_guid(riid), obj);
@ -1558,6 +1647,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out)
object->IMFQualityAdvise_iface.lpVtbl = &video_presenter_quality_advise_vtbl; object->IMFQualityAdvise_iface.lpVtbl = &video_presenter_quality_advise_vtbl;
object->allocator_cb.lpVtbl = &video_presenter_allocator_cb_vtbl; object->allocator_cb.lpVtbl = &video_presenter_allocator_cb_vtbl;
object->IUnknown_inner.lpVtbl = &video_presenter_inner_vtbl; object->IUnknown_inner.lpVtbl = &video_presenter_inner_vtbl;
object->IDirect3DDeviceManager9_iface.lpVtbl = &video_presenter_device_manager_vtbl;
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;

View File

@ -1128,8 +1128,8 @@ static void test_default_presenter(void)
IMFRateSupport *rate_support; IMFRateSupport *rate_support;
IDirect3DDeviceManager9 *dm; IDirect3DDeviceManager9 *dm;
IMFVideoDeviceID *deviceid; IMFVideoDeviceID *deviceid;
IUnknown *unk, *unk2;
HWND hwnd, hwnd2; HWND hwnd, hwnd2;
IUnknown *unk;
DWORD flags; DWORD flags;
float rate; float rate;
HRESULT hr; HRESULT hr;
@ -1153,6 +1153,7 @@ static void test_default_presenter(void)
check_interface(presenter, &IID_IMFVideoPresenter, TRUE); check_interface(presenter, &IID_IMFVideoPresenter, TRUE);
check_interface(presenter, &IID_IMFVideoDeviceID, TRUE); check_interface(presenter, &IID_IMFVideoDeviceID, TRUE);
check_interface(presenter, &IID_IMFQualityAdvise, TRUE); check_interface(presenter, &IID_IMFQualityAdvise, TRUE);
check_interface(presenter, &IID_IDirect3DDeviceManager9, TRUE);
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPositionMapper, TRUE);
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDisplayControl, TRUE);
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPresenter, TRUE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoPresenter, TRUE);
@ -1164,8 +1165,24 @@ static void test_default_presenter(void)
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDeviceID, TRUE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFVideoDeviceID, TRUE);
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFQualityAdvise, TRUE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFQualityAdvise, TRUE);
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFTransform, FALSE); check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IMFTransform, FALSE);
check_service_interface(presenter, &MR_VIDEO_RENDER_SERVICE, &IID_IDirect3DDeviceManager9, TRUE);
check_service_interface(presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE); check_service_interface(presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, TRUE);
/* Query arbitrary supported interface back from device manager wrapper. */
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IDirect3DDeviceManager9, (void **)&dm);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IDirect3DDeviceManager9_QueryInterface(dm, &IID_IQualProp, (void **)&unk);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
IUnknown_Release(unk);
hr = IDirect3DDeviceManager9_QueryInterface(dm, &IID_IUnknown, (void **)&unk);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IUnknown, (void **)&unk2);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ok(unk == unk2, "Unexpected interface.\n");
IUnknown_Release(unk2);
IUnknown_Release(unk);
IDirect3DDeviceManager9_Release(dm);
hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_MIXER_SERVICE, &IID_IUnknown, (void **)&unk); hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_MIXER_SERVICE, &IID_IUnknown, (void **)&unk);
ok(hr == MF_E_UNSUPPORTED_SERVICE, "Unexpected hr %#x.\n", hr); ok(hr == MF_E_UNSUPPORTED_SERVICE, "Unexpected hr %#x.\n", hr);