Commit 12c28aa2 authored by Bernhard Kölbl's avatar Bernhard Kölbl Committed by Alexandre Julliard

mfmediaengine: Pass volume changes to media session.

parent edee5538
......@@ -835,6 +835,23 @@ static void media_engine_get_frame_size(struct media_engine *engine, IMFTopology
IMFMediaType_Release(media_type);
}
static void media_engine_apply_volume(const struct media_engine *engine)
{
IMFSimpleAudioVolume *sa_volume;
HRESULT hr;
if (!engine->session)
return;
if (FAILED(MFGetService((IUnknown *)engine->session, &MR_POLICY_VOLUME_SERVICE, &IID_IMFSimpleAudioVolume, (void **)&sa_volume)))
return;
if (FAILED(hr = IMFSimpleAudioVolume_SetMasterVolume(sa_volume, engine->volume)))
WARN("Failed to set master volume, hr %#lx.\n", hr);
IMFSimpleAudioVolume_Release(sa_volume);
}
static HRESULT WINAPI media_engine_callback_QueryInterface(IMFAsyncCallback *iface, REFIID riid, void **obj)
{
if (IsEqualIID(riid, &IID_IMFAsyncCallback) ||
......@@ -918,6 +935,8 @@ static HRESULT WINAPI media_engine_session_events_Invoke(IMFAsyncCallback *iface
EnterCriticalSection(&engine->cs);
media_engine_apply_volume(engine);
engine->ready_state = MF_MEDIA_ENGINE_READY_HAVE_METADATA;
media_engine_get_frame_size(engine, topology);
......@@ -2009,6 +2028,7 @@ static HRESULT WINAPI media_engine_SetVolume(IMFMediaEngineEx *iface, double vol
else if (volume != engine->volume)
{
engine->volume = volume;
media_engine_apply_volume(engine);
IMFMediaEngineNotify_EventNotify(engine->callback, MF_MEDIA_ENGINE_EVENT_VOLUMECHANGE, 0, 0);
}
LeaveCriticalSection(&engine->cs);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment