Signed-off-by: Zebediah Figura z.figura12@gmail.com --- In the long (or even short) term I'd like to move IBaseFilter methods into the filter function table (and, looking forward, probably IPin methods into the pin function table, and so on), and make the whole IBaseFilterVtbl the sole responsibility of strmbase. The idea is partly to decrease the API size for filters, partly to decrease the amount of boilerplate, partly to make state tracking done in a consistent manner (instead of e.g. having both filters and strmbase manage the filter state, depending on who needs to implement Run/Pause/Stop/GetState.) As such the methods probably won't even look exactly the same, e.g. my current idea is something like:
struct strmbase_filter_func_table { IPin *(*filter_get_pin)(BaseFilter *iface, unsigned int index); void (*filter_destroy)(BaseFilter *iface); HRESULT (*filter_query_interface)(BaseFilter *iface, REFIID iid, void **out); HRESULT (*stop)(BaseFilter *iface); HRESULT (*pause)(BaseFilter *iface); HRESULT (*run)(BaseFilter *iface); HRESULT (*wait_state)(BaseFilter *iface, DWORD timeout); };
where only the first two are mandatory, and the others are all optional.
In the somewhat shorter term this is aimed towards making it easier to support filter aggregation in strmbase.
dlls/strmbase/filter.c | 4 ++-- include/wine/strmbase.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/strmbase/filter.c b/dlls/strmbase/filter.c index f9dd72c73c..cf8000fc64 100644 --- a/dlls/strmbase/filter.c +++ b/dlls/strmbase/filter.c @@ -54,7 +54,7 @@ ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter * iface) return refCount; }
-ULONG WINAPI BaseFilterImpl_Release(IBaseFilter * iface) +ULONG WINAPI BaseFilterImpl_Release(IBaseFilter *iface) { BaseFilter *This = impl_from_IBaseFilter(iface); ULONG refCount = InterlockedDecrement(&This->refCount); @@ -62,7 +62,7 @@ ULONG WINAPI BaseFilterImpl_Release(IBaseFilter * iface) TRACE("(%p)->() Release from %d\n", This, refCount + 1);
if (!refCount) - strmbase_filter_cleanup(This); + This->pFuncsTable->filter_destroy(This);
return refCount; } diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 7c44b36cf1..307204e0e0 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -171,6 +171,7 @@ typedef struct BaseFilter typedef struct BaseFilterFuncTable { IPin *(*filter_get_pin)(BaseFilter *iface, unsigned int index); + void (*filter_destroy)(BaseFilter *iface); } BaseFilterFuncTable;
HRESULT WINAPI BaseFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);