[PATCH 3/5] mf: Create topology loader of session creation.
Nikolay Sivov
nsivov at codeweavers.com
Tue Sep 24 04:01:59 CDT 2019
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mf/session.c | 20 ++++++++++++++++++++
dlls/mf/tests/mf.c | 14 ++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/dlls/mf/session.c b/dlls/mf/session.c
index ecee112c3f..89128b7b6a 100644
--- a/dlls/mf/session.c
+++ b/dlls/mf/session.c
@@ -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;
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 00dc2daed5..64329846cd 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -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);
}
--
2.23.0
More information about the wine-devel
mailing list