BaseOutputPinImpl_GetDeliveryBuffer() is doing nothing helpful here.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/quartz/acmwrapper.c | 3 +-- dlls/quartz/avidec.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/acmwrapper.c b/dlls/quartz/acmwrapper.c index 12d96f69376..cf8e7cd125d 100644 --- a/dlls/quartz/acmwrapper.c +++ b/dlls/quartz/acmwrapper.c @@ -140,8 +140,7 @@ static HRESULT WINAPI acm_wrapper_sink_Receive(struct strmbase_sink *iface, IMed
while(hr == S_OK && ash.cbSrcLength) { - hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->source, &pOutSample, NULL, NULL, 0); - if (FAILED(hr)) + if (FAILED(hr = IMemAllocator_GetBuffer(This->source.pAllocator, &pOutSample, NULL, NULL, 0))) { ERR("Failed to get sample, hr %#lx.\n", hr); return hr; diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index 30b6c741eed..f8660890273 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -139,8 +139,8 @@ static HRESULT WINAPI avi_decompressor_sink_Receive(struct strmbase_sink *iface, /* Update input size to match sample size */ This->pBihIn->biSizeImage = cbSrcStream;
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&This->source, &pOutSample, NULL, NULL, 0); - if (FAILED(hr)) { + if (FAILED(hr = IMemAllocator_GetBuffer(This->source.pAllocator, &pOutSample, NULL, NULL, 0))) + { ERR("Failed to get sample, hr %#lx.\n", hr); return hr; }
BaseOutputPinImpl_GetDeliveryBuffer() is doing nothing helpful here. Note that we cannot be unconnected at this point, or stream_thread() would not even be running.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/quartz_parser.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/dlls/winegstreamer/quartz_parser.c b/dlls/winegstreamer/quartz_parser.c index 331bc9a888a..45313ebda27 100644 --- a/dlls/winegstreamer/quartz_parser.c +++ b/dlls/winegstreamer/quartz_parser.c @@ -753,12 +753,9 @@ static void send_buffer(struct parser_source *pin, const struct wg_parser_event { uint32_t advance;
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&pin->pin, &sample, NULL, NULL, 0); - - if (FAILED(hr)) + if (FAILED(hr = IMemAllocator_GetBuffer(pin->pin.pAllocator, &sample, NULL, NULL, 0))) { - if (hr != VFW_E_NOT_CONNECTED) - ERR("Failed to get a sample, hr %#lx.\n", hr); + ERR("Failed to get a sample, hr %#lx.\n", hr); break; }
@@ -776,12 +773,9 @@ static void send_buffer(struct parser_source *pin, const struct wg_parser_event } else { - hr = BaseOutputPinImpl_GetDeliveryBuffer(&pin->pin, &sample, NULL, NULL, 0); - - if (FAILED(hr)) + if (FAILED(hr = IMemAllocator_GetBuffer(pin->pin.pAllocator, &sample, NULL, NULL, 0))) { - if (hr != VFW_E_NOT_CONNECTED) - ERR("Failed to get a sample, hr %#lx.\n", hr); + ERR("Failed to get a sample, hr %#lx.\n", hr); } else {
BaseOutputPinImpl_GetDeliveryBuffer() is doing nothing helpful here.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/amstream/tests/amstream.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index d27bf801482..5b3e78e0583 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -4256,7 +4256,7 @@ static void test_audiostream_begin_flush_end_flush(void) hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&source.source, &media_sample, NULL, NULL, 0); + hr = IMemAllocator_GetBuffer(source.source.pAllocator, &media_sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -4272,7 +4272,7 @@ static void test_audiostream_begin_flush_end_flush(void) ref = IMediaSample_Release(media_sample); ok(!ref, "Got outstanding refcount %d.\n", ref);
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&source.source, &media_sample, NULL, NULL, 0); + hr = IMemAllocator_GetBuffer(source.source.pAllocator, &media_sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -4289,7 +4289,7 @@ static void test_audiostream_begin_flush_end_flush(void) hr = IPin_EndFlush(pin); ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&source.source, &media_sample, NULL, NULL, 0); + hr = IMemAllocator_GetBuffer(source.source.pAllocator, &media_sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -4408,7 +4408,7 @@ static IMediaSample *ammediastream_allocate_sample(struct testfilter *source, co BYTE *sample_data; HRESULT hr;
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&source->source, &sample, NULL, NULL, 0); + hr = IMemAllocator_GetBuffer(source->source.pAllocator, &sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaSample_GetPointer(sample, &sample_data); @@ -5848,7 +5848,7 @@ static void test_ddrawstream_begin_flush_end_flush(void) hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&source.source, &media_sample, NULL, NULL, 0); + hr = IMemAllocator_GetBuffer(source.source.pAllocator, &media_sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#x.\n", hr);
ammediastream_mem_input_pin = source.source.pMemInputPin; @@ -5866,7 +5866,7 @@ static void test_ddrawstream_begin_flush_end_flush(void) ref = IMediaSample_Release(media_sample); ok(!ref, "Got outstanding refcount %d.\n", ref);
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&source.source, &media_sample, NULL, NULL, 0); + hr = IMemAllocator_GetBuffer(source.source.pAllocator, &media_sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -5883,7 +5883,7 @@ static void test_ddrawstream_begin_flush_end_flush(void) hr = IPin_EndFlush(pin); ok(hr == S_OK, "Got hr %#x.\n", hr);
- hr = BaseOutputPinImpl_GetDeliveryBuffer(&source.source, &media_sample, NULL, NULL, 0); + hr = IMemAllocator_GetBuffer(source.source.pAllocator, &media_sample, NULL, NULL, 0); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); ok(hr == S_OK, "Got hr %#x.\n", hr);
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/qcap/tests/videocapture.c | 53 ++++++++++++++++++++++++++++++++++ dlls/qcap/vfwcapture.c | 18 +++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/dlls/qcap/tests/videocapture.c b/dlls/qcap/tests/videocapture.c index c44070b0bd5..4e9dca7d837 100644 --- a/dlls/qcap/tests/videocapture.c +++ b/dlls/qcap/tests/videocapture.c @@ -296,6 +296,58 @@ static void test_misc_flags(IBaseFilter *filter) IAMFilterMiscFlags_Release(misc_flags); }
+static void test_unconnected_filter_state(IBaseFilter *filter) +{ + FILTER_STATE state; + HRESULT hr; + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + + hr = IBaseFilter_Pause(filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %u.\n", state); + + hr = IBaseFilter_Run(filter, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Running, "Got state %u.\n", state); + + hr = IBaseFilter_Pause(filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Paused, "Got state %u.\n", state); + + hr = IBaseFilter_Stop(filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); + + hr = IBaseFilter_Run(filter, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Running, "Got state %u.\n", state); + + hr = IBaseFilter_Stop(filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IBaseFilter_GetState(filter, 0, &state); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(state == State_Stopped, "Got state %u.\n", state); +} + struct testfilter { struct strmbase_filter filter; @@ -615,6 +667,7 @@ START_TEST(videocapture) test_filter_interfaces(filter); test_pins(filter); test_misc_flags(filter); + test_unconnected_filter_state(filter);
ref = IBaseFilter_Release(filter); ok(!ref, "Got outstanding refcount %d.\n", ref); diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 6b82af9d155..7e6b0ee5afe 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -199,6 +199,9 @@ static HRESULT vfw_capture_init_stream(struct strmbase_filter *iface) struct vfw_capture *filter = impl_from_strmbase_filter(iface); HRESULT hr;
+ if (!filter->source.pin.peer) + return S_OK; + if (FAILED(hr = IMemAllocator_Commit(filter->source.pAllocator))) ERR("Failed to commit allocator, hr %#x.\n", hr);
@@ -215,6 +218,9 @@ static HRESULT vfw_capture_start_stream(struct strmbase_filter *iface, REFERENCE { struct vfw_capture *filter = impl_from_strmbase_filter(iface);
+ if (!filter->source.pin.peer) + return S_OK; + EnterCriticalSection(&filter->state_cs); filter->state = State_Running; LeaveCriticalSection(&filter->state_cs); @@ -226,6 +232,9 @@ static HRESULT vfw_capture_stop_stream(struct strmbase_filter *iface) { struct vfw_capture *filter = impl_from_strmbase_filter(iface);
+ if (!filter->source.pin.peer) + return S_OK; + EnterCriticalSection(&filter->state_cs); filter->state = State_Paused; LeaveCriticalSection(&filter->state_cs); @@ -237,6 +246,9 @@ static HRESULT vfw_capture_cleanup_stream(struct strmbase_filter *iface) struct vfw_capture *filter = impl_from_strmbase_filter(iface); HRESULT hr;
+ if (!filter->source.pin.peer) + return S_OK; + EnterCriticalSection(&filter->state_cs); filter->state = State_Stopped; LeaveCriticalSection(&filter->state_cs); @@ -255,7 +267,11 @@ static HRESULT vfw_capture_cleanup_stream(struct strmbase_filter *iface)
static HRESULT vfw_capture_wait_state(struct strmbase_filter *iface, DWORD timeout) { - return iface->state == State_Paused ? VFW_S_CANT_CUE : S_OK; + struct vfw_capture *filter = impl_from_strmbase_filter(iface); + + if (filter->source.pin.peer && filter->filter.state == State_Paused) + return VFW_S_CANT_CUE; + return S_OK; }
static const struct strmbase_filter_ops filter_ops =
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/qcap/avico.c | 9 +++++++-- dlls/qcap/vfwcapture.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index e8a452fc7f5..b56a051d67b 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -350,9 +350,14 @@ static HRESULT WINAPI AVICompressorIn_Receive(struct strmbase_sink *base, IMedia return hres; }
- hres = BaseOutputPinImpl_GetDeliveryBuffer(&This->source, &out_sample, &start, &stop, 0); - if(FAILED(hres)) + if (FAILED(hres = IMemAllocator_GetBuffer(This->source.pAllocator, &out_sample, &start, &stop, 0))) + { + ERR("Failed to get sample, hr %#x.\n", hres); return hres; + } + + if (FAILED(hres = IMediaSample_SetTime(out_sample, &start, &stop))) + ERR("Failed to set time, hr %#x.\n", hres);
hres = IMediaSample_GetPointer(out_sample, &buf); if(FAILED(hres)) diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 7e6b0ee5afe..84d6c093cc6 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -165,7 +165,7 @@ static DWORD WINAPI stream_thread(void *arg)
LeaveCriticalSection(&filter->state_cs);
- if (FAILED(hr = BaseOutputPinImpl_GetDeliveryBuffer(&filter->source, &sample, NULL, NULL, 0))) + if (FAILED(hr = IMemAllocator_GetBuffer(filter->source.pAllocator, &sample, NULL, NULL, 0))) { ERR("Failed to get sample, hr %#x.\n", hr); break;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- include/wine/strmbase.h | 2 -- libs/strmbase/pin.c | 20 -------------------- 2 files changed, 22 deletions(-)
diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index 1c8696ed620..868ea4c580a 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -105,8 +105,6 @@ struct strmbase_sink_ops };
/* Base Pin */ -HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(struct strmbase_source *pin, - IMediaSample **sample, REFERENCE_TIME *start, REFERENCE_TIME *stop, DWORD flags); HRESULT WINAPI BaseOutputPinImpl_InitAllocator(struct strmbase_source *pin, IMemAllocator **allocator); HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(struct strmbase_source *pin, IMemInputPin *peer, IMemAllocator **allocator); HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *pin, IPin *peer, const AM_MEDIA_TYPE *mt); diff --git a/libs/strmbase/pin.c b/libs/strmbase/pin.c index 36b3fdf1425..f6e4ef1c139 100644 --- a/libs/strmbase/pin.c +++ b/libs/strmbase/pin.c @@ -677,26 +677,6 @@ static const IPinVtbl source_vtbl = source_NewSegment, };
-HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(struct strmbase_source *This, - IMediaSample **ppSample, REFERENCE_TIME *tStart, REFERENCE_TIME *tStop, DWORD dwFlags) -{ - HRESULT hr; - - TRACE("(%p)->(%p, %p, %p, %x)\n", This, ppSample, tStart, tStop, dwFlags); - - if (!This->pin.peer) - hr = VFW_E_NOT_CONNECTED; - else - { - hr = IMemAllocator_GetBuffer(This->pAllocator, ppSample, tStart, tStop, dwFlags); - - if (SUCCEEDED(hr)) - hr = IMediaSample_SetTime(*ppSample, tStart, tStop); - } - - return hr; -} - HRESULT WINAPI BaseOutputPinImpl_InitAllocator(struct strmbase_source *This, IMemAllocator **pMemAlloc) { return CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (LPVOID*)pMemAlloc);