From f557a5ee561faa215f2700b492daab789c82bee8 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 8 Jul 2020 18:10:35 +0300 Subject: [PATCH] mf/evr: Add IMFGetService stub. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/evr.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 5 +++++ 2 files changed, 49 insertions(+) diff --git a/dlls/mf/evr.c b/dlls/mf/evr.c index aa4d3850c6f..ebb3fd4c2c8 100644 --- a/dlls/mf/evr.c +++ b/dlls/mf/evr.c @@ -36,6 +36,7 @@ struct video_renderer IMFVideoRenderer IMFVideoRenderer_iface; IMFClockStateSink IMFClockStateSink_iface; IMFMediaEventGenerator IMFMediaEventGenerator_iface; + IMFGetService IMFGetService_iface; LONG refcount; IMFMediaEventQueue *event_queue; @@ -70,6 +71,11 @@ static struct video_renderer *impl_from_IMFClockStateSink(IMFClockStateSink *ifa return CONTAINING_RECORD(iface, struct video_renderer, IMFClockStateSink_iface); } +static struct video_renderer *impl_from_IMFGetService(IMFGetService *iface) +{ + return CONTAINING_RECORD(iface, struct video_renderer, IMFGetService_iface); +} + static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, REFIID riid, void **obj) { struct video_renderer *renderer = impl_from_IMFMediaSink(iface); @@ -97,6 +103,10 @@ static HRESULT WINAPI video_renderer_sink_QueryInterface(IMFMediaSink *iface, RE { *obj = &renderer->IMFClockStateSink_iface; } + else if (IsEqualIID(riid, &IID_IMFGetService)) + { + *obj = &renderer->IMFGetService_iface; + } else { WARN("Unsupported interface %s.\n", debugstr_guid(riid)); @@ -438,6 +448,39 @@ static const IMFClockStateSinkVtbl video_renderer_clock_sink_vtbl = video_renderer_clock_sink_OnClockSetRate, }; +static HRESULT WINAPI video_renderer_get_service_QueryInterface(IMFGetService *iface, REFIID riid, void **obj) +{ + struct video_renderer *renderer = impl_from_IMFGetService(iface); + return IMFMediaSink_QueryInterface(&renderer->IMFMediaSink_iface, riid, obj); +} + +static ULONG WINAPI video_renderer_get_service_AddRef(IMFGetService *iface) +{ + struct video_renderer *renderer = impl_from_IMFGetService(iface); + return IMFMediaSink_AddRef(&renderer->IMFMediaSink_iface); +} + +static ULONG WINAPI video_renderer_get_service_Release(IMFGetService *iface) +{ + struct video_renderer *renderer = impl_from_IMFGetService(iface); + return IMFMediaSink_Release(&renderer->IMFMediaSink_iface); +} + +static HRESULT WINAPI video_renderer_get_service_GetService(IMFGetService *iface, REFGUID service, REFIID riid, void **obj) +{ + FIXME("%p, %s, %s, %p.\n", iface, debugstr_guid(service), debugstr_guid(riid), obj); + + return E_NOTIMPL; +} + +static const IMFGetServiceVtbl video_renderer_get_service_vtbl = +{ + video_renderer_get_service_QueryInterface, + video_renderer_get_service_AddRef, + video_renderer_get_service_Release, + video_renderer_get_service_GetService, +}; + static HRESULT video_renderer_create_mixer(IMFAttributes *attributes, IMFTransform **out) { unsigned int flags = 0; @@ -499,6 +542,7 @@ static HRESULT evr_create_object(IMFAttributes *attributes, void *user_context, object->IMFVideoRenderer_iface.lpVtbl = &video_renderer_vtbl; object->IMFMediaEventGenerator_iface.lpVtbl = &video_renderer_events_vtbl; object->IMFClockStateSink_iface.lpVtbl = &video_renderer_clock_sink_vtbl; + object->IMFGetService_iface.lpVtbl = &video_renderer_get_service_vtbl; object->refcount = 1; InitializeCriticalSection(&object->cs); diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 077466b7e8e..3fad309bcf6 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -3234,6 +3234,7 @@ static void test_evr(void) IMFMediaSink *sink, *sink2; IMFActivate *activate; DWORD flags, count; + IMFGetService *gs; UINT64 value; HRESULT hr; @@ -3277,6 +3278,10 @@ static void test_evr(void) ok(hr == S_OK, "Unexpected hr %#x.\n", hr); IMFClockStateSink_Release(clock_sink); + hr = IMFMediaSink_QueryInterface(sink, &IID_IMFGetService, (void **)&gs); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + IMFGetService_Release(gs); + hr = IMFActivate_ShutdownObject(activate); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);