Nikolay Sivov : mf: Create topology loader of session creation.
Alexandre Julliard
julliard at winehq.org
Tue Sep 24 16:04:45 CDT 2019
Module: wine
Branch: master
Commit: 76a347a53eba882d28b2a0868a45ae22405200ab
URL: https://source.winehq.org/git/wine.git/?a=commit;h=76a347a53eba882d28b2a0868a45ae22405200ab
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Sep 24 12:01:59 2019 +0300
mf: Create topology loader of session creation.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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);
}
More information about the wine-cvs
mailing list