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