Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- include/mfmediaengine.idl | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/include/mfmediaengine.idl b/include/mfmediaengine.idl index e5d91a57322..4ea3d834cf2 100644 --- a/include/mfmediaengine.idl +++ b/include/mfmediaengine.idl @@ -94,6 +94,49 @@ typedef enum MF_MEDIA_ENGINE_CREATEFLAGS MF_MEDIA_ENGINE_CREATEFLAGS_MASK = 0x1f } MF_MEDIA_ENGINE_CREATEFLAGS;
+typedef enum MF_MEDIA_ENGINE_EVENT +{ + MF_MEDIA_ENGINE_EVENT_LOADSTART = 1, + MF_MEDIA_ENGINE_EVENT_PROGRESS = 2, + MF_MEDIA_ENGINE_EVENT_SUSPEND = 3, + MF_MEDIA_ENGINE_EVENT_ABORT = 4, + MF_MEDIA_ENGINE_EVENT_ERROR = 5, + MF_MEDIA_ENGINE_EVENT_EMPTIED = 6, + MF_MEDIA_ENGINE_EVENT_STALLED = 7, + MF_MEDIA_ENGINE_EVENT_PLAY = 8, + MF_MEDIA_ENGINE_EVENT_PAUSE = 9, + MF_MEDIA_ENGINE_EVENT_LOADEDMETADATA = 10, + MF_MEDIA_ENGINE_EVENT_LOADEDDATA = 11, + MF_MEDIA_ENGINE_EVENT_WAITING = 12, + MF_MEDIA_ENGINE_EVENT_PLAYING = 13, + MF_MEDIA_ENGINE_EVENT_CANPLAY = 14, + MF_MEDIA_ENGINE_EVENT_CANPLAYTHROUGH = 15, + MF_MEDIA_ENGINE_EVENT_SEEKING = 16, + MF_MEDIA_ENGINE_EVENT_SEEKED = 17, + MF_MEDIA_ENGINE_EVENT_TIMEUPDATE = 18, + MF_MEDIA_ENGINE_EVENT_ENDED = 19, + MF_MEDIA_ENGINE_EVENT_RATECHANGE = 20, + MF_MEDIA_ENGINE_EVENT_DURATIONCHANGE = 21, + MF_MEDIA_ENGINE_EVENT_VOLUMECHANGE = 22, + MF_MEDIA_ENGINE_EVENT_FORMATCHANGE = 1000, + MF_MEDIA_ENGINE_EVENT_PURGEQUEUEDEVENTS = 1001, + MF_MEDIA_ENGINE_EVENT_TIMELINE_MARKER = 1002, + MF_MEDIA_ENGINE_EVENT_BALANCECHANGE = 1003, + MF_MEDIA_ENGINE_EVENT_DOWNLOADCOMPLETE = 1004, + MF_MEDIA_ENGINE_EVENT_BUFFERINGSTARTED = 1005, + MF_MEDIA_ENGINE_EVENT_BUFFERINGENDED = 1006, + MF_MEDIA_ENGINE_EVENT_FRAMESTEPCOMPLETED = 1007, + MF_MEDIA_ENGINE_EVENT_NOTIFYSTABLESTATE = 1008, + MF_MEDIA_ENGINE_EVENT_FIRSTFRAMEREADY = 1009, + MF_MEDIA_ENGINE_EVENT_TRACKSCHANGE = 1010, + MF_MEDIA_ENGINE_EVENT_OPMINFO = 1011, + MF_MEDIA_ENGINE_EVENT_RESOURCELOST = 1012, + MF_MEDIA_ENGINE_EVENT_DELAYLOADEVENT_CHANGED = 1013, + MF_MEDIA_ENGINE_EVENT_STREAMRENDERINGERROR = 1014, + MF_MEDIA_ENGINE_EVENT_SUPPORTEDRATES_CHANGED = 1015, + MF_MEDIA_ENGINE_EVENT_AUDIOENDPOINTCHANGE = 1016, +} MF_MEDIA_ENGINE_EVENT; + [ object, uuid(fc0e10d2-ab2a-4501-a951-06bb1075184c),
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfmediaengine/tests/mfmediaengine.c | 85 +++++++++++++++++++----- 1 file changed, 69 insertions(+), 16 deletions(-)
diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 2bbc79fb6c8..14d9eed453e 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -35,6 +35,8 @@
static HRESULT (WINAPI *pMFCreateDXGIDeviceManager)(UINT *token, IMFDXGIDeviceManager **manager);
+static IMFMediaEngineClassFactory *factory; + #define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__) static void _expect_ref(IUnknown *obj, ULONG ref, int line) { @@ -114,25 +116,20 @@ static void test_factory(void) UINT token; HRESULT hr;
- CoInitialize(NULL); - - hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, NULL, CLSCTX_INPROC_SERVER, - &IID_IMFMediaEngineClassFactory, (void **)&factory); - ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */, - "Failed to create class factory, hr %#x.\n", hr); - - hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, (IUnknown *)factory, CLSCTX_INPROC_SERVER, - &IID_IMFMediaEngineClassFactory, (void **)&factory2); - ok(hr == CLASS_E_NOAGGREGATION || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */, - "Unexpected hr %#x.\n", hr); - - if (!factory) + hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IMFMediaEngineClassFactory, + (void **)&factory); + ok(hr == S_OK || broken(hr == REGDB_E_CLASSNOTREG) /* pre-win8 */, "Failed to create class factory, hr %#x.\n", hr); + if (FAILED(hr)) { - win_skip("Not IMFMediaEngineClassFactory support.\n"); - CoUninitialize(); + win_skip("Media Engine is not supported.\n"); return; }
+ /* Aggregation is not supported. */ + hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, (IUnknown *)factory, CLSCTX_INPROC_SERVER, + &IID_IMFMediaEngineClassFactory, (void **)&factory2); + ok(hr == CLASS_E_NOAGGREGATION, "Unexpected hr %#x.\n", hr); + hr = pMFCreateDXGIDeviceManager(&token, &manager); ok(hr == S_OK, "MFCreateDXGIDeviceManager failed: %#x.\n", hr); hr = MFCreateAttributes(&attributes, 3); @@ -163,20 +160,76 @@ static void test_factory(void) IMFAttributes_Release(attributes); IMFDXGIDeviceManager_Release(manager); IMFMediaEngineClassFactory_Release(factory); +}
- CoUninitialize(); +static void test_CreateInstance(void) +{ + struct media_engine_notify notify_impl = {{&media_engine_notify_vtbl}, 1}; + IMFMediaEngineNotify *notify = ¬ify_impl.IMFMediaEngineNotify_iface; + IMFDXGIDeviceManager *manager; + IMFMediaEngine *media_engine; + IMFAttributes *attributes; + UINT token; + HRESULT hr; + + hr = pMFCreateDXGIDeviceManager(&token, &manager); + ok(hr == S_OK, "Failed to create dxgi device manager, hr %#x.\n", hr); + + hr = MFCreateAttributes(&attributes, 3); + ok(hr == S_OK, "Failed to create attributes, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, MF_MEDIA_ENGINE_WAITFORSTABLE_STATE, + attributes, &media_engine); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr); + + hr = IMFAttributes_SetUnknown(attributes, &MF_MEDIA_ENGINE_OPM_HWND, NULL); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, MF_MEDIA_ENGINE_WAITFORSTABLE_STATE, + attributes, &media_engine); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#x.\n", hr); + + IMFAttributes_DeleteAllItems(attributes); + + hr = IMFAttributes_SetUnknown(attributes, &MF_MEDIA_ENGINE_CALLBACK, (IUnknown *)notify); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT, DXGI_FORMAT_UNKNOWN); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, MF_MEDIA_ENGINE_WAITFORSTABLE_STATE, attributes, &media_engine); + ok(hr == S_OK, "Failed to create media engine, hr %#x.\n", hr); + + IMFMediaEngine_Release(media_engine); + IMFAttributes_Release(attributes); + IMFDXGIDeviceManager_Release(manager); }
START_TEST(mfmediaengine) { HRESULT hr;
+ CoInitialize(NULL); + + hr = CoCreateInstance(&CLSID_MFMediaEngineClassFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IMFMediaEngineClassFactory, + (void **)&factory); + if (FAILED(hr)) + { + win_skip("Media Engine is not supported.\n"); + CoUninitialize(); + return; + } + init_functions();
hr = MFStartup(MF_VERSION, MFSTARTUP_FULL); ok(hr == S_OK, "MFStartup failed: %#x.\n", hr);
test_factory(); + test_CreateInstance(); + + IMFMediaEngineClassFactory_Release(factory); + + CoUninitialize();
MFShutdown(); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfmediaengine/tests/Makefile.in | 2 +- dlls/mfmediaengine/tests/mfmediaengine.c | 196 +++++++++++++++++++++++ 2 files changed, 197 insertions(+), 1 deletion(-)
diff --git a/dlls/mfmediaengine/tests/Makefile.in b/dlls/mfmediaengine/tests/Makefile.in index d508db9f6f5..88758f7a613 100644 --- a/dlls/mfmediaengine/tests/Makefile.in +++ b/dlls/mfmediaengine/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = mfmediaengine.dll -IMPORTS = ole32 mfplat mfmediaengine mfuuid uuid +IMPORTS = ole32 mfplat mfmediaengine oleaut32 mfuuid uuid
C_SRCS = \ mfmediaengine.c diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 14d9eed453e..07bd8c81e67 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -105,6 +105,34 @@ static IMFMediaEngineNotifyVtbl media_engine_notify_vtbl = media_engine_notify_EventNotify, };
+static IMFMediaEngine *create_media_engine(IMFMediaEngineNotify *callback) +{ + IMFDXGIDeviceManager *manager; + IMFMediaEngine *media_engine; + IMFAttributes *attributes; + UINT token; + HRESULT hr; + + hr = pMFCreateDXGIDeviceManager(&token, &manager); + ok(hr == S_OK, "Failed to create dxgi device manager, hr %#x.\n", hr); + + hr = MFCreateAttributes(&attributes, 3); + ok(hr == S_OK, "Failed to create attributes, hr %#x.\n", hr); + + hr = IMFAttributes_SetUnknown(attributes, &MF_MEDIA_ENGINE_CALLBACK, (IUnknown *)callback); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + hr = IMFAttributes_SetUINT32(attributes, &MF_MEDIA_ENGINE_VIDEO_OUTPUT_FORMAT, DXGI_FORMAT_UNKNOWN); + ok(hr == S_OK, "Failed to set attribute, hr %#x.\n", hr); + + hr = IMFMediaEngineClassFactory_CreateInstance(factory, 0, attributes, &media_engine); + ok(hr == S_OK, "Failed to create media engine, hr %#x.\n", hr); + + IMFAttributes_Release(attributes); + IMFDXGIDeviceManager_Release(manager); + + return media_engine; +} + static void test_factory(void) { struct media_engine_notify notify_impl = {{&media_engine_notify_vtbl}, 1}; @@ -204,6 +232,173 @@ static void test_CreateInstance(void) IMFDXGIDeviceManager_Release(manager); }
+static void test_Shutdown(void) +{ + struct media_engine_notify notify_impl = {{&media_engine_notify_vtbl}, 1}; + IMFMediaEngineNotify *callback = ¬ify_impl.IMFMediaEngineNotify_iface; + IMFMediaTimeRange *time_range; + IMFMediaEngine *media_engine; + unsigned int state; + DWORD cx, cy; + double val; + HRESULT hr; + BSTR str; + + media_engine = create_media_engine(callback); + + hr = IMFMediaEngine_Shutdown(media_engine); +todo_wine + ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); + + hr = IMFMediaEngine_Shutdown(media_engine); +todo_wine + ok(hr == MF_E_SHUTDOWN || broken(hr == S_OK) /* before win10 */, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_SetSource(media_engine, NULL); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_GetCurrentSource(media_engine, &str); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetNetworkState(media_engine); + ok(!state, "Unexpected state %d.\n", state); + + /* 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_GetBuffered(media_engine, &time_range); +todo_wine + 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); + + state = IMFMediaEngine_GetReadyState(media_engine); + ok(!state, "Unexpected state %d.\n", state); + + state = IMFMediaEngine_IsSeeking(media_engine); + ok(!state, "Unexpected state %d.\n", state); + + val = IMFMediaEngine_GetCurrentTime(media_engine); + 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); + ok(val == 0.0, "Unexpected time %f.\n", val); + + state = IMFMediaEngine_IsPaused(media_engine); +todo_wine + ok(!!state, "Unexpected state %d.\n", state); + + val = IMFMediaEngine_GetDefaultPlaybackRate(media_engine); +todo_wine + ok(val == 1.0, "Unexpected rate %f.\n", val); + + hr = IMFMediaEngine_SetDefaultPlaybackRate(media_engine, 2.0); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + val = IMFMediaEngine_GetPlaybackRate(media_engine); +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); + ok(!state, "Unexpected state %d.\n", state); + + /* Autoplay mode is still accessible. */ + state = IMFMediaEngine_GetAutoPlay(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_SetAutoPlay(media_engine, TRUE); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetAutoPlay(media_engine); +todo_wine + ok(!!state, "Unexpected state.\n"); + + /* Loop mode is still accessible. */ + state = IMFMediaEngine_GetLoop(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_SetLoop(media_engine, TRUE); +todo_wine + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetLoop(media_engine); +todo_wine + ok(!!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_Play(media_engine); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_Pause(media_engine); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_GetMuted(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_SetMuted(media_engine, TRUE); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + val = IMFMediaEngine_GetVolume(media_engine); +todo_wine + ok(val == 1.0, "Unexpected value %f.\n", val); + + val = IMFMediaEngine_SetVolume(media_engine, 2.0); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + state = IMFMediaEngine_HasVideo(media_engine); + ok(!state, "Unexpected state.\n"); + + state = IMFMediaEngine_HasAudio(media_engine); + ok(!state, "Unexpected state.\n"); + + hr = IMFMediaEngine_GetNativeVideoSize(media_engine, &cx, &cy); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + hr = IMFMediaEngine_GetVideoAspectRatio(media_engine, &cx, &cy); +todo_wine + ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr); + + IMFMediaEngine_Release(media_engine); +} + START_TEST(mfmediaengine) { HRESULT hr; @@ -226,6 +421,7 @@ START_TEST(mfmediaengine)
test_factory(); test_CreateInstance(); + test_Shutdown();
IMFMediaEngineClassFactory_Release(factory);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfmediaengine/main.c | 38 ++++++++++++++++++------ dlls/mfmediaengine/tests/mfmediaengine.c | 2 -- 2 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 050743e7e33..0c082a87f5f 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -54,16 +54,24 @@ enum media_engine_mode MEDIA_ENGINE_FRAME_SERVER_MODE, };
+/* Used with create flags. */ +enum media_engine_flags +{ + /* MF_MEDIA_ENGINE_CREATEFLAGS_MASK is 0x1f. */ + FLAGS_ENGINE_SHUT_DOWN = 0x20, +}; + struct media_engine { IMFMediaEngine IMFMediaEngine_iface; LONG refcount; - DWORD flags; IMFMediaEngineNotify *callback; UINT64 playback_hwnd; DXGI_FORMAT output_format; IMFDXGIDeviceManager *dxgi_manager; enum media_engine_mode mode; + unsigned int flags; + CRITICAL_SECTION cs; };
static inline struct media_engine *impl_from_IMFMediaEngine(IMFMediaEngine *iface) @@ -104,6 +112,7 @@ static void free_media_engine(struct media_engine *engine) IMFMediaEngineNotify_Release(engine->callback); if (engine->dxgi_manager) IMFDXGIDeviceManager_Release(engine->dxgi_manager); + DeleteCriticalSection(&engine->cs); heap_free(engine); }
@@ -395,9 +404,19 @@ static HRESULT WINAPI media_engine_GetVideoAspectRatio(IMFMediaEngine *iface, DW
static HRESULT WINAPI media_engine_Shutdown(IMFMediaEngine *iface) { + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + HRESULT hr = S_OK; + FIXME("(%p): stub.\n", iface);
- return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + if (engine->flags & FLAGS_ENGINE_SHUT_DOWN) + hr = MF_E_SHUTDOWN; + else + engine->flags |= FLAGS_ENGINE_SHUT_DOWN; + LeaveCriticalSection(&engine->cs); + + return hr; }
static HRESULT WINAPI media_engine_TransferVideoFrame(IMFMediaEngine *iface, IUnknown *surface, @@ -490,10 +509,15 @@ static ULONG WINAPI media_engine_factory_Release(IMFMediaEngineClassFactory *ifa return 1; }
-static HRESULT init_media_engine(IMFAttributes *attributes, struct media_engine *engine) +static HRESULT init_media_engine(DWORD flags, IMFAttributes *attributes, struct media_engine *engine) { HRESULT hr;
+ engine->IMFMediaEngine_iface.lpVtbl = &media_engine_vtbl; + engine->refcount = 1; + engine->flags = flags & MF_MEDIA_ENGINE_CREATEFLAGS_MASK; + InitializeCriticalSection(&engine->cs); + hr = IMFAttributes_GetUnknown(attributes, &MF_MEDIA_ENGINE_CALLBACK, &IID_IMFMediaEngineNotify, (void **)&engine->callback); if (FAILED(hr)) @@ -522,7 +546,7 @@ static HRESULT WINAPI media_engine_factory_CreateInstance(IMFMediaEngineClassFac struct media_engine *object; HRESULT hr;
- TRACE("(%p, %#x, %p, %p).\n", iface, flags, attributes, engine); + TRACE("%p, %#x, %p, %p.\n", iface, flags, attributes, engine);
if (!attributes || !engine) return E_POINTER; @@ -531,17 +555,13 @@ static HRESULT WINAPI media_engine_factory_CreateInstance(IMFMediaEngineClassFac if (!object) return E_OUTOFMEMORY;
- hr = init_media_engine(attributes, object); + hr = init_media_engine(flags, attributes, object); if (FAILED(hr)) { free_media_engine(object); return hr; }
- object->IMFMediaEngine_iface.lpVtbl = &media_engine_vtbl; - object->refcount = 1; - object->flags = flags; - *engine = &object->IMFMediaEngine_iface;
return S_OK; diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 07bd8c81e67..d3c15566a43 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -247,11 +247,9 @@ static void test_Shutdown(void) media_engine = create_media_engine(callback);
hr = IMFMediaEngine_Shutdown(media_engine); -todo_wine ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr);
hr = IMFMediaEngine_Shutdown(media_engine); -todo_wine ok(hr == MF_E_SHUTDOWN || broken(hr == S_OK) /* before win10 */, "Unexpected hr %#x.\n", hr);
hr = IMFMediaEngine_SetSource(media_engine, NULL);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfmediaengine/main.c | 28 +++++++++++++++++++++--- dlls/mfmediaengine/tests/mfmediaengine.c | 1 - 2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 0c082a87f5f..7053a3afea3 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -59,6 +59,7 @@ enum media_engine_flags { /* MF_MEDIA_ENGINE_CREATEFLAGS_MASK is 0x1f. */ FLAGS_ENGINE_SHUT_DOWN = 0x20, + FLAGS_ENGINE_AUTO_PLAY = 0x40, };
struct media_engine @@ -74,6 +75,14 @@ struct media_engine CRITICAL_SECTION cs; };
+static void media_engine_set_flag(struct media_engine *engine, unsigned int mask, BOOL value) +{ + if (value) + engine->flags |= mask; + else + engine->flags &= ~mask; +} + static inline struct media_engine *impl_from_IMFMediaEngine(IMFMediaEngine *iface) { return CONTAINING_RECORD(iface, struct media_engine, IMFMediaEngine_iface); @@ -306,16 +315,29 @@ static BOOL WINAPI media_engine_IsEnded(IMFMediaEngine *iface)
static BOOL WINAPI media_engine_GetAutoPlay(IMFMediaEngine *iface) { - FIXME("(%p): stub.\n", iface); + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + BOOL value;
- return FALSE; + TRACE("%p.\n", iface); + + EnterCriticalSection(&engine->cs); + value = !!(engine->flags & FLAGS_ENGINE_AUTO_PLAY); + LeaveCriticalSection(&engine->cs); + + return value; }
static HRESULT WINAPI media_engine_SetAutoPlay(IMFMediaEngine *iface, BOOL autoplay) { + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + FIXME("(%p, %d): stub.\n", iface, autoplay);
- return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + media_engine_set_flag(engine, FLAGS_ENGINE_AUTO_PLAY, autoplay); + LeaveCriticalSection(&engine->cs); + + return S_OK; }
static BOOL WINAPI media_engine_GetLoop(IMFMediaEngine *iface) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index d3c15566a43..8f6c4ca75bb 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -338,7 +338,6 @@ todo_wine ok(!state, "Unexpected state.\n");
hr = IMFMediaEngine_SetAutoPlay(media_engine, TRUE); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
state = IMFMediaEngine_GetAutoPlay(media_engine);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=72427
Your paranoid android.
=== debiant (32 bit report) ===
mfmediaengine: mfmediaengine.c:345: Test succeeded inside todo block: Unexpected state.
=== debiant (32 bit French report) ===
mfmediaengine: mfmediaengine.c:345: Test succeeded inside todo block: Unexpected state.
=== debiant (32 bit Japanese:Japan report) ===
mfmediaengine: mfmediaengine.c:345: Test succeeded inside todo block: Unexpected state.
=== debiant (32 bit Chinese:China report) ===
mfmediaengine: mfmediaengine.c:345: Test succeeded inside todo block: Unexpected state.
=== debiant (32 bit WoW report) ===
mfmediaengine: mfmediaengine.c:345: Test succeeded inside todo block: Unexpected state.
=== debiant (64 bit WoW report) ===
mfmediaengine: mfmediaengine.c:345: Test succeeded inside todo block: Unexpected state.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfmediaengine/main.c | 20 +++++++++++++++++--- dlls/mfmediaengine/tests/mfmediaengine.c | 3 --- 2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/mfmediaengine/main.c b/dlls/mfmediaengine/main.c index 7053a3afea3..eef485e315b 100644 --- a/dlls/mfmediaengine/main.c +++ b/dlls/mfmediaengine/main.c @@ -60,6 +60,7 @@ enum media_engine_flags /* MF_MEDIA_ENGINE_CREATEFLAGS_MASK is 0x1f. */ FLAGS_ENGINE_SHUT_DOWN = 0x20, FLAGS_ENGINE_AUTO_PLAY = 0x40, + FLAGS_ENGINE_LOOP = 0x80, };
struct media_engine @@ -342,16 +343,29 @@ static HRESULT WINAPI media_engine_SetAutoPlay(IMFMediaEngine *iface, BOOL autop
static BOOL WINAPI media_engine_GetLoop(IMFMediaEngine *iface) { - FIXME("(%p): stub.\n", iface); + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + BOOL value;
- return FALSE; + TRACE("%p.\n", iface); + + EnterCriticalSection(&engine->cs); + value = !!(engine->flags & FLAGS_ENGINE_LOOP); + LeaveCriticalSection(&engine->cs); + + return value; }
static HRESULT WINAPI media_engine_SetLoop(IMFMediaEngine *iface, BOOL loop) { + struct media_engine *engine = impl_from_IMFMediaEngine(iface); + FIXME("(%p, %d): stub.\n", iface, loop);
- return E_NOTIMPL; + EnterCriticalSection(&engine->cs); + media_engine_set_flag(engine, FLAGS_ENGINE_LOOP, loop); + LeaveCriticalSection(&engine->cs); + + return S_OK; }
static HRESULT WINAPI media_engine_Play(IMFMediaEngine *iface) diff --git a/dlls/mfmediaengine/tests/mfmediaengine.c b/dlls/mfmediaengine/tests/mfmediaengine.c index 8f6c4ca75bb..504464b5272 100644 --- a/dlls/mfmediaengine/tests/mfmediaengine.c +++ b/dlls/mfmediaengine/tests/mfmediaengine.c @@ -341,7 +341,6 @@ todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
state = IMFMediaEngine_GetAutoPlay(media_engine); -todo_wine ok(!!state, "Unexpected state.\n");
/* Loop mode is still accessible. */ @@ -349,11 +348,9 @@ todo_wine ok(!state, "Unexpected state.\n");
hr = IMFMediaEngine_SetLoop(media_engine, TRUE); -todo_wine ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
state = IMFMediaEngine_GetLoop(media_engine); -todo_wine ok(!!state, "Unexpected state.\n");
hr = IMFMediaEngine_Play(media_engine);