Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/avico.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index 2e81a6b0c4..f0f60ae439 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -415,6 +415,7 @@ static HRESULT sink_query_interface(struct strmbase_pin *iface, REFIID iid, void static HRESULT WINAPI AVICompressorIn_Receive(struct strmbase_sink *base, IMediaSample *pSample) { AVICompressor *This = impl_from_strmbase_pin(&base->pin); + IMemInputPin *meminput = This->source.pMemInputPin; VIDEOINFOHEADER *src_videoinfo; REFERENCE_TIME start, stop; IMediaSample *out_sample; @@ -429,6 +430,12 @@ static HRESULT WINAPI AVICompressorIn_Receive(struct strmbase_sink *base, IMedia
TRACE("(%p)->(%p)\n", base, pSample);
+ if (!meminput) + { + WARN("Source is not connected, returning VFW_E_NOT_CONNECTED.\n"); + return VFW_E_NOT_CONNECTED; + } + if(!This->hic) { FIXME("Driver not loaded\n"); return E_UNEXPECTED; @@ -490,7 +497,7 @@ static HRESULT WINAPI AVICompressorIn_Receive(struct strmbase_sink *base, IMedia else IMediaSample_SetMediaTime(out_sample, NULL, NULL);
- hres = BaseOutputPinImpl_Deliver(&This->source, out_sample); + hres = IMemInputPin_Receive(meminput, out_sample); if(FAILED(hres)) WARN("Deliver failed: %08x\n", hres);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/smartteefilter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index fd0dd621e3..f63a43de50 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -261,8 +261,8 @@ static HRESULT WINAPI SmartTeeFilterInput_Receive(struct strmbase_sink *base, IM if (This->capture.pin.peer) hrCapture = copy_sample(inputSample, This->capture.pAllocator, &captureSample); LeaveCriticalSection(&This->filter.csFilter); - if (SUCCEEDED(hrCapture)) - hrCapture = BaseOutputPinImpl_Deliver(&This->capture, captureSample); + if (SUCCEEDED(hrCapture) && This->capture.pMemInputPin) + hrCapture = IMemInputPin_Receive(This->capture.pMemInputPin, captureSample); if (captureSample) IMediaSample_Release(captureSample);
@@ -273,8 +273,8 @@ static HRESULT WINAPI SmartTeeFilterInput_Receive(struct strmbase_sink *base, IM /* No timestamps on preview stream: */ if (SUCCEEDED(hrPreview)) hrPreview = IMediaSample_SetTime(previewSample, NULL, NULL); - if (SUCCEEDED(hrPreview)) - hrPreview = BaseOutputPinImpl_Deliver(&This->preview, previewSample); + if (SUCCEEDED(hrPreview) && This->preview.pMemInputPin) + hrPreview = IMemInputPin_Receive(This->preview.pMemInputPin, previewSample); if (previewSample) IMediaSample_Release(previewSample);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/v4l.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/qcap/v4l.c b/dlls/qcap/v4l.c index cdab38052b..17f1770f37 100644 --- a/dlls/qcap/v4l.c +++ b/dlls/qcap/v4l.c @@ -433,7 +433,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam) }
Resize(capBox, pTarget, image_data); - hr = BaseOutputPinImpl_Deliver(capBox->pin, pSample); + hr = IMemInputPin_Receive(capBox->pin->pMemInputPin, pSample); TRACE("%p -> Frame %u: %x\n", capBox, ++framecount, hr); IMediaSample_Release(pSample); } @@ -465,7 +465,7 @@ HRESULT qcap_driver_run(Capture *capBox, FILTER_STATE *state)
capBox->stopped = FALSE;
- if (*state == State_Stopped) + if (*state == State_Stopped && capBox->pin->pin.peer) { *state = State_Running; if (!capBox->iscommitted)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/strmbase/pin.c | 40 ---------------------------------------- include/wine/strmbase.h | 1 - 2 files changed, 41 deletions(-)
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 4606c25a78..755dd0928a 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -465,46 +465,6 @@ HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(struct strmbase_source *This, return hr; }
-/* replaces OutputPin_SendSample */ -HRESULT WINAPI BaseOutputPinImpl_Deliver(struct strmbase_source *This, IMediaSample *pSample) -{ - IMemInputPin * pMemConnected = NULL; - PIN_INFO pinInfo; - HRESULT hr; - - EnterCriticalSection(&This->pin.filter->csFilter); - { - if (!This->pin.peer || !This->pMemInputPin) - hr = VFW_E_NOT_CONNECTED; - else - { - /* we don't have the lock held when using This->pMemInputPin, - * so we need to AddRef it to stop it being deleted while we are - * using it. Same with its filter. */ - pMemConnected = This->pMemInputPin; - IMemInputPin_AddRef(pMemConnected); - hr = IPin_QueryPinInfo(This->pin.peer, &pinInfo); - } - } - LeaveCriticalSection(&This->pin.filter->csFilter); - - if (SUCCEEDED(hr)) - { - /* NOTE: if we are in a critical section when Receive is called - * then it causes some problems (most notably with the native Video - * Renderer) if we are re-entered for whatever reason */ - hr = IMemInputPin_Receive(pMemConnected, pSample); - - /* If the filter's destroyed, tell upstream to stop sending data */ - if(IBaseFilter_Release(pinInfo.pFilter) == 0 && SUCCEEDED(hr)) - hr = S_FALSE; - } - if (pMemConnected) - IMemInputPin_Release(pMemConnected); - - return hr; -} - /* replaces OutputPin_CommitAllocator */ HRESULT WINAPI BaseOutputPinImpl_Active(struct strmbase_source *This) { diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index dd2f8426bf..eace7c1e3b 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -123,7 +123,6 @@ HRESULT WINAPI BaseOutputPinImpl_EndFlush(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(struct strmbase_source *pin, IMediaSample **sample, REFERENCE_TIME *start, REFERENCE_TIME *stop, DWORD flags); -HRESULT WINAPI BaseOutputPinImpl_Deliver(struct strmbase_source *pin, IMediaSample *sample); HRESULT WINAPI BaseOutputPinImpl_Active(struct strmbase_source *pin); HRESULT WINAPI BaseOutputPinImpl_Inactive(struct strmbase_source *pin); HRESULT WINAPI BaseOutputPinImpl_InitAllocator(struct strmbase_source *pin, IMemAllocator **allocator);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- Brief manual testing suggests that our filters which use the base transform don't actually care whether an EOS has been received.
dlls/strmbase/pin.c | 4 +--- dlls/strmbase/renderer.c | 20 +++++++++----------- dlls/strmbase/transform.c | 4 +--- include/wine/strmbase.h | 4 +++- 4 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 755dd0928a..bdc827c6f6 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -690,8 +690,6 @@ HRESULT WINAPI BaseInputPinImpl_EndOfStream(IPin * iface) EnterCriticalSection(&This->pin.filter->csFilter); if (This->flushing) hr = S_FALSE; - else - This->end_of_stream = TRUE; LeaveCriticalSection(&This->pin.filter->csFilter);
if (hr == S_OK) @@ -731,7 +729,7 @@ HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface) TRACE("(%p)->()\n", This);
EnterCriticalSection(&This->pin.filter->csFilter); - This->flushing = This->end_of_stream = FALSE; + This->flushing = FALSE;
hr = SendFurther(This, deliver_endflush, NULL); LeaveCriticalSection(&This->pin.filter->csFilter); diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index add999b4ec..dbb677e9ad 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -89,14 +89,11 @@ static HRESULT WINAPI BaseRenderer_InputPin_EndOfStream(IPin * iface)
EnterCriticalSection(&pFilter->csRenderLock); EnterCriticalSection(&pFilter->filter.csFilter); - hr = BaseInputPinImpl_EndOfStream(iface); - if (SUCCEEDED(hr)) - { - if (pFilter->pFuncsTable->pfnEndOfStream) - hr = pFilter->pFuncsTable->pfnEndOfStream(pFilter); - else - hr = BaseRendererImpl_EndOfStream(pFilter); - } + pFilter->eos = TRUE; + if (pFilter->pFuncsTable->pfnEndOfStream) + hr = pFilter->pFuncsTable->pfnEndOfStream(pFilter); + else + hr = BaseRendererImpl_EndOfStream(pFilter); LeaveCriticalSection(&pFilter->filter.csFilter); LeaveCriticalSection(&pFilter->csRenderLock); return hr; @@ -128,6 +125,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_EndFlush(IPin * iface)
EnterCriticalSection(&pFilter->csRenderLock); EnterCriticalSection(&pFilter->filter.csFilter); + pFilter->eos = FALSE; hr = BaseInputPinImpl_EndFlush(iface); if (SUCCEEDED(hr)) { @@ -206,7 +204,7 @@ static HRESULT renderer_init_stream(struct strmbase_filter *iface)
if (filter->sink.pin.peer) ResetEvent(filter->state_event); - filter->sink.end_of_stream = FALSE; + filter->eos = FALSE; BaseRendererImpl_ClearPendingSample(filter); ResetEvent(filter->flush_event); if (filter->pFuncsTable->renderer_init_stream) @@ -222,7 +220,7 @@ static HRESULT renderer_start_stream(struct strmbase_filter *iface, REFERENCE_TI filter->stream_start = start; SetEvent(filter->state_event); if (filter->sink.pin.peer) - filter->sink.end_of_stream = FALSE; + filter->eos = FALSE; QualityControlRender_Start(filter->qcimpl, filter->stream_start); if (filter->sink.pin.peer && filter->pFuncsTable->renderer_start_stream) filter->pFuncsTable->renderer_start_stream(filter); @@ -339,7 +337,7 @@ HRESULT WINAPI BaseRendererImpl_Receive(struct strmbase_renderer *This, IMediaSa
TRACE("(%p)->%p\n", This, pSample);
- if (This->sink.end_of_stream || This->sink.flushing) + if (This->eos || This->sink.flushing) return S_FALSE;
if (This->filter.state == State_Stopped) diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index 29c385793a..d39dbbd3ab 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -76,7 +76,7 @@ static HRESULT WINAPI TransformFilter_Input_Receive(struct strmbase_sink *This, return VFW_E_WRONG_STATE; }
- if (This->end_of_stream || This->flushing) + if (This->flushing) { LeaveCriticalSection(&pTransform->csReceive); return S_FALSE; @@ -165,7 +165,6 @@ static HRESULT transform_init_stream(struct strmbase_filter *iface)
EnterCriticalSection(&filter->csReceive);
- filter->sink.end_of_stream = FALSE; if (filter->pFuncsTable->pfnStartStreaming) hr = filter->pFuncsTable->pfnStartStreaming(filter); if (SUCCEEDED(hr)) @@ -183,7 +182,6 @@ static HRESULT transform_cleanup_stream(struct strmbase_filter *iface)
EnterCriticalSection(&filter->csReceive);
- filter->sink.end_of_stream = FALSE; if (filter->pFuncsTable->pfnStopStreaming) hr = filter->pFuncsTable->pfnStopStreaming(filter); if (SUCCEEDED(hr)) diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index eace7c1e3b..d0a0da1b10 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -81,7 +81,7 @@ struct strmbase_sink
IMemInputPin IMemInputPin_iface; IMemAllocator *pAllocator; - BOOL flushing, end_of_stream; + BOOL flushing; IMemAllocator *preferred_allocator;
const struct strmbase_sink_ops *pFuncsTable; @@ -534,6 +534,8 @@ struct strmbase_renderer struct QualityControlImpl *qcimpl;
const struct strmbase_renderer_ops *pFuncsTable; + + BOOL eos; };
typedef HRESULT (WINAPI *BaseRenderer_CheckMediaType)(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt);