strmbase/renderer: Store the sink pin inline in the BaseRenderer structure.

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-06-20 20:13:19 -05:00 committed by Alexandre Julliard
parent 2dafbe079e
commit b583452af3
5 changed files with 99 additions and 110 deletions

View File

@ -99,14 +99,14 @@ static inline DSoundRenderImpl *impl_from_IAMDirectSound(IAMDirectSound *iface)
}
static REFERENCE_TIME time_from_pos(DSoundRenderImpl *This, DWORD pos) {
WAVEFORMATEX *wfx = (WAVEFORMATEX*)This->renderer.pInputPin->pin.mtCurrent.pbFormat;
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mtCurrent.pbFormat;
REFERENCE_TIME ret = 10000000;
ret = ret * pos / wfx->nAvgBytesPerSec;
return ret;
}
static DWORD pos_from_time(DSoundRenderImpl *This, REFERENCE_TIME time) {
WAVEFORMATEX *wfx = (WAVEFORMATEX*)This->renderer.pInputPin->pin.mtCurrent.pbFormat;
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mtCurrent.pbFormat;
REFERENCE_TIME ret = time;
ret *= wfx->nAvgBytesPerSec;
ret /= 10000000;
@ -115,7 +115,7 @@ static DWORD pos_from_time(DSoundRenderImpl *This, REFERENCE_TIME time) {
}
static void DSoundRender_UpdatePositions(DSoundRenderImpl *This, DWORD *seqwritepos, DWORD *minwritepos) {
WAVEFORMATEX *wfx = (WAVEFORMATEX*)This->renderer.pInputPin->pin.mtCurrent.pbFormat;
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mtCurrent.pbFormat;
BYTE *buf1, *buf2;
DWORD size1, size2, playpos, writepos, old_writepos, old_playpos, adv;
BOOL writepos_set = This->writepos < This->buf_size;
@ -153,7 +153,7 @@ static void DSoundRender_UpdatePositions(DSoundRenderImpl *This, DWORD *seqwrite
static HRESULT DSoundRender_GetWritePos(DSoundRenderImpl *This, DWORD *ret_writepos, REFERENCE_TIME write_at, DWORD *pfree, DWORD *skip)
{
WAVEFORMATEX *wfx = (WAVEFORMATEX*)This->renderer.pInputPin->pin.mtCurrent.pbFormat;
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mtCurrent.pbFormat;
DWORD writepos, min_writepos, playpos;
REFERENCE_TIME max_lag = 50 * 10000;
REFERENCE_TIME min_lag = 25 * 10000;
@ -273,10 +273,8 @@ static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, REFERENCE_TIM
ret = WaitForSingleObject(This->blocked, 10);
EnterCriticalSection(&This->renderer.csRenderLock);
This->in_loop = 0;
if (This->renderer.pInputPin->flushing ||
This->renderer.filter.state == State_Stopped) {
if (This->renderer.sink.flushing || This->renderer.filter.state == State_Stopped)
return This->renderer.filter.state == State_Paused ? S_OK : VFW_E_WRONG_STATE;
}
if (ret != WAIT_TIMEOUT)
ERR("%x\n", ret);
continue;
@ -322,7 +320,7 @@ static HRESULT WINAPI DSoundRender_PrepareReceive(BaseRenderer *iface, IMediaSam
if (IMediaSample_GetMediaType(pSample, &amt) == S_OK)
{
AM_MEDIA_TYPE *orig = &This->renderer.pInputPin->pin.mtCurrent;
AM_MEDIA_TYPE *orig = &This->renderer.sink.pin.mtCurrent;
WAVEFORMATEX *origfmt = (WAVEFORMATEX *)orig->pbFormat;
WAVEFORMATEX *newfmt = (WAVEFORMATEX *)amt->pbFormat;
@ -445,7 +443,7 @@ static VOID WINAPI DSoundRender_OnStartStreaming(BaseRenderer * iface)
TRACE("(%p)\n", This);
if (This->renderer.pInputPin->pin.pConnectedTo)
if (This->renderer.sink.pin.pConnectedTo)
{
if (This->renderer.filter.state == State_Paused)
{
@ -460,7 +458,7 @@ static VOID WINAPI DSoundRender_OnStartStreaming(BaseRenderer * iface)
static HRESULT WINAPI DSoundRender_CompleteConnect(BaseRenderer * iface, IPin * pReceivePin)
{
DSoundRenderImpl *This = impl_from_BaseRenderer(iface);
const AM_MEDIA_TYPE * pmt = &This->renderer.pInputPin->pin.mtCurrent;
const AM_MEDIA_TYPE *pmt = &This->renderer.sink.pin.mtCurrent;
HRESULT hr = S_OK;
WAVEFORMATEX *format;
DSBUFFERDESC buf_desc;
@ -519,9 +517,9 @@ static HRESULT WINAPI DSoundRender_BreakConnect(BaseRenderer* iface)
if (This->threadid) {
PostThreadMessageW(This->threadid, WM_APP, 0, 0);
LeaveCriticalSection(This->renderer.pInputPin->pin.pCritSec);
LeaveCriticalSection(This->renderer.sink.pin.pCritSec);
WaitForSingleObject(This->advisethread, INFINITE);
EnterCriticalSection(This->renderer.pInputPin->pin.pCritSec);
EnterCriticalSection(This->renderer.sink.pin.pCritSec);
CloseHandle(This->advisethread);
}
if (This->dsbuffer)
@ -728,9 +726,9 @@ static HRESULT WINAPI DSoundRender_Pause(IBaseFilter * iface)
{
if (This->renderer.filter.state == State_Stopped)
{
if (This->renderer.pInputPin->pin.pConnectedTo)
if (This->renderer.sink.pin.pConnectedTo)
ResetEvent(This->renderer.evComplete);
This->renderer.pInputPin->end_of_stream = 0;
This->renderer.sink.end_of_stream = 0;
}
hr = IDirectSoundBuffer_Stop(This->dsbuffer);
@ -1050,7 +1048,7 @@ static HRESULT WINAPI ReferenceClock_GetTime(IReferenceClock *iface,
DWORD writepos1, writepos2;
EnterCriticalSection(&This->renderer.filter.csFilter);
DSoundRender_UpdatePositions(This, &writepos1, &writepos2);
if (This->renderer.pInputPin && This->renderer.pInputPin->pin.mtCurrent.pbFormat)
if (This->renderer.sink.pin.mtCurrent.pbFormat)
{
*pTime = This->play_time + time_from_pos(This, This->last_playpos);
hr = S_OK;

View File

@ -201,7 +201,7 @@ static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data,
TRACE("(%p)->(%p, %d)\n", This, data, size);
hr = IPin_ConnectionMediaType(&This->renderer.pInputPin->pin.IPin_iface, &amt);
hr = IPin_ConnectionMediaType(&This->renderer.sink.pin.IPin_iface, &amt);
if (FAILED(hr)) {
ERR("Unable to retrieve media type\n");
return hr;
@ -424,7 +424,8 @@ static VOID WINAPI VideoRenderer_OnStartStreaming(BaseRenderer* iface)
TRACE("(%p)\n", This);
if (This->renderer.pInputPin->pin.pConnectedTo && (This->renderer.filter.state == State_Stopped || !This->renderer.pInputPin->end_of_stream))
if (This->renderer.sink.pin.pConnectedTo
&& (This->renderer.filter.state == State_Stopped || !This->renderer.sink.end_of_stream))
{
if (This->renderer.filter.state == State_Stopped)
{
@ -511,9 +512,9 @@ static HRESULT WINAPI VideoRenderer_GetSourceRect(BaseControlVideo* iface, RECT
static HRESULT WINAPI VideoRenderer_GetStaticImage(BaseControlVideo* iface, LONG *pBufferSize, LONG *pDIBImage)
{
VideoRendererImpl *This = impl_from_BaseControlVideo(iface);
AM_MEDIA_TYPE *amt = &This->renderer.sink.pin.mtCurrent;
BITMAPINFOHEADER *bmiHeader;
LONG needed_size;
AM_MEDIA_TYPE *amt = &This->renderer.pInputPin->pin.mtCurrent;
char *ptr;
FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
@ -581,7 +582,7 @@ static VIDEOINFOHEADER* WINAPI VideoRenderer_GetVideoFormat(BaseControlVideo* if
TRACE("(%p/%p)\n", This, iface);
pmt = &This->renderer.pInputPin->pin.mtCurrent;
pmt = &This->renderer.sink.pin.mtCurrent;
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
return (VIDEOINFOHEADER*)pmt->pbFormat;
} else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
@ -674,7 +675,7 @@ static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
{
if (This->renderer.filter.state == State_Stopped)
{
This->renderer.pInputPin->end_of_stream = 0;
This->renderer.sink.end_of_stream = 0;
ResetEvent(This->hEvent);
VideoRenderer_AutoShowWindow(This);
}
@ -824,13 +825,13 @@ HRESULT VideoRenderer_create(IUnknown *outer, void **out)
hr = BaseControlWindow_Init(&pVideoRenderer->baseControlWindow, &IVideoWindow_VTable,
&pVideoRenderer->renderer.filter, &pVideoRenderer->renderer.filter.csFilter,
&pVideoRenderer->renderer.pInputPin->pin, &renderer_BaseWindowFuncTable);
&pVideoRenderer->renderer.sink.pin, &renderer_BaseWindowFuncTable);
if (FAILED(hr))
goto fail;
hr = strmbase_video_init(&pVideoRenderer->baseControlVideo,
&pVideoRenderer->renderer.filter, &pVideoRenderer->renderer.filter.csFilter,
&pVideoRenderer->renderer.pInputPin->pin, &renderer_BaseControlVideoFuncTable);
&pVideoRenderer->renderer.sink.pin, &renderer_BaseControlVideoFuncTable);
if (FAILED(hr))
goto fail;

View File

@ -204,7 +204,7 @@ static DWORD VMR9_SendSampleData(struct quartz_vmr *This, VMR9PresentationInfo *
TRACE("%p %p %d\n", This, data, size);
amt = &This->renderer.pInputPin->pin.mtCurrent;
amt = &This->renderer.sink.pin.mtCurrent;
if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
{
@ -381,7 +381,7 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *This, BOOL force)
HRESULT hr;
TRACE("my mode: %u, my window: %p, my last window: %p\n", This->mode, This->baseControlWindow.baseWindow.hWnd, This->hWndClippingWindow);
if (This->baseControlWindow.baseWindow.hWnd || !This->renderer.pInputPin->pin.pConnectedTo)
if (This->baseControlWindow.baseWindow.hWnd || !This->renderer.sink.pin.pConnectedTo)
return S_OK;
if (This->mode == VMR9Mode_Windowless && !This->hWndClippingWindow)
@ -486,7 +486,7 @@ static HRESULT WINAPI VMR9_BreakConnect(BaseRenderer *This)
if (!pVMR9->mode)
return S_FALSE;
if (This->pInputPin->pin.pConnectedTo && pVMR9->allocator && pVMR9->presenter)
if (This->sink.pin.pConnectedTo && pVMR9->allocator && pVMR9->presenter)
{
if (pVMR9->renderer.filter.state != State_Stopped)
{
@ -635,9 +635,9 @@ static HRESULT WINAPI VMR9_GetSourceRect(BaseControlVideo* This, RECT *pSourceRe
static HRESULT WINAPI VMR9_GetStaticImage(BaseControlVideo* This, LONG *pBufferSize, LONG *pDIBImage)
{
struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This);
AM_MEDIA_TYPE *amt = &pVMR9->renderer.sink.pin.mtCurrent;
BITMAPINFOHEADER *bmiHeader;
LONG needed_size;
AM_MEDIA_TYPE *amt = &pVMR9->renderer.pInputPin->pin.mtCurrent;
char *ptr;
FIXME("(%p/%p)->(%p, %p): partial stub\n", pVMR9, This, pBufferSize, pDIBImage);
@ -705,7 +705,7 @@ static VIDEOINFOHEADER* WINAPI VMR9_GetVideoFormat(BaseControlVideo* This)
TRACE("(%p/%p)\n", pVMR9, This);
pmt = &pVMR9->renderer.pInputPin->pin.mtCurrent;
pmt = &pVMR9->renderer.sink.pin.mtCurrent;
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
return (VIDEOINFOHEADER*)pmt->pbFormat;
} else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
@ -2181,14 +2181,14 @@ static HRESULT vmr_create(IUnknown *outer, void **out, const CLSID *clsid)
if (FAILED(hr))
goto fail;
hr = BaseControlWindow_Init(&pVMR->baseControlWindow, &IVideoWindow_VTable, &pVMR->renderer.filter,
&pVMR->renderer.filter.csFilter, &pVMR->renderer.pInputPin->pin,
&renderer_BaseWindowFuncTable);
hr = BaseControlWindow_Init(&pVMR->baseControlWindow, &IVideoWindow_VTable,
&pVMR->renderer.filter, &pVMR->renderer.filter.csFilter,
&pVMR->renderer.sink.pin, &renderer_BaseWindowFuncTable);
if (FAILED(hr))
goto fail;
hr = strmbase_video_init(&pVMR->baseControlVideo, &pVMR->renderer.filter,
&pVMR->renderer.filter.csFilter, &pVMR->renderer.pInputPin->pin,
&pVMR->renderer.filter.csFilter, &pVMR->renderer.sink.pin,
&renderer_BaseControlVideoFuncTable);
if (FAILED(hr))
goto fail;

View File

@ -22,11 +22,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
static inline BaseInputPin *impl_BaseInputPin_from_IPin( IPin *iface )
{
return CONTAINING_RECORD(iface, BaseInputPin, pin.IPin_iface);
}
static inline BaseRenderer *impl_from_IBaseFilter(IBaseFilter *iface)
{
return CONTAINING_RECORD(iface, BaseRenderer, filter.IBaseFilter_iface);
@ -45,54 +40,56 @@ static const IQualityControlVtbl Renderer_QualityControl_Vtbl = {
QualityControlImpl_SetSink
};
static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
static inline BaseRenderer *impl_from_IPin(IPin *iface)
{
BaseInputPin *This = impl_BaseInputPin_from_IPin(iface);
BaseRenderer *renderer = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
return CONTAINING_RECORD(iface, BaseRenderer, sink.pin.IPin_iface);
}
static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin *iface, IPin *peer, const AM_MEDIA_TYPE *mt)
{
BaseRenderer *filter = impl_from_IPin(iface);
HRESULT hr;
TRACE("(%p/%p)->(%p, %p)\n", This, renderer, pReceivePin, pmt);
TRACE("iface %p, peer %p, mt %p.\n", iface, peer, mt);
EnterCriticalSection(This->pin.pCritSec);
hr = BaseInputPinImpl_ReceiveConnection(iface, pReceivePin, pmt);
EnterCriticalSection(filter->sink.pin.pCritSec);
hr = BaseInputPinImpl_ReceiveConnection(iface, peer, mt);
if (SUCCEEDED(hr))
{
if (renderer->pFuncsTable->pfnCompleteConnect)
hr = renderer->pFuncsTable->pfnCompleteConnect(renderer, pReceivePin);
if (filter->pFuncsTable->pfnCompleteConnect)
hr = filter->pFuncsTable->pfnCompleteConnect(filter, peer);
}
LeaveCriticalSection(This->pin.pCritSec);
LeaveCriticalSection(filter->sink.pin.pCritSec);
return hr;
}
static HRESULT WINAPI BaseRenderer_InputPin_Disconnect(IPin * iface)
{
BaseInputPin *This = impl_BaseInputPin_from_IPin(iface);
BaseRenderer *renderer = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
BaseRenderer *filter = impl_from_IPin(iface);
HRESULT hr;
TRACE("(%p/%p)\n", This, renderer);
TRACE("iface %p.\n", iface);
EnterCriticalSection(This->pin.pCritSec);
EnterCriticalSection(filter->sink.pin.pCritSec);
hr = BasePinImpl_Disconnect(iface);
if (SUCCEEDED(hr))
{
if (renderer->pFuncsTable->pfnBreakConnect)
hr = renderer->pFuncsTable->pfnBreakConnect(renderer);
if (filter->pFuncsTable->pfnBreakConnect)
hr = filter->pFuncsTable->pfnBreakConnect(filter);
}
BaseRendererImpl_ClearPendingSample(renderer);
LeaveCriticalSection(This->pin.pCritSec);
BaseRendererImpl_ClearPendingSample(filter);
LeaveCriticalSection(filter->sink.pin.pCritSec);
return hr;
}
static HRESULT WINAPI BaseRenderer_InputPin_EndOfStream(IPin * iface)
{
BaseRenderer *pFilter = impl_from_IPin(iface);
HRESULT hr;
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface);
BaseRenderer *pFilter = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
TRACE("(%p/%p)->()\n", This, pFilter);
TRACE("iface %p.\n", iface);
EnterCriticalSection(&pFilter->csRenderLock);
EnterCriticalSection(&pFilter->filter.csFilter);
@ -111,11 +108,10 @@ static HRESULT WINAPI BaseRenderer_InputPin_EndOfStream(IPin * iface)
static HRESULT WINAPI BaseRenderer_InputPin_BeginFlush(IPin * iface)
{
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface);
BaseRenderer *pFilter = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
BaseRenderer *pFilter = impl_from_IPin(iface);
HRESULT hr;
TRACE("(%p/%p)->()\n", This, iface);
TRACE("iface %p.\n", iface);
EnterCriticalSection(&pFilter->csRenderLock);
EnterCriticalSection(&pFilter->filter.csFilter);
@ -134,11 +130,10 @@ static HRESULT WINAPI BaseRenderer_InputPin_BeginFlush(IPin * iface)
static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
{
BaseInputPin* This = impl_BaseInputPin_from_IPin(iface);
BaseRenderer *pFilter = impl_from_IBaseFilter(This->pin.pinInfo.pFilter);
BaseRenderer *pFilter = impl_from_IPin(iface);
HRESULT hr;
TRACE("(%p/%p)->()\n", This, pFilter);
TRACE("iface %p.\n", iface);
EnterCriticalSection(&pFilter->csRenderLock);
EnterCriticalSection(&pFilter->filter.csFilter);
@ -179,12 +174,11 @@ static const IPinVtbl BaseRenderer_InputPin_Vtbl =
static IPin *renderer_get_pin(BaseFilter *iface, unsigned int index)
{
BaseRenderer *This = impl_from_BaseFilter(iface);
BaseRenderer *filter = impl_from_BaseFilter(iface);
if (index >= 1)
return NULL;
return &This->pInputPin->pin.IPin_iface;
if (index == 0)
return &filter->sink.pin.IPin_iface;
return NULL;
}
static void renderer_destroy(BaseFilter *iface)
@ -221,16 +215,16 @@ static const BaseFilterFuncTable RendererBaseFilterFuncTable = {
.filter_query_interface = renderer_query_interface,
};
static HRESULT WINAPI BaseRenderer_Input_CheckMediaType(BasePin *pin, const AM_MEDIA_TYPE * pmt)
static HRESULT WINAPI BaseRenderer_Input_CheckMediaType(BasePin *pin, const AM_MEDIA_TYPE *mt)
{
BaseRenderer *This = impl_from_IBaseFilter(pin->pinInfo.pFilter);
return This->pFuncsTable->pfnCheckMediaType(This, pmt);
BaseRenderer *filter = impl_from_IPin(&pin->IPin_iface);
return filter->pFuncsTable->pfnCheckMediaType(filter, mt);
}
static HRESULT WINAPI BaseRenderer_Receive(BaseInputPin *pin, IMediaSample * pSample)
static HRESULT WINAPI BaseRenderer_Receive(BaseInputPin *pin, IMediaSample *sample)
{
BaseRenderer *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
return BaseRendererImpl_Receive(This, pSample);
BaseRenderer *filter = impl_from_IPin(&pin->pin.IPin_iface);
return BaseRendererImpl_Receive(filter, sample);
}
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
@ -242,57 +236,53 @@ static const BaseInputPinFuncTable input_BaseInputFuncTable = {
};
HRESULT WINAPI strmbase_renderer_init(BaseRenderer *This, const IBaseFilterVtbl *vtbl,
HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtbl *vtbl,
IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, DWORD_PTR debug_info,
const BaseRendererFuncTable *pBaseFuncsTable)
{
PIN_INFO piInput;
HRESULT hr;
strmbase_filter_init(&This->filter, vtbl, outer, clsid, debug_info, &RendererBaseFilterFuncTable);
strmbase_filter_init(&filter->filter, vtbl, outer, clsid, debug_info, &RendererBaseFilterFuncTable);
This->pFuncsTable = pBaseFuncsTable;
filter->pFuncsTable = pBaseFuncsTable;
/* construct input pin */
piInput.dir = PINDIR_INPUT;
piInput.pFilter = &This->filter.IBaseFilter_iface;
piInput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, sink_name, ARRAY_SIZE(piInput.achName));
hr = BaseInputPin_Construct(&BaseRenderer_InputPin_Vtbl, sizeof(BaseInputPin), &piInput,
&input_BaseInputFuncTable, &This->filter.csFilter, NULL, (IPin **)&This->pInputPin);
strmbase_sink_init(&filter->sink, &BaseRenderer_InputPin_Vtbl, &piInput,
&input_BaseInputFuncTable, &filter->filter.csFilter, NULL);
if (SUCCEEDED(hr))
hr = CreatePosPassThru(outer ? outer : (IUnknown *)&filter->filter.IBaseFilter_iface, TRUE,
&filter->sink.pin.IPin_iface, &filter->pPosition);
if (FAILED(hr))
{
hr = CreatePosPassThru(outer ? outer : (IUnknown *)&This->filter.IBaseFilter_iface, TRUE,
&This->pInputPin->pin.IPin_iface, &This->pPosition);
if (FAILED(hr))
return hr;
InitializeCriticalSection(&This->csRenderLock);
This->csRenderLock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": BaseRenderer.csRenderLock");
This->evComplete = CreateEventW(NULL, TRUE, TRUE, NULL);
This->ThreadSignal = CreateEventW(NULL, TRUE, TRUE, NULL);
This->RenderEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
This->pMediaSample = NULL;
QualityControlImpl_Create(&This->pInputPin->pin.IPin_iface, &This->filter.IBaseFilter_iface, &This->qcimpl);
This->qcimpl->IQualityControl_iface.lpVtbl = &Renderer_QualityControl_Vtbl;
strmbase_sink_cleanup(&filter->sink);
strmbase_filter_cleanup(&filter->filter);
return hr;
}
return hr;
InitializeCriticalSection(&filter->csRenderLock);
filter->csRenderLock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__": BaseRenderer.csRenderLock");
filter->evComplete = CreateEventW(NULL, TRUE, TRUE, NULL);
filter->ThreadSignal = CreateEventW(NULL, TRUE, TRUE, NULL);
filter->RenderEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
filter->pMediaSample = NULL;
QualityControlImpl_Create(&filter->sink.pin.IPin_iface, &filter->filter.IBaseFilter_iface, &filter->qcimpl);
filter->qcimpl->IQualityControl_iface.lpVtbl = &Renderer_QualityControl_Vtbl;
return S_OK;
}
void strmbase_renderer_cleanup(BaseRenderer *filter)
{
IPin *peer;
if (SUCCEEDED(IPin_ConnectedTo(&filter->pInputPin->pin.IPin_iface, &peer)))
{
IPin_Disconnect(peer);
IPin_Release(peer);
}
IPin_Disconnect(&filter->pInputPin->pin.IPin_iface);
BaseInputPin_Destroy(filter->pInputPin);
if (filter->sink.pin.pConnectedTo)
IPin_Disconnect(filter->sink.pin.pConnectedTo);
IPin_Disconnect(&filter->sink.pin.IPin_iface);
strmbase_sink_cleanup(&filter->sink);
if (filter->pPosition)
IUnknown_Release(filter->pPosition);
@ -316,7 +306,7 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp
TRACE("(%p)->%p\n", This, pSample);
if (This->pInputPin->end_of_stream || This->pInputPin->flushing)
if (This->sink.end_of_stream || This->sink.flushing)
return S_FALSE;
if (This->filter.state == State_Stopped)
@ -436,9 +426,9 @@ HRESULT WINAPI BaseRendererImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
SetEvent(This->evComplete);
ResetEvent(This->ThreadSignal);
if (This->pInputPin->pin.pConnectedTo)
if (This->sink.pin.pConnectedTo)
{
This->pInputPin->end_of_stream = FALSE;
This->sink.end_of_stream = FALSE;
}
else if (This->filter.filterInfo.pGraph)
{
@ -479,9 +469,9 @@ HRESULT WINAPI BaseRendererImpl_Pause(IBaseFilter * iface)
{
if (This->filter.state == State_Stopped)
{
if (This->pInputPin->pin.pConnectedTo)
if (This->sink.pin.pConnectedTo)
ResetEvent(This->evComplete);
This->pInputPin->end_of_stream = FALSE;
This->sink.end_of_stream = FALSE;
}
else if (This->pFuncsTable->pfnOnStopStreaming)
This->pFuncsTable->pfnOnStopStreaming(This);

View File

@ -534,7 +534,7 @@ typedef struct BaseRendererTag
{
BaseFilter filter;
BaseInputPin *pInputPin;
BaseInputPin sink;
IUnknown *pPosition;
CRITICAL_SECTION csRenderLock;
HANDLE evComplete;