strmbase: Retrieve the filter clock from the pin pointer.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-10-27 18:28:04 -05:00 committed by Alexandre Julliard
parent db7eb33275
commit 9a760f9479
3 changed files with 7 additions and 33 deletions

View File

@ -36,7 +36,6 @@ HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, QualityControlImpl *
This = *ppv; This = *ppv;
This->pin = pin; This->pin = pin;
This->tonotify = NULL; This->tonotify = NULL;
This->clock = NULL;
This->current_rstart = This->current_rstop = -1; This->current_rstart = This->current_rstop = -1;
TRACE("-> %p\n", This); TRACE("-> %p\n", This);
return S_OK; return S_OK;
@ -125,13 +124,6 @@ void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart)
This->qos_handled = TRUE; /* Lie that will be corrected on first adjustment */ This->qos_handled = TRUE; /* Lie that will be corrected on first adjustment */
} }
void QualityControlRender_SetClock(QualityControlImpl *This, IReferenceClock *clock)
{
TRACE("%p %p\n", This, clock);
This->clock = clock;
}
static BOOL QualityControlRender_IsLate(QualityControlImpl *This, REFERENCE_TIME jitter, static BOOL QualityControlRender_IsLate(QualityControlImpl *This, REFERENCE_TIME jitter,
REFERENCE_TIME start, REFERENCE_TIME stop) REFERENCE_TIME start, REFERENCE_TIME stop)
{ {
@ -168,7 +160,7 @@ void QualityControlRender_DoQOS(QualityControlImpl *priv)
TRACE("%p\n", priv); TRACE("%p\n", priv);
if (!priv->clock || priv->current_rstart < 0) if (!priv->pin->filter->pClock || priv->current_rstart < 0)
return; return;
start = priv->current_rstart; start = priv->current_rstart;
@ -284,7 +276,7 @@ void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME s
if (start >= 0) if (start >= 0)
{ {
REFERENCE_TIME now; REFERENCE_TIME now;
IReferenceClock_GetTime(This->clock, &now); IReferenceClock_GetTime(This->pin->filter->pClock, &now);
This->current_jitter = (now - This->clockstart) - start; This->current_jitter = (now - This->clockstart) - start;
} }
else else
@ -299,10 +291,10 @@ void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME s
else else
This->rendered++; This->rendered++;
if (!This->clock) if (!This->pin->filter->pClock)
return; return;
IReferenceClock_GetTime(This->clock, &This->start); IReferenceClock_GetTime(This->pin->filter->pClock, &This->start);
TRACE("Starting at %s.\n", debugstr_time(This->start)); TRACE("Starting at %s.\n", debugstr_time(This->start));
} }
@ -313,7 +305,8 @@ void QualityControlRender_EndRender(QualityControlImpl *This)
TRACE("%p\n", This); TRACE("%p\n", This);
if (!This->clock || This->start < 0 || FAILED(IReferenceClock_GetTime(This->clock, &This->stop))) if (!This->pin->filter->pClock || This->start < 0
|| FAILED(IReferenceClock_GetTime(This->pin->filter->pClock, &This->stop)))
return; return;
elapsed = This->start - This->stop; elapsed = This->start - This->stop;

View File

@ -22,11 +22,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase); WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
static inline struct strmbase_renderer *impl_from_IBaseFilter(IBaseFilter *iface)
{
return CONTAINING_RECORD(iface, struct strmbase_renderer, filter.IBaseFilter_iface);
}
static inline struct strmbase_renderer *impl_from_strmbase_filter(struct strmbase_filter *iface) static inline struct strmbase_renderer *impl_from_strmbase_filter(struct strmbase_filter *iface)
{ {
return CONTAINING_RECORD(iface, struct strmbase_renderer, filter); return CONTAINING_RECORD(iface, struct strmbase_renderer, filter);
@ -436,18 +431,6 @@ HRESULT WINAPI BaseRendererImpl_Receive(struct strmbase_renderer *This, IMediaSa
return hr; return hr;
} }
static HRESULT WINAPI BaseRendererImpl_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock)
{
struct strmbase_renderer *This = impl_from_IBaseFilter(iface);
HRESULT hr;
EnterCriticalSection(&This->filter.csFilter);
QualityControlRender_SetClock(This->qcimpl, clock);
hr = BaseFilterImpl_SetSyncSource(iface, clock);
LeaveCriticalSection(&This->filter.csFilter);
return hr;
}
static const IBaseFilterVtbl strmbase_renderer_vtbl = static const IBaseFilterVtbl strmbase_renderer_vtbl =
{ {
BaseFilterImpl_QueryInterface, BaseFilterImpl_QueryInterface,
@ -458,7 +441,7 @@ static const IBaseFilterVtbl strmbase_renderer_vtbl =
BaseFilterImpl_Pause, BaseFilterImpl_Pause,
BaseFilterImpl_Run, BaseFilterImpl_Run,
BaseFilterImpl_GetState, BaseFilterImpl_GetState,
BaseRendererImpl_SetSyncSource, BaseFilterImpl_SetSyncSource,
BaseFilterImpl_GetSyncSource, BaseFilterImpl_GetSyncSource,
BaseFilterImpl_EnumPins, BaseFilterImpl_EnumPins,
BaseFilterImpl_FindPin, BaseFilterImpl_FindPin,

View File

@ -57,7 +57,6 @@ typedef struct QualityControlImpl {
IQualityControl *tonotify; IQualityControl *tonotify;
/* Render stuff */ /* Render stuff */
IReferenceClock *clock;
REFERENCE_TIME last_in_time, last_left, avg_duration, avg_pt, avg_render, start, stop; REFERENCE_TIME last_in_time, last_left, avg_duration, avg_pt, avg_render, start, stop;
REFERENCE_TIME current_jitter, current_rstart, current_rstop, clockstart; REFERENCE_TIME current_jitter, current_rstart, current_rstop, clockstart;
double avg_rate; double avg_rate;
@ -74,7 +73,6 @@ HRESULT WINAPI QualityControlImpl_Notify(IQualityControl *iface, IBaseFilter *se
HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify); HRESULT WINAPI QualityControlImpl_SetSink(IQualityControl *iface, IQualityControl *tonotify);
void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart); void QualityControlRender_Start(QualityControlImpl *This, REFERENCE_TIME tStart);
void QualityControlRender_SetClock(QualityControlImpl *This, IReferenceClock *clock);
void QualityControlRender_DoQOS(QualityControlImpl *priv); void QualityControlRender_DoQOS(QualityControlImpl *priv);
void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME start, REFERENCE_TIME stop); void QualityControlRender_BeginRender(QualityControlImpl *This, REFERENCE_TIME start, REFERENCE_TIME stop);
void QualityControlRender_EndRender(QualityControlImpl *This); void QualityControlRender_EndRender(QualityControlImpl *This);