Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mf/sar.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 6 +++ include/mfidl.idl | 16 ++++++++ 3 files changed, 117 insertions(+)
diff --git a/dlls/mf/sar.c b/dlls/mf/sar.c index 04b1d7a684..7fefadeef2 100644 --- a/dlls/mf/sar.c +++ b/dlls/mf/sar.c @@ -51,6 +51,7 @@ struct audio_renderer IMFGetService IMFGetService_iface; IMFSimpleAudioVolume IMFSimpleAudioVolume_iface; IMFAudioStreamVolume IMFAudioStreamVolume_iface; + IMFAudioPolicy IMFAudioPolicy_iface; LONG refcount; IMFMediaEventQueue *event_queue; IMFPresentationClock *clock; @@ -94,6 +95,11 @@ static struct audio_renderer *impl_from_IMFAudioStreamVolume(IMFAudioStreamVolum return CONTAINING_RECORD(iface, struct audio_renderer, IMFAudioStreamVolume_iface); }
+static struct audio_renderer *impl_from_IMFAudioPolicy(IMFAudioPolicy *iface) +{ + return CONTAINING_RECORD(iface, struct audio_renderer, IMFAudioPolicy_iface); +} + static struct audio_renderer_stream *impl_from_IMFStreamSink(IMFStreamSink *iface) { return CONTAINING_RECORD(iface, struct audio_renderer_stream, IMFStreamSink_iface); @@ -577,6 +583,10 @@ static HRESULT WINAPI audio_renderer_get_service_GetService(IMFGetService *iface { *obj = &renderer->IMFAudioStreamVolume_iface; } + else if (IsEqualGUID(service, &MR_AUDIO_POLICY_SERVICE) && IsEqualIID(riid, &IID_IMFAudioPolicy)) + { + *obj = &renderer->IMFAudioPolicy_iface; + } else FIXME("Unsupported service %s, interface %s.\n", debugstr_guid(service), debugstr_guid(riid));
@@ -739,6 +749,90 @@ static const IMFAudioStreamVolumeVtbl audio_renderer_stream_volume_vtbl = audio_renderer_stream_volume_GetAllVolumes, };
+static HRESULT WINAPI audio_renderer_policy_QueryInterface(IMFAudioPolicy *iface, REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IMFAudioPolicy) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFAudioPolicy_AddRef(iface); + return S_OK; + } + + WARN("Unsupported interface %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI audio_renderer_policy_AddRef(IMFAudioPolicy *iface) +{ + struct audio_renderer *renderer = impl_from_IMFAudioPolicy(iface); + return IMFMediaSink_AddRef(&renderer->IMFMediaSink_iface); +} + +static ULONG WINAPI audio_renderer_policy_Release(IMFAudioPolicy *iface) +{ + struct audio_renderer *renderer = impl_from_IMFAudioPolicy(iface); + return IMFMediaSink_Release(&renderer->IMFMediaSink_iface); +} + +static HRESULT WINAPI audio_renderer_policy_SetGroupingParam(IMFAudioPolicy *iface, REFGUID param) +{ + FIXME("%p, %s.\n", iface, debugstr_guid(param)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI audio_renderer_policy_GetGroupingParam(IMFAudioPolicy *iface, GUID *param) +{ + FIXME("%p, %p.\n", iface, param); + + return E_NOTIMPL; +} + +static HRESULT WINAPI audio_renderer_policy_SetDisplayName(IMFAudioPolicy *iface, const WCHAR *name) +{ + FIXME("%p, %s.\n", iface, debugstr_w(name)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI audio_renderer_policy_GetDisplayName(IMFAudioPolicy *iface, WCHAR **name) +{ + FIXME("%p, %p.\n", iface, name); + + return E_NOTIMPL; +} + +static HRESULT WINAPI audio_renderer_policy_SetIconPath(IMFAudioPolicy *iface, const WCHAR *path) +{ + FIXME("%p, %s.\n", iface, debugstr_w(path)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI audio_renderer_policy_GetIconPath(IMFAudioPolicy *iface, WCHAR **path) +{ + FIXME("%p, %p.\n", iface, path); + + return E_NOTIMPL; +} + +static const IMFAudioPolicyVtbl audio_renderer_policy_vtbl = +{ + audio_renderer_policy_QueryInterface, + audio_renderer_policy_AddRef, + audio_renderer_policy_Release, + audio_renderer_policy_SetGroupingParam, + audio_renderer_policy_GetGroupingParam, + audio_renderer_policy_SetDisplayName, + audio_renderer_policy_GetDisplayName, + audio_renderer_policy_SetIconPath, + audio_renderer_policy_GetIconPath, +}; + static HRESULT sar_create_mmdevice(IMFAttributes *attributes, IMMDevice **device) { WCHAR *endpoint; @@ -1115,6 +1209,7 @@ static HRESULT sar_create_object(IMFAttributes *attributes, void *user_context, renderer->IMFGetService_iface.lpVtbl = &audio_renderer_get_service_vtbl; renderer->IMFSimpleAudioVolume_iface.lpVtbl = &audio_renderer_simple_volume_vtbl; renderer->IMFAudioStreamVolume_iface.lpVtbl = &audio_renderer_stream_volume_vtbl; + renderer->IMFAudioPolicy_iface.lpVtbl = &audio_renderer_policy_vtbl; renderer->refcount = 1; InitializeCriticalSection(&renderer->cs);
diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index fbcbb6272b..789b4d0494 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -2820,6 +2820,12 @@ if (SUCCEEDED(hr)) ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr); IUnknown_Release(unk);
+ hr = MFGetService((IUnknown *)sink, &MR_AUDIO_POLICY_SERVICE, &IID_IMFAudioPolicy, (void **)&unk); +todo_wine + ok(hr == MF_E_NOT_INITIALIZED, "Failed to get interface, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); + /* Shutdown */ hr = IMFMediaSink_Shutdown(sink); ok(hr == S_OK, "Failed to shut down, hr %#x.\n", hr); diff --git a/include/mfidl.idl b/include/mfidl.idl index 13286296bc..e5cd34b5d7 100644 --- a/include/mfidl.idl +++ b/include/mfidl.idl @@ -989,6 +989,21 @@ interface IMFAudioStreamVolume : IUnknown [out, size_is(count)] float *volumes); }
+[ + object, + uuid(a0638c2b-6465-4395-9ae7-a321a9fd2856), + local +] +interface IMFAudioPolicy : IUnknown +{ + HRESULT SetGroupingParam([in] REFGUID param); + HRESULT GetGroupingParam([out] GUID *param); + HRESULT SetDisplayName([in] LPCWSTR name); + HRESULT GetDisplayName([out] LPWSTR *name); + HRESULT SetIconPath([in] LPCWSTR path); + HRESULT GetIconPath([out] LPWSTR *path); +} + cpp_quote("#ifdef __cplusplus") cpp_quote("static inline HRESULT MFSetAttributeSize(IMFAttributes *attributes, REFGUID key, UINT32 width, UINT32 height)") cpp_quote("{") @@ -1092,6 +1107,7 @@ cpp_quote("EXTERN_C const GUID MF_SCRUBBING_SERVICE;") cpp_quote("EXTERN_GUID(MR_POLICY_VOLUME_SERVICE, 0x1abaa2ac, 0x9d3b, 0x47c6, 0xab, 0x48, 0xc5, 0x95, 0x06, 0xde, 0x78, 0x4d);") cpp_quote("EXTERN_GUID(MR_CAPTURE_POLICY_VOLUME_SERVICE, 0x24030acd, 0x107a, 0x4265, 0x97, 0x5c, 0x41, 0x4e, 0x33, 0xe6, 0x5f, 0x2a);") cpp_quote("EXTERN_GUID(MR_STREAM_VOLUME_SERVICE, 0xf8b5fa2f, 0x32ef, 0x46f5, 0xb1, 0x72, 0x13, 0x21, 0x21, 0x2f, 0xb2, 0xc4);") +cpp_quote("EXTERN_GUID(MR_AUDIO_POLICY_SERVICE, 0x911fd737, 0x6775, 0x4ab0, 0xa6, 0x14, 0x29, 0x78, 0x62, 0xfd, 0xac, 0x88);")
cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_SAMPLE_TIME_OFFSET, 0x62e3d776, 0x8100, 0x4e03, 0xa6, 0xe8, 0xbd, 0x38, 0x57, 0xac, 0x9c, 0x47);") cpp_quote("EXTERN_GUID(MF_SAMPLEGRABBERSINK_IGNORE_CLOCK, 0x0efda2c0, 0x2b69, 0x4e2e, 0xab, 0x8d, 0x46, 0xdc, 0xbf, 0xf7, 0xd2, 0x5d);")