Commit 76a347a5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mf: Create topology loader of session creation.

parent 000a552d
......@@ -69,6 +69,7 @@ struct media_session
IMFMediaEventQueue *event_queue;
IMFPresentationClock *clock;
IMFRateControl *clock_rate_control;
IMFTopoLoader *topo_loader;
struct list topologies;
enum session_state state;
CRITICAL_SECTION cs;
......@@ -329,6 +330,8 @@ static ULONG WINAPI mfsession_Release(IMFMediaSession *iface)
IMFPresentationClock_Release(session->clock);
if (session->clock_rate_control)
IMFRateControl_Release(session->clock_rate_control);
if (session->topo_loader)
IMFTopoLoader_Release(session->topo_loader);
DeleteCriticalSection(&session->cs);
heap_free(session);
}
......@@ -791,6 +794,23 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses
goto failed;
}
if (config)
{
GUID clsid;
if (SUCCEEDED(IMFAttributes_GetGUID(config, &MF_SESSION_TOPOLOADER, &clsid)))
{
if (FAILED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER, &IID_IMFTopoLoader,
(void **)&object->topo_loader)))
{
WARN("Failed to create custom topology loader, hr %#x.\n", hr);
}
}
}
if (!object->topo_loader && FAILED(hr = MFCreateTopoLoader(&object->topo_loader)))
goto failed;
*session = &object->IMFMediaSession_iface;
return S_OK;
......
......@@ -954,6 +954,7 @@ static void test_media_session(void)
IMFRateControl *rate_control, *rate_control2;
MFCLOCK_PROPERTIES clock_props;
IMFRateSupport *rate_support;
IMFAttributes *attributes;
IMFMediaSession *session;
IMFGetService *gs;
IMFClock *clock;
......@@ -1043,6 +1044,19 @@ todo_wine
IMFMediaSession_Release(session);
/* Custom topology loader, GUID is not registered. */
hr = MFCreateAttributes(&attributes, 1);
ok(hr == S_OK, "Failed to create attributes, hr %#x.\n", hr);
hr = IMFAttributes_SetGUID(attributes, &MF_SESSION_TOPOLOADER, &MF_SESSION_TOPOLOADER);
ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr);
hr = MFCreateMediaSession(attributes, &session);
ok(hr == S_OK, "Failed to create media session, hr %#x.\n", hr);
IMFMediaSession_Release(session);
IMFAttributes_Release(attributes);
hr = MFShutdown();
ok(hr == S_OK, "Shutdown failure, hr %#x.\n", hr);
}
......
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