From 245649f87adec84fcc29bca94bafa00fadef0e4b Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Tue, 11 Jun 2019 10:42:14 -0400 Subject: [PATCH] quartz/filtergraph: Use the type info cache for IVideoWindow. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/quartz/filtergraph.c | 108 ++++++++++---------------------- dlls/quartz/tests/filtergraph.c | 5 ++ 2 files changed, 39 insertions(+), 74 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 45da4f25a8b..046a0a1f190 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -4066,94 +4066,54 @@ static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface) return IUnknown_Release(This->outer_unk); } -/*** IDispatch methods ***/ -static HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface, UINT *pctinfo) +HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface, UINT *count) { - IFilterGraphImpl *This = impl_from_IVideoWindow(iface); - IVideoWindow *pVideoWindow; + TRACE("iface %p, count %p.\n", iface, count); + *count = 1; + return S_OK; +} + +HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface, UINT index, + LCID lcid, ITypeInfo **typeinfo) +{ + TRACE("iface %p, index %u, lcid %#x, typeinfo %p.\n", iface, index, lcid, typeinfo); + return strmbase_get_typeinfo(IVideoWindow_tid, typeinfo); +} + +HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface, REFIID iid, + LPOLESTR *names, UINT count, LCID lcid, DISPID *ids) +{ + ITypeInfo *typeinfo; HRESULT hr; - TRACE("(%p/%p)->(%p)\n", This, iface, pctinfo); - - EnterCriticalSection(&This->cs); - - hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow); - - if (hr == S_OK) - hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo); - - LeaveCriticalSection(&This->cs); + TRACE("iface %p, iid %s, names %p, count %u, lcid %#x, ids %p.\n", + iface, debugstr_guid(iid), names, count, lcid, ids); + if (SUCCEEDED(hr = strmbase_get_typeinfo(IVideoWindow_tid, &typeinfo))) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids); + ITypeInfo_Release(typeinfo); + } return hr; } -static HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface, UINT iTInfo, LCID lcid, - ITypeInfo **ppTInfo) +static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface, DISPID id, REFIID iid, LCID lcid, + WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg) { - IFilterGraphImpl *This = impl_from_IVideoWindow(iface); - IVideoWindow *pVideoWindow; + ITypeInfo *typeinfo; HRESULT hr; - TRACE("(%p/%p)->(%d, %d, %p)\n", This, iface, iTInfo, lcid, ppTInfo); - - EnterCriticalSection(&This->cs); - - hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow); - - if (hr == S_OK) - hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo); - - LeaveCriticalSection(&This->cs); + 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); + if (SUCCEEDED(hr = strmbase_get_typeinfo(IVideoWindow_tid, &typeinfo))) + { + hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg); + ITypeInfo_Release(typeinfo); + } return hr; } -static HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) -{ - IFilterGraphImpl *This = impl_from_IVideoWindow(iface); - IVideoWindow *pVideoWindow; - HRESULT hr; - - TRACE("(%p/%p)->(%s, %p, %d, %d, %p)\n", This, iface, debugstr_guid(riid), rgszNames, cNames, - lcid, rgDispId); - - EnterCriticalSection(&This->cs); - - hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow); - - if (hr == S_OK) - hr = IVideoWindow_GetIDsOfNames(pVideoWindow, riid, rgszNames, cNames, lcid, rgDispId); - - LeaveCriticalSection(&This->cs); - - return hr; -} - -static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface, DISPID dispIdMember, REFIID riid, - LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExepInfo, - UINT*puArgErr) -{ - IFilterGraphImpl *This = impl_from_IVideoWindow(iface); - IVideoWindow *pVideoWindow; - HRESULT hr; - - TRACE("(%p/%p)->(%d, %s, %d, %04x, %p, %p, %p, %p)\n", This, iface, dispIdMember, - debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr); - - EnterCriticalSection(&This->cs); - - hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow); - - if (hr == S_OK) - hr = IVideoWindow_Invoke(pVideoWindow, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr); - - LeaveCriticalSection(&This->cs); - - return hr; -} - - /*** IVideoWindow methods ***/ static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface, BSTR strCaption) { diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index adad45aac71..976617ea892 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -2572,9 +2572,14 @@ static void test_control_delegation(void) /* Unlike IBasicAudio, these return E_NOINTERFACE. */ hr = IBasicVideo_get_BitRate(video, &val); ok(hr == E_NOINTERFACE, "got %#x\n", hr); + hr = IVideoWindow_SetWindowForeground(window, OAFALSE); ok(hr == E_NOINTERFACE, "got %#x\n", hr); + hr = IVideoWindow_GetTypeInfoCount(window, &count); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(count == 1, "Got count %u.\n", count); + hr = CoCreateInstance(&CLSID_VideoRenderer, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void **)&renderer); ok(hr == S_OK, "got %#x\n", hr);