Commit 75b8dcd2 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/filtergraph: Implement the IDispatch methods for IMediaEvent.

parent 8a2cdd7a
...@@ -4733,50 +4733,54 @@ static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface) ...@@ -4733,50 +4733,54 @@ static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface)
return IUnknown_Release(graph->outer_unk); return IUnknown_Release(graph->outer_unk);
} }
/*** IDispatch methods ***/ static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *count)
static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *pctinfo)
{ {
struct filter_graph *This = impl_from_IMediaEventEx(iface); TRACE("iface %p, count %p.\n", iface, count);
*count = 1;
TRACE("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
return S_OK; return S_OK;
} }
static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT iTInfo, LCID lcid, static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT index,
ITypeInfo **ppTInfo) LCID lcid, ITypeInfo **typeinfo)
{ {
struct filter_graph *This = impl_from_IMediaEventEx(iface); TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo);
return strmbase_get_typeinfo(IMediaEvent_tid, typeinfo);
TRACE("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
return S_OK;
} }
static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID riid, static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID iid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 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, TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n",
cNames, lcid, rgDispId); 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, static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID id, REFIID iid, LCID lcid,
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
UINT *puArgErr)
{ {
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, TRACE("iface %p, id %d, iid %s, lcid %#x, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr); 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) static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface, OAEVENT *event)
{ {
struct filter_graph *graph = impl_from_IMediaEventEx(iface); struct filter_graph *graph = impl_from_IMediaEventEx(iface);
......
...@@ -5663,6 +5663,40 @@ static void test_events(void) ...@@ -5663,6 +5663,40 @@ static void test_events(void)
SysFreeString(status); 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) START_TEST(filtergraph)
{ {
CoInitializeEx(NULL, COINIT_MULTITHREADED); CoInitializeEx(NULL, COINIT_MULTITHREADED);
...@@ -5690,6 +5724,7 @@ START_TEST(filtergraph) ...@@ -5690,6 +5724,7 @@ START_TEST(filtergraph)
test_autoplug_uyvy(); test_autoplug_uyvy();
test_set_notify_flags(); test_set_notify_flags();
test_events(); test_events();
test_event_dispatch();
CoUninitialize(); CoUninitialize();
test_render_with_multithread(); test_render_with_multithread();
......
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