Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/qualitycontrol.c | 37 ++++++++++++++------------------ dlls/strmbase/renderer.c | 2 +- dlls/strmbase/strmbase_private.h | 5 ++--- dlls/strmbase/transform.c | 5 ++--- 4 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/dlls/strmbase/qualitycontrol.c b/dlls/strmbase/qualitycontrol.c index b3e93b7baa..59d198bd28 100644 --- a/dlls/strmbase/qualitycontrol.c +++ b/dlls/strmbase/qualitycontrol.c @@ -27,16 +27,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase_qc);
-HRESULT QualityControlImpl_Create(IPin *input, IBaseFilter *self, QualityControlImpl **ppv) +HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, QualityControlImpl **ppv) { QualityControlImpl *This; - TRACE("%p, %p, %p\n", input, self, ppv); *ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(QualityControlImpl)); if (!*ppv) return E_OUTOFMEMORY; This = *ppv; - This->input = input; - This->self = self; + This->pin = pin; This->tonotify = NULL; This->clock = NULL; This->current_rstart = This->current_rstop = -1; @@ -57,19 +55,19 @@ static inline QualityControlImpl *impl_from_IQualityControl(IQualityControl *ifa HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv) { QualityControlImpl *This = impl_from_IQualityControl(iface); - return IBaseFilter_QueryInterface(This->self, riid, ppv); + return IBaseFilter_QueryInterface(&This->pin->filter->IBaseFilter_iface, riid, ppv); }
ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface) { QualityControlImpl *This = impl_from_IQualityControl(iface); - return IBaseFilter_AddRef(This->self); + return IBaseFilter_AddRef(&This->pin->filter->IBaseFilter_iface); }
ULONG WINAPI QualityControlImpl_Release(IQualityControl *iface) { QualityControlImpl *This = impl_from_IQualityControl(iface); - return IBaseFilter_Release(This->self); + return IBaseFilter_Release(&This->pin->filter->IBaseFilter_iface); }
HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) @@ -81,19 +79,16 @@ HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *se iface, sender, qm.Type, qm.Proportion, debugstr_time(qm.Late), debugstr_time(qm.TimeStamp));
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; - IPin_QueryInterface(to, &IID_IQualityControl, (void**)&qc); - if (qc) { - hr = IQualityControl_Notify(qc, This->self, qm); - IQualityControl_Release(qc); - } - IPin_Release(to); + return IQualityControl_Notify(This->tonotify, &This->pin->filter->IBaseFilter_iface, qm); + + if (This->pin->peer) + { + IQualityControl *qc = NULL; + IPin_QueryInterface(This->pin->peer, &IID_IQualityControl, (void **)&qc); + if (qc) + { + hr = IQualityControl_Notify(qc, &This->pin->filter->IBaseFilter_iface, qm); + IQualityControl_Release(qc); } }
@@ -270,7 +265,7 @@ void QualityControlRender_DoQOS(QualityControlImpl *priv) q.Late = priv->current_jitter; q.TimeStamp = priv->current_rstart; TRACE("Late: %s from %s, rate: %g\n", debugstr_time(q.Late), debugstr_time(q.TimeStamp), 1./priv->avg_rate); - hr = IQualityControl_Notify(&priv->IQualityControl_iface, priv->self, q); + hr = IQualityControl_Notify(&priv->IQualityControl_iface, &priv->pin->filter->IBaseFilter_iface, q); priv->qos_handled = hr == S_OK; }
diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 1d37531bf2..748a53f2ff 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -545,7 +545,7 @@ HRESULT WINAPI strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown filter->advise_event = CreateEventW(NULL, FALSE, FALSE, NULL); filter->flush_event = CreateEventW(NULL, TRUE, TRUE, NULL);
- QualityControlImpl_Create(&filter->sink.pin.IPin_iface, &filter->filter.IBaseFilter_iface, &filter->qcimpl); + QualityControlImpl_Create(&filter->sink.pin, &filter->qcimpl); filter->qcimpl->IQualityControl_iface.lpVtbl = &Renderer_QualityControl_Vtbl;
return S_OK; diff --git a/dlls/strmbase/strmbase_private.h b/dlls/strmbase/strmbase_private.h index d0f5029765..6031e0e485 100644 --- a/dlls/strmbase/strmbase_private.h +++ b/dlls/strmbase/strmbase_private.h @@ -53,8 +53,7 @@ static inline const char *debugstr_time(REFERENCE_TIME time) /* Quality Control */ typedef struct QualityControlImpl { IQualityControl IQualityControl_iface; - IPin *input; - IBaseFilter *self; + struct strmbase_pin *pin; IQualityControl *tonotify;
/* Render stuff */ @@ -66,7 +65,7 @@ typedef struct QualityControlImpl { BOOL qos_handled, is_dropped; } QualityControlImpl;
-HRESULT QualityControlImpl_Create(IPin *input, IBaseFilter *self, QualityControlImpl **ppv); +HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, QualityControlImpl **out); void QualityControlImpl_Destroy(QualityControlImpl *This); HRESULT WINAPI QualityControlImpl_QueryInterface(IQualityControl *iface, REFIID riid, void **ppv); ULONG WINAPI QualityControlImpl_AddRef(IQualityControl *iface); diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index d0484a2543..266232f57a 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -286,8 +286,7 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid, strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl, &filter->filter, wcsOutputPinName, &source_ops);
- QualityControlImpl_Create(&filter->sink.pin.IPin_iface, - &filter->filter.IBaseFilter_iface, &filter->qcimpl); + QualityControlImpl_Create(&filter->sink.pin, &filter->qcimpl); filter->qcimpl->IQualityControl_iface.lpVtbl = &TransformFilter_QualityControl_Vtbl;
filter->seekthru_unk = NULL; @@ -483,7 +482,7 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl =
static HRESULT WINAPI TransformFilter_QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *sender, Quality qm) { QualityControlImpl *qc = (QualityControlImpl*)iface; - TransformFilter *This = impl_from_IBaseFilter(qc->self); + TransformFilter *This = impl_from_source_IPin(&qc->pin->IPin_iface);
if (This->pFuncsTable->pfnNotify) return This->pFuncsTable->pfnNotify(This, sender, qm);