mfmediaengine: Send "pause" event on Pause().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-05-29 21:28:40 +03:00 committed by Alexandre Julliard
parent 41af1d1e71
commit 58f4680380
2 changed files with 36 additions and 2 deletions

View File

@ -476,9 +476,26 @@ static HRESULT WINAPI media_engine_Play(IMFMediaEngine *iface)
static HRESULT WINAPI media_engine_Pause(IMFMediaEngine *iface)
{
FIXME("(%p): stub.\n", iface);
struct media_engine *engine = impl_from_IMFMediaEngine(iface);
return E_NOTIMPL;
TRACE("%p.\n", iface);
EnterCriticalSection(&engine->cs);
if (!(engine->flags & FLAGS_ENGINE_PAUSED))
{
engine->flags &= ~FLAGS_ENGINE_WAITING;
engine->flags |= FLAGS_ENGINE_PAUSED;
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_TIMEUPDATE, 0, 0);
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PAUSE, 0, 0);
}
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS, 0, 0);
LeaveCriticalSection(&engine->cs);
return S_OK;
}
static BOOL WINAPI media_engine_GetMuted(IMFMediaEngine *iface)

View File

@ -421,6 +421,23 @@ static void test_Play(void)
ok(!ret, "Unexpected state %d.\n", ret);
IMFMediaEngine_Release(media_engine);
/* Play -> Pause */
media_engine = create_media_engine(callback);
hr = IMFMediaEngine_Play(media_engine);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ret = IMFMediaEngine_IsPaused(media_engine);
ok(!ret, "Unexpected state %d.\n", ret);
hr = IMFMediaEngine_Pause(media_engine);
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
ret = IMFMediaEngine_IsPaused(media_engine);
ok(!!ret, "Unexpected state %d.\n", ret);
IMFMediaEngine_Release(media_engine);
}
START_TEST(mfmediaengine)