mfmediaengine: Send "volumechange" event on muted state change.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
6fa8ff6930
commit
daa119581a
|
@ -63,6 +63,7 @@ enum media_engine_flags
|
|||
FLAGS_ENGINE_LOOP = 0x80,
|
||||
FLAGS_ENGINE_PAUSED = 0x100,
|
||||
FLAGS_ENGINE_WAITING = 0x200,
|
||||
FLAGS_ENGINE_MUTED = 0x400,
|
||||
};
|
||||
|
||||
struct media_engine
|
||||
|
@ -542,16 +543,36 @@ static HRESULT WINAPI media_engine_Pause(IMFMediaEngine *iface)
|
|||
|
||||
static BOOL WINAPI media_engine_GetMuted(IMFMediaEngine *iface)
|
||||
{
|
||||
FIXME("(%p): stub.\n", iface);
|
||||
struct media_engine *engine = impl_from_IMFMediaEngine(iface);
|
||||
BOOL ret;
|
||||
|
||||
return FALSE;
|
||||
TRACE("%p.\n", iface);
|
||||
|
||||
EnterCriticalSection(&engine->cs);
|
||||
ret = !!(engine->flags & FLAGS_ENGINE_MUTED);
|
||||
LeaveCriticalSection(&engine->cs);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI media_engine_SetMuted(IMFMediaEngine *iface, BOOL muted)
|
||||
{
|
||||
FIXME("(%p, %d): stub.\n", iface, muted);
|
||||
struct media_engine *engine = impl_from_IMFMediaEngine(iface);
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
return E_NOTIMPL;
|
||||
TRACE("%p, %d.\n", iface, muted);
|
||||
|
||||
EnterCriticalSection(&engine->cs);
|
||||
if (engine->flags & FLAGS_ENGINE_SHUT_DOWN)
|
||||
hr = MF_E_SHUTDOWN;
|
||||
else if (!!(engine->flags & FLAGS_ENGINE_MUTED) ^ !!muted)
|
||||
{
|
||||
media_engine_set_flag(engine, FLAGS_ENGINE_MUTED, muted);
|
||||
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_VOLUMECHANGE, 0, 0);
|
||||
}
|
||||
LeaveCriticalSection(&engine->cs);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static double WINAPI media_engine_GetVolume(IMFMediaEngine *iface)
|
||||
|
|
|
@ -361,14 +361,13 @@ todo_wine
|
|||
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);
|
||||
hr = IMFMediaEngine_SetVolume(media_engine, 2.0);
|
||||
todo_wine
|
||||
ok(hr == MF_E_SHUTDOWN, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
|
@ -465,6 +464,34 @@ static void test_playback_rate(void)
|
|||
IMFMediaEngine_Release(media_engine);
|
||||
}
|
||||
|
||||
static void test_mute(void)
|
||||
{
|
||||
struct media_engine_notify notify_impl = {{&media_engine_notify_vtbl}, 1};
|
||||
IMFMediaEngineNotify *callback = ¬ify_impl.IMFMediaEngineNotify_iface;
|
||||
IMFMediaEngine *media_engine;
|
||||
HRESULT hr;
|
||||
BOOL ret;
|
||||
|
||||
media_engine = create_media_engine(callback);
|
||||
|
||||
ret = IMFMediaEngine_GetMuted(media_engine);
|
||||
ok(!ret, "Unexpected state.\n");
|
||||
|
||||
hr = IMFMediaEngine_SetMuted(media_engine, TRUE);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
ret = IMFMediaEngine_GetMuted(media_engine);
|
||||
ok(ret, "Unexpected state.\n");
|
||||
|
||||
hr = IMFMediaEngine_Shutdown(media_engine);
|
||||
ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
ret = IMFMediaEngine_GetMuted(media_engine);
|
||||
ok(ret, "Unexpected state.\n");
|
||||
|
||||
IMFMediaEngine_Release(media_engine);
|
||||
}
|
||||
|
||||
START_TEST(mfmediaengine)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -490,6 +517,7 @@ START_TEST(mfmediaengine)
|
|||
test_Shutdown();
|
||||
test_Play();
|
||||
test_playback_rate();
|
||||
test_mute();
|
||||
|
||||
IMFMediaEngineClassFactory_Release(factory);
|
||||
|
||||
|
|
Loading…
Reference in New Issue