strmbase: Forward IQualityControl on output pin to base filter.
[wine/multimedia.git] / dlls / strmbase / qualitycontrol.c
blobd97350a259d4c7ea35c5636928140ccdae2f5776
1 /*
2 * Quality Control Interfaces
4 * Copyright 2010 Maarten Lankhorst for Codeweavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "dshow.h"
24 #include "wine/strmbase.h"
26 #include "uuids.h"
27 #include "wine/debug.h"
29 #include <assert.h>
31 WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
33 void QualityControlImpl_init(QualityControlImpl *This, IPin *input, IBaseFilter *self) {
34 This->input = input;
35 This->self = self;
36 This->tonotify = NULL;
39 HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) {
40 QualityControlImpl *This = (QualityControlImpl*)iface;
41 return IUnknown_QueryInterface(This->self, riid, ppv);
44 ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) {
45 QualityControlImpl *This = (QualityControlImpl*)iface;
46 return IUnknown_AddRef(This->self);
49 ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) {
50 QualityControlImpl *This = (QualityControlImpl*)iface;
51 return IUnknown_Release(This->self);
54 HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) {
55 HRESULT hr = S_FALSE;
56 QualityControlImpl *This = (QualityControlImpl*)iface;
57 if (This->tonotify)
58 return IQualityControl_Notify(This->tonotify, This->self, qm);
59 if (This->input) {
60 IPin *to = NULL;
61 IPin_ConnectedTo(This->input, &to);
62 if (to) {
63 IQualityControl *qc = NULL;
64 IUnknown_QueryInterface(to, &IID_IQualityControl, (void**)&qc);
65 if (qc) {
66 hr = IQualityControl_Notify(qc, This->self, qm);
67 IQualityControl_Release(qc);
69 IPin_Release(to);
72 return hr;
75 HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify) {
76 QualityControlImpl *This = (QualityControlImpl*)iface;
77 This->tonotify = tonotify;
78 return S_OK;