Zebediah Figura : quartz/filtergraph: Implement the IDispatch methods for IMediaEvent.
Alexandre Julliard
julliard at winehq.org
Wed Feb 2 16:38:02 CST 2022
Module: wine
Branch: master
Commit: 75b8dcd29ff5db9421e013712025dfacb8f42a0f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=75b8dcd29ff5db9421e013712025dfacb8f42a0f
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Tue Feb 1 22:37:44 2022 -0600
quartz/filtergraph: Implement the IDispatch methods for IMediaEvent.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/filtergraph.c | 58 ++++++++++++++++++++++-------------------
dlls/quartz/tests/filtergraph.c | 35 +++++++++++++++++++++++++
2 files changed, 66 insertions(+), 27 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 7e3d9fac16a..4132ffa5b2f 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -4733,50 +4733,54 @@ static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface)
return IUnknown_Release(graph->outer_unk);
}
-/*** IDispatch methods ***/
-static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *pctinfo)
+static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *count)
{
- struct filter_graph *This = impl_from_IMediaEventEx(iface);
-
- TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
-
+ TRACE("iface %p, count %p.\n", iface, count);
+ *count = 1;
return S_OK;
}
-static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT iTInfo, LCID lcid,
- ITypeInfo **ppTInfo)
+static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT index,
+ LCID lcid, ITypeInfo **typeinfo)
{
- struct filter_graph *This = impl_from_IMediaEventEx(iface);
-
- TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
-
- return S_OK;
+ TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo);
+ return strmbase_get_typeinfo(IMediaEvent_tid, typeinfo);
}
-static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID riid,
- LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID iid,
+ LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
{
- struct filter_graph *This = impl_from_IMediaEventEx(iface);
+ ITypeInfo *typeinfo;
+ HRESULT hr;
- TRACE("(%p/%p)->(%s, %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), rgszNames,
- cNames, lcid, rgDispId);
+ TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n",
+ iface, debugstr_guid(iid), names, count, lcid, ids);
- return S_OK;
+ if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaEvent_tid, &typeinfo)))
+ {
+ hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
+ ITypeInfo_Release(typeinfo);
+ }
+ return hr;
}
-static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID dispIdMember, REFIID riid,
- LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo,
- UINT *puArgErr)
+static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID id, REFIID iid, LCID lcid,
+ WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
{
- struct filter_graph *This = impl_from_IMediaEventEx(iface);
+ ITypeInfo *typeinfo;
+ HRESULT hr;
- TRACE("(%p/%p)->(%d, %s, %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember,
- debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
+ TRACE("iface %p, id %d, iid %s, lcid %#x, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
+ iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
- return S_OK;
+ if (SUCCEEDED(hr = strmbase_get_typeinfo(IMediaEvent_tid, &typeinfo)))
+ {
+ hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
+ ITypeInfo_Release(typeinfo);
+ }
+ return hr;
}
-/*** IMediaEvent methods ***/
static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface, OAEVENT *event)
{
struct filter_graph *graph = impl_from_IMediaEventEx(iface);
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 620a1a56bad..bd086445a3b 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -5663,6 +5663,40 @@ static void test_events(void)
SysFreeString(status);
}
+static void test_event_dispatch(void)
+{
+ IFilterGraph2 *graph = create_graph();
+ IMediaEventEx *event_ex;
+ ITypeInfo *typeinfo;
+ IMediaEvent *event;
+ TYPEATTR *typeattr;
+ unsigned int count;
+ HRESULT hr;
+ ULONG ref;
+
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaEvent, (void **)&event);
+ IFilterGraph2_QueryInterface(graph, &IID_IMediaEventEx, (void **)&event_ex);
+ ok((void *)event == event_ex, "Interface pointers didn't match.\n");
+ IMediaEventEx_Release(event_ex);
+
+ hr = IMediaEvent_GetTypeInfoCount(event, &count);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(count == 1, "Got count %u.\n", count);
+
+ hr = IMediaEvent_GetTypeInfo(event, 0, 0, &typeinfo);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = ITypeInfo_GetTypeAttr(typeinfo, &typeattr);
+ ok(hr == S_OK, "Got hr %#x.\n", hr);
+ ok(typeattr->typekind == TKIND_DISPATCH, "Got kind %u.\n", typeattr->typekind);
+ ok(IsEqualGUID(&typeattr->guid, &IID_IMediaEvent), "Got IID %s.\n", debugstr_guid(&typeattr->guid));
+ ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr);
+ ITypeInfo_Release(typeinfo);
+
+ IMediaEvent_Release(event);
+ ref = IFilterGraph2_Release(graph);
+ ok(!ref, "Got outstanding refcount %d.\n", ref);
+}
+
START_TEST(filtergraph)
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);
@@ -5690,6 +5724,7 @@ START_TEST(filtergraph)
test_autoplug_uyvy();
test_set_notify_flags();
test_events();
+ test_event_dispatch();
CoUninitialize();
test_render_with_multithread();
More information about the wine-cvs
mailing list