Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/evr/presenter.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ dlls/evr/tests/evr.c | 20 ++++++++++++++++-- 2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 234c1f076ca..34c9a06fcf3 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(evr); struct video_presenter { IMFVideoPresenter IMFVideoPresenter_iface; + IMFVideoDeviceID IMFVideoDeviceID_iface; IUnknown IUnknown_inner; IUnknown *outer_unk; LONG refcount; @@ -49,6 +50,11 @@ static struct video_presenter *impl_from_IMFVideoPresenter(IMFVideoPresenter *if return CONTAINING_RECORD(iface, struct video_presenter, IMFVideoPresenter_iface); }
+static struct video_presenter *impl_from_IMFVideoDeviceID(IMFVideoDeviceID *iface) +{ + return CONTAINING_RECORD(iface, struct video_presenter, IMFVideoDeviceID_iface); +} + static HRESULT WINAPI video_presenter_inner_QueryInterface(IUnknown *iface, REFIID riid, void **obj) { struct video_presenter *presenter = impl_from_IUnknown(iface); @@ -64,6 +70,10 @@ static HRESULT WINAPI video_presenter_inner_QueryInterface(IUnknown *iface, REFI { *obj = &presenter->IMFVideoPresenter_iface; } + else if (IsEqualIID(riid, &IID_IMFVideoDeviceID)) + { + *obj = &presenter->IMFVideoDeviceID_iface; + } else { WARN("Unimplemented interface %s.\n", debugstr_guid(riid)); @@ -188,6 +198,44 @@ static const IMFVideoPresenterVtbl video_presenter_vtbl = video_presenter_GetCurrentMediaType, };
+static HRESULT WINAPI video_presenter_device_id_QueryInterface(IMFVideoDeviceID *iface, REFIID riid, void **obj) +{ + struct video_presenter *presenter = impl_from_IMFVideoDeviceID(iface); + return IMFVideoPresenter_QueryInterface(&presenter->IMFVideoPresenter_iface, riid, obj); +} + +static ULONG WINAPI video_presenter_device_id_AddRef(IMFVideoDeviceID *iface) +{ + struct video_presenter *presenter = impl_from_IMFVideoDeviceID(iface); + return IMFVideoPresenter_AddRef(&presenter->IMFVideoPresenter_iface); +} + +static ULONG WINAPI video_presenter_device_id_Release(IMFVideoDeviceID *iface) +{ + struct video_presenter *presenter = impl_from_IMFVideoDeviceID(iface); + return IMFVideoPresenter_Release(&presenter->IMFVideoPresenter_iface); +} + +static HRESULT WINAPI video_presenter_device_id_GetDeviceID(IMFVideoDeviceID *iface, IID *device_id) +{ + TRACE("%p, %p.\n", iface, device_id); + + if (!device_id) + return E_POINTER; + + memcpy(device_id, &IID_IDirect3DDevice9, sizeof(*device_id)); + + return S_OK; +} + +static const IMFVideoDeviceIDVtbl video_presenter_device_id_vtbl = +{ + video_presenter_device_id_QueryInterface, + video_presenter_device_id_AddRef, + video_presenter_device_id_Release, + video_presenter_device_id_GetDeviceID, +}; + 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); @@ -208,6 +256,7 @@ HRESULT evr_presenter_create(IUnknown *outer, void **out) return E_OUTOFMEMORY;
object->IMFVideoPresenter_iface.lpVtbl = &video_presenter_vtbl; + object->IMFVideoDeviceID_iface.lpVtbl = &video_presenter_device_id_vtbl; object->IUnknown_inner.lpVtbl = &video_presenter_inner_vtbl; object->outer_unk = outer ? outer : &object->IUnknown_inner; object->refcount = 1; diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 6805a7ae2b7..965b921937c 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -869,15 +869,31 @@ done: static void test_default_presenter(void) { IMFVideoPresenter *presenter; + IMFVideoDeviceID *deviceid; HRESULT hr; + GUID iid;
hr = MFCreateVideoPresenter(NULL, &IID_IMFVideoPresenter, &IID_IMFVideoPresenter, (void **)&presenter); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = MFCreateVideoPresenter(NULL, &IID_IDirect3DDevice9, &IID_IMFVideoPresenter, (void **)&presenter); ok(hr == S_OK || broken(hr == E_FAIL) /* WinXP */, "Failed to create default presenter, hr %#x.\n", hr); - if (SUCCEEDED(hr)) - IMFVideoPresenter_Release(presenter); + if (FAILED(hr)) + return; + + hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDeviceID, (void **)&deviceid); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + hr = IMFVideoDeviceID_GetDeviceID(deviceid, NULL); + ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr); + + hr = IMFVideoDeviceID_GetDeviceID(deviceid, &iid); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + ok(IsEqualIID(&iid, &IID_IDirect3DDevice9), "Unexpected id %s.\n", wine_dbgstr_guid(&iid)); + + IMFVideoDeviceID_Release(deviceid); + + IMFVideoPresenter_Release(presenter); }
START_TEST(evr)