From f151550e56df5e1b93b42844d66073f99c58b0d6 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 2 Jun 2020 11:41:09 +0300 Subject: [PATCH] mfmediaengine: Forward buffering events to user callback. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mfmediaengine/main.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index d698b53c38b..b9a5fb46d6f 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -137,10 +137,32 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface { struct media_engine *engine = impl_from_session_events_IMFAsyncCallback(iface); IMFMediaEvent *event = NULL; + MediaEventType event_type; HRESULT hr; if (FAILED(hr = IMFMediaSession_EndGetEvent(engine->session, result, &event))) + { WARN("Failed to get session event, hr %#x.\n", hr); + goto failed; + } + + if (FAILED(hr = IMFMediaEvent_GetType(event, &event_type))) + { + WARN("Failed to get event type, hr %#x.\n", hr); + goto failed; + } + + switch (event_type) + { + case MEBufferingStarted: + case MEBufferingStopped: + + IMFMediaEngineNotify_EventNotify(engine->callback, event_type == MEBufferingStarted ? + MF_MEDIA_ENGINE_EVENT_BUFFERINGSTARTED : MF_MEDIA_ENGINE_EVENT_BUFFERINGENDED, 0, 0); + break; + } + +failed: if (event) IMFMediaEvent_Release(event);