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

qcap/smartteefilter: Use strmbase filter state change methods.

parent 4f29ddf7
......@@ -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,
......
......@@ -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);
......
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