mf: Create topology loader of session creation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
000a552d4f
commit
76a347a53e
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue