Module: wine Branch: master Commit: 487472b3f67ceeacca336cc899f7c29cd38d3336 URL: http://source.winehq.org/git/wine.git/?a=commit;h=487472b3f67ceeacca336cc899...
Author: Michael Stefaniuc mstefani@redhat.de Date: Mon Aug 3 23:28:41 2015 +0200
qcap: COM cleanup for the IKsPropertySet iface.
---
dlls/qcap/vfwcapture.c | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-)
diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index c34ab28..372e2ee 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -44,9 +44,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
-#define ICOM_THIS_MULTI(impl,field,iface) \ - impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) - static const IBaseFilterVtbl VfwCapture_Vtbl; static const IAMStreamConfigVtbl IAMStreamConfig_VTable; static const IAMVideoProcAmpVtbl IAMVideoProcAmp_VTable; @@ -103,8 +100,8 @@ static inline VfwCapture *impl_from_IPersistPropertyBag(IPersistPropertyBag *ifa typedef struct VfwPinImpl { BaseOutputPin pin; + IKsPropertySet IKsPropertySet_iface; VfwCapture *parent; - const IKsPropertySetVtbl * KSP_VT; } VfwPinImpl;
@@ -585,37 +582,30 @@ static const IPersistPropertyBagVtbl IPersistPropertyBag_VTable = };
/* IKsPropertySet interface */ -static HRESULT WINAPI -KSP_QueryInterface( IKsPropertySet * iface, REFIID riid, LPVOID * ppv ) +static inline VfwPinImpl *impl_from_IKsPropertySet(IKsPropertySet *iface) { - if (IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IKsPropertySet)) - { - *ppv = iface; - IKsPropertySet_AddRef( iface ); - return S_OK; - } + return CONTAINING_RECORD(iface, VfwPinImpl, IKsPropertySet_iface); +}
- FIXME("No interface for iid %s\n", debugstr_guid(riid)); - return E_NOINTERFACE; +static HRESULT WINAPI KSP_QueryInterface(IKsPropertySet * iface, REFIID riid, void **ret_iface) +{ + VfwPinImpl *This = impl_from_IKsPropertySet(iface); + + return IPin_QueryInterface(&This->pin.pin.IPin_iface, riid, ret_iface); }
static ULONG WINAPI KSP_AddRef(IKsPropertySet * iface) { - ICOM_THIS_MULTI(VfwPinImpl, KSP_VT, iface); + VfwPinImpl *This = impl_from_IKsPropertySet(iface);
- TRACE("%p --> Forwarding to VfwPin (%p)\n", iface, This); - - return IUnknown_AddRef((IUnknown *)This); + return IPin_AddRef(&This->pin.pin.IPin_iface); }
static ULONG WINAPI KSP_Release(IKsPropertySet * iface) { - ICOM_THIS_MULTI(VfwPinImpl, KSP_VT, iface); - - TRACE("%p --> Forwarding to VfwPin (%p)\n", iface, This); + VfwPinImpl *This = impl_from_IKsPropertySet(iface);
- return IUnknown_Release((IUnknown *)This); + return IPin_Release(&This->pin.pin.IPin_iface); }
static HRESULT WINAPI @@ -660,7 +650,7 @@ KSP_QuerySupported( IKsPropertySet * iface, REFGUID guidPropSet, return E_NOTIMPL; }
-static const IKsPropertySetVtbl KSP_VTable = +static const IKsPropertySetVtbl IKsPropertySet_VTable = { KSP_QueryInterface, KSP_AddRef, @@ -746,7 +736,7 @@ VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec, if (SUCCEEDED(hr)) { VfwPinImpl *pPinImpl = (VfwPinImpl*)*ppPin; - pPinImpl->KSP_VT = &KSP_VTable; + pPinImpl->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable; ObjectRefCount(TRUE); }
@@ -768,7 +758,7 @@ static HRESULT WINAPI VfwPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin)) *ppv = This; else if (IsEqualIID(riid, &IID_IKsPropertySet)) - *ppv = &(This->KSP_VT); + *ppv = &This->IKsPropertySet_iface; else if (IsEqualIID(riid, &IID_IAMStreamConfig)) return IUnknown_QueryInterface((IUnknown *)This->parent, riid, ppv);