From 496a7035accadee1924f14ae609b3b8fd39c3cfd Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 4 Jun 2020 13:41:47 +0300 Subject: [PATCH] mfmediaengine: Implement GetCurrentSource(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfmediaengine/Makefile.in | 2 +- dlls/mfmediaengine/main.c | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/dlls/mfmediaengine/Makefile.in b/dlls/mfmediaengine/Makefile.in index cb593cb7edf..b97e9eec331 100644 --- a/dlls/mfmediaengine/Makefile.in +++ b/dlls/mfmediaengine/Makefile.in @@ -1,6 +1,6 @@ MODULE = mfmediaengine.dll IMPORTLIB = mfmediaengine -IMPORTS = mfplat mf mfuuid uuid +IMPORTS = oleaut32 mfplat mf mfuuid uuid EXTRADLLFLAGS = -mno-cygwin diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 7693205238a..2f4a38936c4 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -88,6 +88,7 @@ struct media_engine HRESULT extended_code; IMFMediaSession *session; IMFSourceResolver *resolver; + BSTR current_source; CRITICAL_SECTION cs; }; @@ -499,6 +500,7 @@ static void free_media_engine(struct media_engine *engine) IMFAttributes_Release(engine->attributes); if (engine->resolver) IMFSourceResolver_Release(engine->resolver); + SysFreeString(engine->current_source); DeleteCriticalSection(&engine->cs); heap_free(engine); } @@ -577,6 +579,11 @@ static HRESULT WINAPI media_engine_SetSource(IMFMediaEngine *iface, BSTR url) EnterCriticalSection(&engine->cs); + SysFreeString(engine->current_source); + engine->current_source = NULL; + if (url) + engine->current_source = SysAllocString(url); + IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS, 0, 0); if (url) @@ -602,9 +609,22 @@ static HRESULT WINAPI media_engine_SetSource(IMFMediaEngine *iface, BSTR url) static HRESULT WINAPI media_engine_GetCurrentSource(IMFMediaEngine *iface, BSTR *url) { - FIXME("(%p, %p): stub.\n", iface, url); + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + HRESULT hr = S_OK; - return E_NOTIMPL; + TRACE("%p, %p.\n", iface, url); + + *url = NULL; + + EnterCriticalSection(&engine->cs); + if (engine->current_source) + { + if (!(*url = SysAllocString(engine->current_source))) + hr = E_OUTOFMEMORY; + } + LeaveCriticalSection(&engine->cs); + + return hr; } static USHORT WINAPI media_engine_GetNetworkState(IMFMediaEngine *iface)