From 0a4ee681682c2943b3a22e29ef995c737bb7c33b Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Fri, 5 Nov 2010 23:19:10 +0100 Subject: [PATCH] strmbase: Add support for IQualityControl. --- dlls/strmbase/Makefile.in | 1 + dlls/strmbase/qualitycontrol.c | 79 ++++++++++++++++++++++++++++++++++ include/wine/strmbase.h | 15 +++++++ 3 files changed, 95 insertions(+) create mode 100644 dlls/strmbase/qualitycontrol.c diff --git a/dlls/strmbase/Makefile.in b/dlls/strmbase/Makefile.in index 4c1f2ab0fdf..9ecb1695ae5 100644 --- a/dlls/strmbase/Makefile.in +++ b/dlls/strmbase/Makefile.in @@ -6,6 +6,7 @@ C_SRCS = \ filter.c \ mediatype.c \ pin.c \ + qualitycontrol.c \ seeking.c \ transform.c diff --git a/dlls/strmbase/qualitycontrol.c b/dlls/strmbase/qualitycontrol.c new file mode 100644 index 00000000000..d97350a259d --- /dev/null +++ b/dlls/strmbase/qualitycontrol.c @@ -0,0 +1,79 @@ +/* + * Quality Control Interfaces + * + * Copyright 2010 Maarten Lankhorst for Codeweavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "dshow.h" +#include "wine/strmbase.h" + +#include "uuids.h" +#include "wine/debug.h" + +#include + +WINE_DEFAULT_DEBUG_CHANNEL(strmbase); + +void QualityControlImpl_init(QualityControlImpl *This, IPin *input, IBaseFilter *self) { + This->input = input; + This->self = self; + This->tonotify = NULL; +} + +HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) { + QualityControlImpl *This = (QualityControlImpl*)iface; + return IUnknown_QueryInterface(This->self, riid, ppv); +} + +ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) { + QualityControlImpl *This = (QualityControlImpl*)iface; + return IUnknown_AddRef(This->self); +} + +ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) { + QualityControlImpl *This = (QualityControlImpl*)iface; + return IUnknown_Release(This->self); +} + +HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) { + HRESULT hr = S_FALSE; + QualityControlImpl *This = (QualityControlImpl*)iface; + if (This->tonotify) + return IQualityControl_Notify(This->tonotify, This->self, qm); + if (This->input) { + IPin *to = NULL; + IPin_ConnectedTo(This->input, &to); + if (to) { + IQualityControl *qc = NULL; + IUnknown_QueryInterface(to, &IID_IQualityControl, (void**)&qc); + if (qc) { + hr = IQualityControl_Notify(qc, This->self, qm); + IQualityControl_Release(qc); + } + IPin_Release(to); + } + } + return hr; +} + +HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify) { + QualityControlImpl *This = (QualityControlImpl*)iface; + This->tonotify = tonotify; + return S_OK; +} diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index e79ab376421..b7489301faf 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -194,6 +194,21 @@ HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enu HRESULT WINAPI EnumPins_Construct(BaseFilter *base, BaseFilter_GetPin receive_pin, BaseFilter_GetPinCount receive_pincount, BaseFilter_GetPinVersion receive_version, IEnumPins ** ppEnum); +/* Quality Control */ +typedef struct QualityControlImpl { + const IQualityControlVtbl *lpVtbl; + IPin *input; + IBaseFilter *self; + IQualityControl *tonotify; +} QualityControlImpl; + +void QualityControlImpl_init(QualityControlImpl *This, IPin *input, IBaseFilter *self); +HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv); +ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface); +ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface); +HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm); +HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify); + /* Transform Filter */ typedef struct TransformFilter {