From 4c61027967fc5ac7887cfbdb81b9fe726b55e12a Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 28 Jan 2022 10:17:13 +0300 Subject: [PATCH] mfmediaengine: Handle shutdown state in a few stubs. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfmediaengine/main.c | 60 ++++++++++++++++++++++-- dlls/mfmediaengine/tests/mfmediaengine.c | 5 -- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 91f1224f4b0..84d7677a328 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -1538,16 +1538,36 @@ static HRESULT WINAPI media_engine_GetBuffered(IMFMediaEngineEx *iface, IMFMedia static HRESULT WINAPI media_engine_Load(IMFMediaEngineEx *iface) { + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + HRESULT hr = E_NOTIMPL; + FIXME("(%p): stub.\n", iface); - return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + + LeaveCriticalSection(&engine->cs); + + return hr; } static HRESULT WINAPI media_engine_CanPlayType(IMFMediaEngineEx *iface, BSTR type, MF_MEDIA_ENGINE_CANPLAY *answer) { + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + HRESULT hr = E_NOTIMPL; + FIXME("(%p, %s, %p): stub.\n", iface, debugstr_w(type), answer); - return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + + LeaveCriticalSection(&engine->cs); + + return hr; } static USHORT WINAPI media_engine_GetReadyState(IMFMediaEngineEx *iface) @@ -1595,9 +1615,19 @@ static double WINAPI media_engine_GetCurrentTime(IMFMediaEngineEx *iface) static HRESULT WINAPI media_engine_SetCurrentTime(IMFMediaEngineEx *iface, double time) { + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + HRESULT hr = E_NOTIMPL; + FIXME("(%p, %f): stub.\n", iface, time); - return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + + LeaveCriticalSection(&engine->cs); + + return hr; } static double WINAPI media_engine_GetStartTime(IMFMediaEngineEx *iface) @@ -1705,16 +1735,36 @@ static HRESULT WINAPI media_engine_SetPlaybackRate(IMFMediaEngineEx *iface, doub static HRESULT WINAPI media_engine_GetPlayed(IMFMediaEngineEx *iface, IMFMediaTimeRange **played) { + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + HRESULT hr = E_NOTIMPL; + FIXME("(%p, %p): stub.\n", iface, played); - return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + + LeaveCriticalSection(&engine->cs); + + return hr; } static HRESULT WINAPI media_engine_GetSeekable(IMFMediaEngineEx *iface, IMFMediaTimeRange **seekable) { + struct media_engine *engine = impl_from_IMFMediaEngineEx(iface); + HRESULT hr = E_NOTIMPL; + FIXME("(%p, %p): stub.\n", iface, seekable); - return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + + LeaveCriticalSection(&engine->cs); + + return hr; } static BOOL WINAPI media_engine_IsEnded(IMFMediaEngineEx *iface) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 6e201893b0c..00690b25ebe 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -344,12 +344,10 @@ static void test_Shutdown(void) ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); hr = IMFMediaEngine_Load(media_engine); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); str = SysAllocString(L"video/mp4"); hr = IMFMediaEngine_CanPlayType(media_engine, str, &state); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); SysFreeString(str); @@ -363,7 +361,6 @@ todo_wine ok(val == 0.0, "Unexpected time %f.\n", val); hr = IMFMediaEngine_SetCurrentTime(media_engine, 1.0); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); val = IMFMediaEngine_GetStartTime(media_engine); @@ -382,11 +379,9 @@ todo_wine ok(val == 1.0, "Unexpected rate %f.\n", val); hr = IMFMediaEngine_GetPlayed(media_engine, &time_range); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); hr = IMFMediaEngine_GetSeekable(media_engine, &time_range); -todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); state = IMFMediaEngine_IsEnded(media_engine);