From e1f00bfc5e0dd9cd7c5b2a318c07986a4d332329 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 26 Sep 2019 21:40:52 -0500 Subject: [PATCH] qcap/smartteefilter: Use strmbase filter state change methods. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/qcap/smartteefilter.c | 48 ++------------------------------ dlls/qcap/tests/smartteefilter.c | 16 +++++------ 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index b2e5496b7dd..d7e9e8b5f15 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -46,61 +46,19 @@ static inline SmartTeeFilter *impl_from_strmbase_filter(struct strmbase_filter * return CONTAINING_RECORD(filter, SmartTeeFilter, filter); } -static inline SmartTeeFilter *impl_from_IBaseFilter(IBaseFilter *iface) -{ - struct strmbase_filter *filter = CONTAINING_RECORD(iface, struct strmbase_filter, IBaseFilter_iface); - return impl_from_strmbase_filter(filter); -} - static inline SmartTeeFilter *impl_from_strmbase_pin(struct strmbase_pin *pin) { return impl_from_strmbase_filter(pin->filter); } -static HRESULT WINAPI SmartTeeFilter_Stop(IBaseFilter *iface) -{ - SmartTeeFilter *This = impl_from_IBaseFilter(iface); - TRACE("(%p)\n", This); - EnterCriticalSection(&This->filter.csFilter); - This->filter.state = State_Stopped; - LeaveCriticalSection(&This->filter.csFilter); - return S_OK; -} - -static HRESULT WINAPI SmartTeeFilter_Pause(IBaseFilter *iface) -{ - SmartTeeFilter *This = impl_from_IBaseFilter(iface); - FIXME("(%p): stub\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI SmartTeeFilter_Run(IBaseFilter *iface, REFERENCE_TIME tStart) -{ - SmartTeeFilter *This = impl_from_IBaseFilter(iface); - HRESULT hr = S_OK; - TRACE("(%p, %s)\n", This, wine_dbgstr_longlong(tStart)); - EnterCriticalSection(&This->filter.csFilter); - if(This->filter.state != State_Running) { - /* We share an allocator among all pins, an allocator can only get committed - * once, state transitions occur in upstream order, and only output pins - * commit allocators, so let the filter attached to the input pin worry about it. */ - if (This->sink.pin.pConnectedTo) - This->filter.state = State_Running; - else - hr = VFW_E_NOT_CONNECTED; - } - LeaveCriticalSection(&This->filter.csFilter); - return hr; -} - static const IBaseFilterVtbl SmartTeeFilterVtbl = { BaseFilterImpl_QueryInterface, BaseFilterImpl_AddRef, BaseFilterImpl_Release, BaseFilterImpl_GetClassID, - SmartTeeFilter_Stop, - SmartTeeFilter_Pause, - SmartTeeFilter_Run, + BaseFilterImpl_Stop, + BaseFilterImpl_Pause, + BaseFilterImpl_Run, BaseFilterImpl_GetState, BaseFilterImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, diff --git a/dlls/qcap/tests/smartteefilter.c b/dlls/qcap/tests/smartteefilter.c index 437f3f4a7f2..4eac344d537 100644 --- a/dlls/qcap/tests/smartteefilter.c +++ b/dlls/qcap/tests/smartteefilter.c @@ -2166,25 +2166,25 @@ static void test_unconnected_filter_state(void) ok(state == State_Stopped, "Got state %u.\n", state); hr = IBaseFilter_Pause(filter); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IBaseFilter_GetState(filter, 0, &state); todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr); - todo_wine ok(state == State_Paused, "Got state %u.\n", state); + ok(state == State_Paused, "Got state %u.\n", state); hr = IBaseFilter_Run(filter, 0); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IBaseFilter_GetState(filter, 0, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(state == State_Running, "Got state %u.\n", state); + ok(state == State_Running, "Got state %u.\n", state); hr = IBaseFilter_Pause(filter); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IBaseFilter_GetState(filter, 0, &state); todo_wine ok(hr == VFW_S_CANT_CUE, "Got hr %#x.\n", hr); - todo_wine ok(state == State_Paused, "Got state %u.\n", state); + ok(state == State_Paused, "Got state %u.\n", state); hr = IBaseFilter_Stop(filter); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -2194,11 +2194,11 @@ static void test_unconnected_filter_state(void) ok(state == State_Stopped, "Got state %u.\n", state); hr = IBaseFilter_Run(filter, 0); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IBaseFilter_GetState(filter, 0, &state); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(state == State_Running, "Got state %u.\n", state); + ok(state == State_Running, "Got state %u.\n", state); hr = IBaseFilter_Stop(filter); ok(hr == S_OK, "Got hr %#x.\n", hr);