Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfmediaengine/main.c | 22 ++++++++++++++++++---- dlls/mfmediaengine/tests/mfmediaengine.c | 9 ++++++--- 2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index d93e2b2f38c..64f0ae6d2a1 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -87,6 +87,7 @@ struct media_engine MF_MEDIA_ENGINE_ERR error_code; HRESULT extended_code; MF_MEDIA_ENGINE_READY ready_state; + MF_MEDIA_ENGINE_PRELOAD preload; IMFMediaSession *session; IMFSourceResolver *resolver; BSTR current_source; @@ -717,16 +718,29 @@ static USHORT WINAPI media_engine_GetNetworkState(IMFMediaEngine *iface)
static MF_MEDIA_ENGINE_PRELOAD WINAPI media_engine_GetPreload(IMFMediaEngine *iface) { - FIXME("(%p): stub.\n", iface); + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + MF_MEDIA_ENGINE_PRELOAD preload; + + TRACE("%p.\n", iface); + + EnterCriticalSection(&engine->cs); + preload = engine->preload; + LeaveCriticalSection(&engine->cs);
- return MF_MEDIA_ENGINE_PRELOAD_NONE; + return preload; }
static HRESULT WINAPI media_engine_SetPreload(IMFMediaEngine *iface, MF_MEDIA_ENGINE_PRELOAD preload) { - FIXME("(%p, %d): stub.\n", iface, preload); + struct media_engine *engine = impl_from_IMFMediaEngine(iface);
- return E_NOTIMPL; + TRACE("%p, %d.\n", iface, preload); + + EnterCriticalSection(&engine->cs); + engine->preload = preload; + LeaveCriticalSection(&engine->cs); + + return S_OK; }
static HRESULT WINAPI media_engine_GetBuffered(IMFMediaEngine *iface, IMFMediaTimeRange **buffered) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 660e5b95331..0394bcf6a0e 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -265,17 +265,20 @@ todo_wine
/* Preload mode is still accessible. */ state = IMFMediaEngine_GetPreload(media_engine); -todo_wine ok(!state, "Unexpected state %d.\n", state);
hr = IMFMediaEngine_SetPreload(media_engine, MF_MEDIA_ENGINE_PRELOAD_AUTOMATIC); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
state = IMFMediaEngine_GetPreload(media_engine); -todo_wine ok(state == MF_MEDIA_ENGINE_PRELOAD_AUTOMATIC, "Unexpected state %d.\n", state);
+ hr = IMFMediaEngine_SetPreload(media_engine, 100); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetPreload(media_engine); + ok(state == 100, "Unexpected state %d.\n", state); + hr = IMFMediaEngine_GetBuffered(media_engine, &time_range); todo_wine ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);