diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c index 30434dba3eb..78b66992a4e 100644 --- a/dlls/quartz/filtermapper.c +++ b/dlls/quartz/filtermapper.c @@ -88,9 +88,9 @@ static const GUID IID_IAMFilterData = { typedef struct FilterMapper3Impl { - const IFilterMapper3Vtbl *lpVtbl; - const IFilterMapperVtbl *lpVtblFilterMapper; - const IAMFilterDataVtbl *lpVtblAMFilterData; + IFilterMapper3 IFilterMapper3_iface; + IFilterMapper IFilterMapper_iface; + IAMFilterData IAMFilterData_iface; const IUnknownVtbl *IInner_vtbl; LONG refCount; IUnknown * pUnkOuter; @@ -103,14 +103,19 @@ static const IFilterMapper3Vtbl fm3vtbl; static const IFilterMapperVtbl fmvtbl; static const IAMFilterDataVtbl AMFilterDataVtbl; +static inline FilterMapper3Impl *impl_from_IFilterMapper3( IFilterMapper3 *iface ) +{ + return CONTAINING_RECORD(iface, FilterMapper3Impl, IFilterMapper3_iface); +} + static inline FilterMapper3Impl *impl_from_IFilterMapper( IFilterMapper *iface ) { - return (FilterMapper3Impl *)((char*)iface - FIELD_OFFSET(FilterMapper3Impl, lpVtblFilterMapper)); + return CONTAINING_RECORD(iface, FilterMapper3Impl, IFilterMapper_iface); } static inline FilterMapper3Impl *impl_from_IAMFilterData( IAMFilterData *iface ) { - return (FilterMapper3Impl *)((char*)iface - FIELD_OFFSET(FilterMapper3Impl, lpVtblAMFilterData)); + return CONTAINING_RECORD(iface, FilterMapper3Impl, IAMFilterData_iface); } static inline FilterMapper3Impl *impl_from_inner_IUnknown( IUnknown *iface ) @@ -232,9 +237,9 @@ HRESULT FilterMapper2_create(IUnknown *pUnkOuter, LPVOID *ppObj) pFM2impl->bUnkOuterValid = FALSE; pFM2impl->bAggregatable = FALSE; pFM2impl->IInner_vtbl = &IInner_VTable; - pFM2impl->lpVtbl = &fm3vtbl; - pFM2impl->lpVtblFilterMapper = &fmvtbl; - pFM2impl->lpVtblAMFilterData = &AMFilterDataVtbl; + pFM2impl->IFilterMapper3_iface.lpVtbl = &fm3vtbl; + pFM2impl->IFilterMapper_iface.lpVtbl = &fmvtbl; + pFM2impl->IAMFilterData_iface.lpVtbl = &AMFilterDataVtbl; pFM2impl->refCount = 1; *ppObj = pFM2impl; @@ -255,7 +260,7 @@ HRESULT FilterMapper_create(IUnknown *pUnkOuter, LPVOID *ppObj) if (FAILED(hr)) return hr; - *ppObj = &pFM2impl->lpVtblFilterMapper; + *ppObj = &pFM2impl->IFilterMapper_iface; return hr; } @@ -278,9 +283,9 @@ static HRESULT WINAPI Inner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID IsEqualIID(riid, &IID_IFilterMapper3)) *ppv = This; else if (IsEqualIID(riid, &IID_IFilterMapper)) - *ppv = &This->lpVtblFilterMapper; + *ppv = &This->IFilterMapper_iface; else if (IsEqualIID(riid, &IID_IAMFilterData)) - *ppv = &This->lpVtblAMFilterData; + *ppv = &This->IAMFilterData_iface; if (*ppv != NULL) { @@ -326,7 +331,7 @@ static const IUnknownVtbl IInner_VTable = static HRESULT WINAPI FilterMapper3_QueryInterface(IFilterMapper3 * iface, REFIID riid, LPVOID *ppv) { - FilterMapper3Impl *This = (FilterMapper3Impl *)iface; + FilterMapper3Impl *This = impl_from_IFilterMapper3(iface); if (This->bAggregatable) This->bUnkOuterValid = TRUE; @@ -356,7 +361,7 @@ static HRESULT WINAPI FilterMapper3_QueryInterface(IFilterMapper3 * iface, REFII static ULONG WINAPI FilterMapper3_AddRef(IFilterMapper3 * iface) { - FilterMapper3Impl *This = (FilterMapper3Impl *)iface; + FilterMapper3Impl *This = impl_from_IFilterMapper3(iface); if (This->pUnkOuter && This->bUnkOuterValid) return IUnknown_AddRef(This->pUnkOuter); @@ -365,7 +370,7 @@ static ULONG WINAPI FilterMapper3_AddRef(IFilterMapper3 * iface) static ULONG WINAPI FilterMapper3_Release(IFilterMapper3 * iface) { - FilterMapper3Impl *This = (FilterMapper3Impl *)iface; + FilterMapper3Impl *This = impl_from_IFilterMapper3(iface); if (This->pUnkOuter && This->bUnkOuterValid) return IUnknown_Release(This->pUnkOuter); @@ -1235,21 +1240,21 @@ static HRESULT WINAPI FilterMapper_QueryInterface(IFilterMapper * iface, REFIID TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv); - return FilterMapper3_QueryInterface((IFilterMapper3*)&This->lpVtbl, riid, ppv); + return FilterMapper3_QueryInterface(&This->IFilterMapper3_iface, riid, ppv); } static ULONG WINAPI FilterMapper_AddRef(IFilterMapper * iface) { FilterMapper3Impl *This = impl_from_IFilterMapper(iface); - return FilterMapper3_AddRef((IFilterMapper3*)This); + return FilterMapper3_AddRef(&This->IFilterMapper3_iface); } static ULONG WINAPI FilterMapper_Release(IFilterMapper * iface) { FilterMapper3Impl *This = impl_from_IFilterMapper(iface); - return FilterMapper3_Release((IFilterMapper3*)This); + return FilterMapper3_Release(&This->IFilterMapper3_iface); } /*** IFilterMapper methods ***/ @@ -1295,22 +1300,9 @@ static HRESULT WINAPI FilterMapper_EnumMatchingFilters( *ppEnum = NULL; - hr = IFilterMapper3_EnumMatchingFilters((IFilterMapper3*)This, - &ppEnumMoniker, - 0, - TRUE, - dwMerit, - bInputNeeded, - 1, - InputType, - NULL, - &GUID_NULL, - bRender, - bOutputNeeded, - 1, - OutputType, - NULL, - &GUID_NULL); + hr = IFilterMapper3_EnumMatchingFilters(&This->IFilterMapper3_iface, &ppEnumMoniker, 0, TRUE, + dwMerit, bInputNeeded, 1, InputType, NULL, &GUID_NULL, bRender, bOutputNeeded, 1, + OutputType, NULL, &GUID_NULL); if (FAILED(hr)) return hr; @@ -1757,21 +1749,21 @@ static HRESULT WINAPI AMFilterData_QueryInterface(IAMFilterData * iface, REFIID { FilterMapper3Impl *This = impl_from_IAMFilterData(iface); - return FilterMapper3_QueryInterface((IFilterMapper3*)This, riid, ppv); + return FilterMapper3_QueryInterface(&This->IFilterMapper3_iface, riid, ppv); } static ULONG WINAPI AMFilterData_AddRef(IAMFilterData * iface) { FilterMapper3Impl *This = impl_from_IAMFilterData(iface); - return FilterMapper3_AddRef((IFilterMapper3*)This); + return FilterMapper3_AddRef(&This->IFilterMapper3_iface); } static ULONG WINAPI AMFilterData_Release(IAMFilterData * iface) { FilterMapper3Impl *This = impl_from_IAMFilterData(iface); - return FilterMapper3_Release((IFilterMapper3*)This); + return FilterMapper3_Release(&This->IFilterMapper3_iface); } /*** IAMFilterData methods ***/