Commit a9fbbda4 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Store the quality control object directly in strmbase_renderer.

parent 461a928f
......@@ -27,11 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase_qc);
void QualityControlImpl_Destroy(struct strmbase_qc *This)
{
HeapFree(GetProcessHeap(),0,This);
}
static inline struct strmbase_qc *impl_from_IQualityControl(IQualityControl *iface)
{
return CONTAINING_RECORD(iface, struct strmbase_qc, IQualityControl_iface);
......@@ -313,17 +308,10 @@ void QualityControlRender_EndRender(struct strmbase_qc *This)
This->avg_render = UPDATE_RUNNING_AVG (This->avg_render, elapsed);
}
HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **ppv)
void strmbase_qc_init(struct strmbase_qc *qc, struct strmbase_pin *pin)
{
struct strmbase_qc *This;
*ppv = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(struct strmbase_qc));
if (!*ppv)
return E_OUTOFMEMORY;
This = *ppv;
This->pin = pin;
This->tonotify = NULL;
This->current_rstart = This->current_rstop = -1;
This->IQualityControl_iface.lpVtbl = &quality_control_vtbl;
TRACE("-> %p\n", This);
return S_OK;
memset(qc, 0, sizeof(*qc));
qc->pin = pin;
qc->current_rstart = qc->current_rstop = -1;
qc->IQualityControl_iface.lpVtbl = &quality_control_vtbl;
}
......@@ -63,7 +63,7 @@ static HRESULT renderer_query_interface(struct strmbase_filter *iface, REFIID ii
else if (IsEqualGUID(iid, &IID_IMediaSeeking))
*out = &filter->passthrough.IMediaSeeking_iface;
else if (IsEqualGUID(iid, &IID_IQualityControl))
*out = &filter->qcimpl->IQualityControl_iface;
*out = &filter->qc.IQualityControl_iface;
else
return E_NOINTERFACE;
......@@ -93,7 +93,7 @@ static HRESULT renderer_start_stream(struct strmbase_filter *iface, REFERENCE_TI
SetEvent(filter->state_event);
if (filter->sink.pin.peer)
filter->eos = FALSE;
QualityControlRender_Start(filter->qcimpl, filter->stream_start);
QualityControlRender_Start(&filter->qc, filter->stream_start);
if (filter->sink.pin.peer && filter->pFuncsTable->renderer_start_stream)
filter->pFuncsTable->renderer_start_stream(filter);
......@@ -234,7 +234,7 @@ static HRESULT sink_end_flush(struct strmbase_sink *iface)
EnterCriticalSection(&filter->csRenderLock);
filter->eos = FALSE;
QualityControlRender_Start(filter->qcimpl, filter->stream_start);
QualityControlRender_Start(&filter->qc, filter->stream_start);
strmbase_passthrough_invalidate_time(&filter->passthrough);
ResetEvent(filter->flush_event);
......@@ -272,7 +272,6 @@ void strmbase_renderer_cleanup(struct strmbase_renderer *filter)
CloseHandle(filter->state_event);
CloseHandle(filter->advise_event);
CloseHandle(filter->flush_event);
QualityControlImpl_Destroy(filter->qcimpl);
strmbase_filter_cleanup(&filter->filter);
}
......@@ -367,12 +366,12 @@ HRESULT WINAPI BaseRendererImpl_Receive(struct strmbase_renderer *This, IMediaSa
if (SUCCEEDED(hr))
{
QualityControlRender_BeginRender(This->qcimpl, start, stop);
QualityControlRender_BeginRender(&This->qc, start, stop);
hr = This->pFuncsTable->pfnDoRenderSample(This, pSample);
QualityControlRender_EndRender(This->qcimpl);
QualityControlRender_EndRender(&This->qc);
}
QualityControlRender_DoQOS(This->qcimpl);
QualityControlRender_DoQOS(&This->qc);
LeaveCriticalSection(&This->csRenderLock);
......@@ -386,6 +385,7 @@ void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer,
strmbase_filter_init(&filter->filter, outer, clsid, &filter_ops);
strmbase_passthrough_init(&filter->passthrough, (IUnknown *)&filter->filter.IBaseFilter_iface);
ISeekingPassThru_Init(&filter->passthrough.ISeekingPassThru_iface, TRUE, &filter->sink.pin.IPin_iface);
strmbase_qc_init(&filter->qc, &filter->sink.pin);
filter->pFuncsTable = ops;
......@@ -396,6 +396,4 @@ void strmbase_renderer_init(struct strmbase_renderer *filter, IUnknown *outer,
filter->state_event = CreateEventW(NULL, TRUE, TRUE, NULL);
filter->advise_event = CreateEventW(NULL, FALSE, FALSE, NULL);
filter->flush_event = CreateEventW(NULL, TRUE, TRUE, NULL);
QualityControlImpl_Create(&filter->sink.pin, &filter->qcimpl);
}
......@@ -53,24 +53,6 @@ static inline const char *debugstr_time(REFERENCE_TIME time)
return wine_dbg_sprintf("%s", rev);
}
/* Quality Control */
struct strmbase_qc
{
IQualityControl IQualityControl_iface;
struct strmbase_pin *pin;
IQualityControl *tonotify;
/* Render stuff */
REFERENCE_TIME last_in_time, last_left, avg_duration, avg_pt, avg_render, start, stop;
REFERENCE_TIME current_jitter, current_rstart, current_rstop, clockstart;
double avg_rate;
LONG64 rendered, dropped;
BOOL qos_handled, is_dropped;
};
HRESULT QualityControlImpl_Create(struct strmbase_pin *pin, struct strmbase_qc **out);
void QualityControlImpl_Destroy(struct strmbase_qc *qc);
void QualityControlRender_Start(struct strmbase_qc *This, REFERENCE_TIME tStart);
void QualityControlRender_DoQOS(struct strmbase_qc *priv);
void QualityControlRender_BeginRender(struct strmbase_qc *This, REFERENCE_TIME start, REFERENCE_TIME stop);
......
......@@ -271,10 +271,27 @@ struct strmbase_passthrough
void strmbase_passthrough_init(struct strmbase_passthrough *passthrough, IUnknown *outer);
void strmbase_passthrough_cleanup(struct strmbase_passthrough *passthrough);
struct strmbase_qc
{
IQualityControl IQualityControl_iface;
struct strmbase_pin *pin;
IQualityControl *tonotify;
/* Render stuff */
REFERENCE_TIME last_in_time, last_left, avg_duration, avg_pt, avg_render, start, stop;
REFERENCE_TIME current_jitter, current_rstart, current_rstop, clockstart;
double avg_rate;
LONG64 rendered, dropped;
BOOL qos_handled, is_dropped;
};
void strmbase_qc_init(struct strmbase_qc *qc, struct strmbase_pin *pin);
struct strmbase_renderer
{
struct strmbase_filter filter;
struct strmbase_passthrough passthrough;
struct strmbase_qc qc;
struct strmbase_sink sink;
......@@ -290,9 +307,6 @@ struct strmbase_renderer
HANDLE flush_event;
REFERENCE_TIME stream_start;
IQualityControl *pQSink;
struct strmbase_qc *qcimpl;
const struct strmbase_renderer_ops *pFuncsTable;
BOOL eos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment