diff --git a/dlls/strmbase/filter.c b/dlls/strmbase/filter.c index cf8000fc645..1af955fd091 100644 --- a/dlls/strmbase/filter.c +++ b/dlls/strmbase/filter.c @@ -27,20 +27,32 @@ static inline BaseFilter *impl_from_IBaseFilter(IBaseFilter *iface) return CONTAINING_RECORD(iface, BaseFilter, IBaseFilter_iface); } -HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv) +HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter *iface, REFIID iid, void **out) { - TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); + BaseFilter *filter = impl_from_IBaseFilter(iface); + HRESULT hr; - *ppv = NULL; + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); - if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPersist) || - IsEqualIID(riid, &IID_IMediaFilter) || IsEqualIID(riid, &IID_IBaseFilter)) + *out = NULL; + + if (filter->pFuncsTable->filter_query_interface + && SUCCEEDED(hr = filter->pFuncsTable->filter_query_interface(filter, iid, out))) { - *ppv = iface; + return hr; + } + + if (IsEqualIID(iid, &IID_IUnknown) + || IsEqualIID(iid, &IID_IPersist) + || IsEqualIID(iid, &IID_IMediaFilter) + || IsEqualIID(iid, &IID_IBaseFilter)) + { + *out = iface; IBaseFilter_AddRef(iface); return S_OK; } + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); return E_NOINTERFACE; } diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 9bc13deeecb..1d36f133d3d 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -172,6 +172,7 @@ typedef struct BaseFilterFuncTable { IPin *(*filter_get_pin)(BaseFilter *iface, unsigned int index); void (*filter_destroy)(BaseFilter *iface); + HRESULT (*filter_query_interface)(BaseFilter *iface, REFIID iid, void **out); } BaseFilterFuncTable; HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);