Commit 83f59518 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Add IMFGetService stub for media session.

parent 37a7b651
......@@ -36,6 +36,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
struct media_session
{
IMFMediaSession IMFMediaSession_iface;
IMFGetService IMFGetService_iface;
LONG refcount;
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);
}
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)
{
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);
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));
*out = NULL;
......@@ -301,6 +313,39 @@ static const IMFMediaSessionVtbl mfmediasessionvtbl =
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.@)
*/
......@@ -319,6 +364,7 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses
return E_OUTOFMEMORY;
object->IMFMediaSession_iface.lpVtbl = &mfmediasessionvtbl;
object->IMFGetService_iface.lpVtbl = &session_get_service_vtbl;
object->refcount = 1;
if (FAILED(hr = MFCreateEventQueue(&object->event_queue)))
{
......
......@@ -944,6 +944,7 @@ todo_wine
static void test_media_session(void)
{
IMFMediaSession *session;
IMFGetService *gs;
IUnknown *unk;
HRESULT hr;
......@@ -956,6 +957,10 @@ static void test_media_session(void)
hr = IMFMediaSession_QueryInterface(session, &IID_IMFAttributes, (void **)&unk);
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);
IMFMediaSession_Release(session);
......
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