mf: Add IMFGetService stub for media session.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-05-08 14:46:43 +03:00 committed by Alexandre Julliard
parent 37a7b65140
commit 83f5951810
2 changed files with 51 additions and 0 deletions

View File

@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
struct media_session struct media_session
{ {
IMFMediaSession IMFMediaSession_iface; IMFMediaSession IMFMediaSession_iface;
IMFGetService IMFGetService_iface;
LONG refcount; LONG refcount;
IMFMediaEventQueue *event_queue; IMFMediaEventQueue *event_queue;
}; };
@ -92,6 +93,11 @@ static inline struct media_session *impl_from_IMFMediaSession(IMFMediaSession *i
return CONTAINING_RECORD(iface, struct media_session, IMFMediaSession_iface); return CONTAINING_RECORD(iface, struct media_session, IMFMediaSession_iface);
} }
static struct media_session *impl_from_IMFGetService(IMFGetService *iface)
{
return CONTAINING_RECORD(iface, struct media_session, IMFGetService_iface);
}
static struct presentation_clock *impl_from_IMFPresentationClock(IMFPresentationClock *iface) static struct presentation_clock *impl_from_IMFPresentationClock(IMFPresentationClock *iface)
{ {
return CONTAINING_RECORD(iface, struct presentation_clock, IMFPresentationClock_iface); return CONTAINING_RECORD(iface, struct presentation_clock, IMFPresentationClock_iface);
@ -136,6 +142,12 @@ static HRESULT WINAPI mfsession_QueryInterface(IMFMediaSession *iface, REFIID ri
IMFMediaSession_AddRef(iface); IMFMediaSession_AddRef(iface);
return S_OK; return S_OK;
} }
else if (IsEqualIID(riid, &IID_IMFGetService))
{
*out = &session->IMFGetService_iface;
IMFMediaSession_AddRef(iface);
return S_OK;
}
WARN("Unsupported %s.\n", debugstr_guid(riid)); WARN("Unsupported %s.\n", debugstr_guid(riid));
*out = NULL; *out = NULL;
@ -301,6 +313,39 @@ static const IMFMediaSessionVtbl mfmediasessionvtbl =
mfsession_GetFullTopology, mfsession_GetFullTopology,
}; };
static HRESULT WINAPI session_get_service_QueryInterface(IMFGetService *iface, REFIID riid, void **obj)
{
struct media_session *session = impl_from_IMFGetService(iface);
return IMFMediaSession_QueryInterface(&session->IMFMediaSession_iface, riid, obj);
}
static ULONG WINAPI session_get_service_AddRef(IMFGetService *iface)
{
struct media_session *session = impl_from_IMFGetService(iface);
return IMFMediaSession_AddRef(&session->IMFMediaSession_iface);
}
static ULONG WINAPI session_get_service_Release(IMFGetService *iface)
{
struct media_session *session = impl_from_IMFGetService(iface);
return IMFMediaSession_Release(&session->IMFMediaSession_iface);
}
static HRESULT WINAPI session_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 session_get_service_vtbl =
{
session_get_service_QueryInterface,
session_get_service_AddRef,
session_get_service_Release,
session_get_service_GetService,
};
/*********************************************************************** /***********************************************************************
* MFCreateMediaSession (mf.@) * MFCreateMediaSession (mf.@)
*/ */
@ -319,6 +364,7 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl; object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl;
object->IMFGetService_iface.lpVtbl = &session_get_service_vtbl;
object->refcount = 1; object->refcount = 1;
if (FAILED(hr = MFCreateEventQueue(&object->event_queue))) if (FAILED(hr = MFCreateEventQueue(&object->event_queue)))
{ {

View File

@ -944,6 +944,7 @@ todo_wine
static void test_media_session(void) static void test_media_session(void)
{ {
IMFMediaSession *session; IMFMediaSession *session;
IMFGetService *gs;
IUnknown *unk; IUnknown *unk;
HRESULT hr; HRESULT hr;
@ -956,6 +957,10 @@ static void test_media_session(void)
hr = IMFMediaSession_QueryInterface(session, &IID_IMFAttributes, (void **)&unk); hr = IMFMediaSession_QueryInterface(session, &IID_IMFAttributes, (void **)&unk);
ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr); ok(hr == E_NOINTERFACE, "Unexpected hr %#x.\n", hr);
hr = IMFMediaSession_QueryInterface(session, &IID_IMFGetService, (void **)&gs);
ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr);
IMFGetService_Release(gs);
test_session_events(session); test_session_events(session);
IMFMediaSession_Release(session); IMFMediaSession_Release(session);