Commit 04547b42 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

mfmediaengine: Handle shutdown state in SetSource().

parent 176da9a5
......@@ -1352,29 +1352,35 @@ 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);
engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_NOTHING;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS, 0, 0);
if (url)
if (engine->flags & FLAGS_ENGINE_SHUT_DOWN)
hr = MF_E_SHUTDOWN;
else
{
IPropertyStore *props = NULL;
unsigned int flags;
SysFreeString(engine->current_source);
engine->current_source = NULL;
if (url)
engine->current_source = SysAllocString(url);
engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_NOTHING;
flags = MF_RESOLUTION_MEDIASOURCE;
if (engine->flags & MF_MEDIA_ENGINE_DISABLE_LOCAL_PLUGINS)
flags |= MF_RESOLUTION_DISABLE_LOCAL_PLUGINS;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS, 0, 0);
IMFAttributes_GetUnknown(engine->attributes, &MF_MEDIA_ENGINE_SOURCE_RESOLVER_CONFIG_STORE,
&IID_IPropertyStore, (void **)&props);
hr = IMFSourceResolver_BeginCreateObjectFromURL(engine->resolver, url, flags, props, NULL, &engine->load_handler, NULL);
if (props)
IPropertyStore_Release(props);
if (url)
{
IPropertyStore *props = NULL;
unsigned int flags;
flags = MF_RESOLUTION_MEDIASOURCE;
if (engine->flags & MF_MEDIA_ENGINE_DISABLE_LOCAL_PLUGINS)
flags |= MF_RESOLUTION_DISABLE_LOCAL_PLUGINS;
IMFAttributes_GetUnknown(engine->attributes, &MF_MEDIA_ENGINE_SOURCE_RESOLVER_CONFIG_STORE,
&IID_IPropertyStore, (void **)&props);
hr = IMFSourceResolver_BeginCreateObjectFromURL(engine->resolver, url, flags, props, NULL,
&engine->load_handler, NULL);
if (props)
IPropertyStore_Release(props);
}
}
LeaveCriticalSection(&engine->cs);
......
......@@ -253,7 +253,6 @@ static void test_Shutdown(void)
ok(hr == MF_E_SHUTDOWN || broken(hr == S_OK) /* before win10 */, "Unexpected hr %#x.\n", hr);
hr = IMFMediaEngine_SetSource(media_engine, NULL);
todo_wine
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
hr = IMFMediaEngine_GetCurrentSource(media_engine, &str);
......
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