From 9446458f750d5d81bbc36a5067fdcac67153e9fe Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Fri, 29 Jan 2021 15:10:02 +0300 Subject: [PATCH] mf/session: Add a stub for IMFTopologyNodeAttributeEditor. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/mf/session.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/mf/tests/mf.c | 9 ++++++++ 2 files changed, 66 insertions(+) diff --git a/dlls/mf/session.c b/dlls/mf/session.c index af0407f6a0b..5034255339c 100644 --- a/dlls/mf/session.c +++ b/dlls/mf/session.c @@ -213,6 +213,7 @@ struct media_session IMFGetService IMFGetService_iface; IMFRateSupport IMFRateSupport_iface; IMFRateControl IMFRateControl_iface; + IMFTopologyNodeAttributeEditor IMFTopologyNodeAttributeEditor_iface; IMFAsyncCallback commands_callback; IMFAsyncCallback events_callback; IMFAsyncCallback sink_finalizer_callback; @@ -362,6 +363,11 @@ static struct media_session *impl_session_from_IMFRateControl(IMFRateControl *if return CONTAINING_RECORD(iface, struct media_session, IMFRateControl_iface); } +static struct media_session *impl_session_from_IMFTopologyNodeAttributeEditor(IMFTopologyNodeAttributeEditor *iface) +{ + return CONTAINING_RECORD(iface, struct media_session, IMFTopologyNodeAttributeEditor_iface); +} + static struct session_op *impl_op_from_IUnknown(IUnknown *iface) { return CONTAINING_RECORD(iface, struct session_op, IUnknown_iface); @@ -1999,6 +2005,10 @@ static HRESULT WINAPI session_get_service_GetService(IMFGetService *iface, REFGU { return IMFLocalMFTRegistration_QueryInterface(&local_mft_registration, riid, obj); } + else if (IsEqualGUID(service, &MF_TOPONODE_ATTRIBUTE_EDITOR_SERVICE)) + { + *obj = &session->IMFTopologyNodeAttributeEditor_iface; + } else if (IsEqualGUID(service, &MR_VIDEO_RENDER_SERVICE)) { IMFStreamSink *stream_sink; @@ -3566,6 +3576,52 @@ static const IMFRateControlVtbl session_rate_control_vtbl = session_rate_control_GetRate, }; +static HRESULT WINAPI node_attribute_editor_QueryInterface(IMFTopologyNodeAttributeEditor *iface, + REFIID riid, void **obj) +{ + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj); + + if (IsEqualIID(riid, &IID_IMFTopologyNodeAttributeEditor) || + IsEqualIID(riid, &IID_IUnknown)) + { + *obj = iface; + IMFTopologyNodeAttributeEditor_AddRef(iface); + return S_OK; + } + + WARN("Unsupported interface %s.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI node_attribute_editor_AddRef(IMFTopologyNodeAttributeEditor *iface) +{ + struct media_session *session = impl_session_from_IMFTopologyNodeAttributeEditor(iface); + return IMFMediaSession_AddRef(&session->IMFMediaSession_iface); +} + +static ULONG WINAPI node_attribute_editor_Release(IMFTopologyNodeAttributeEditor *iface) +{ + struct media_session *session = impl_session_from_IMFTopologyNodeAttributeEditor(iface); + return IMFMediaSession_Release(&session->IMFMediaSession_iface); +} + +static HRESULT WINAPI node_attribute_editor_UpdateNodeAttributes(IMFTopologyNodeAttributeEditor *iface, + TOPOID id, DWORD count, MFTOPONODE_ATTRIBUTE_UPDATE *updates) +{ + FIXME("%p, %s, %u, %p.\n", iface, wine_dbgstr_longlong(id), count, updates); + + return E_NOTIMPL; +} + +static const IMFTopologyNodeAttributeEditorVtbl node_attribute_editor_vtbl = +{ + node_attribute_editor_QueryInterface, + node_attribute_editor_AddRef, + node_attribute_editor_Release, + node_attribute_editor_UpdateNodeAttributes, +}; + /*********************************************************************** * MFCreateMediaSession (mf.@) */ @@ -3585,6 +3641,7 @@ HRESULT WINAPI MFCreateMediaSession(IMFAttributes *config, IMFMediaSession **ses object->IMFGetService_iface.lpVtbl = &session_get_service_vtbl; object->IMFRateSupport_iface.lpVtbl = &session_rate_support_vtbl; object->IMFRateControl_iface.lpVtbl = &session_rate_control_vtbl; + object->IMFTopologyNodeAttributeEditor_iface.lpVtbl = &node_attribute_editor_vtbl; object->commands_callback.lpVtbl = &session_commands_callback_vtbl; object->events_callback.lpVtbl = &session_events_callback_vtbl; object->sink_finalizer_callback.lpVtbl = &session_sink_finalizer_callback_vtbl; diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index 34090d0a9d4..846d311c877 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1176,6 +1176,15 @@ static void test_media_session(void) check_interface(session, &IID_IMFGetService, TRUE); check_interface(session, &IID_IMFAttributes, FALSE); + check_interface(session, &IID_IMFTopologyNodeAttributeEditor, FALSE); + + hr = MFGetService((IUnknown *)session, &MF_TOPONODE_ATTRIBUTE_EDITOR_SERVICE, &IID_IMFTopologyNodeAttributeEditor, + (void **)&unk); + ok(hr == S_OK, "Unexpected hr %#x.\n", hr); + + check_interface(unk, &IID_IMFMediaSession, FALSE); + + IUnknown_Release(unk); hr = MFGetService((IUnknown *)session, &MF_RATE_CONTROL_SERVICE, &IID_IMFRateSupport, (void **)&rate_support); ok(hr == S_OK, "Failed to get rate support interface, hr %#x.\n", hr);