Commit 2481b53d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap/smartteefilter: Store the sink pin inline in the AviCompressor structure.

parent f2206d3d
...@@ -37,7 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap); ...@@ -37,7 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap);
typedef struct { typedef struct {
BaseFilter filter; BaseFilter filter;
BaseInputPin *input; BaseInputPin sink;
BaseOutputPin *capture; BaseOutputPin *capture;
BaseOutputPin *preview; BaseOutputPin *preview;
} SmartTeeFilter; } SmartTeeFilter;
...@@ -91,7 +91,7 @@ static HRESULT WINAPI SmartTeeFilter_Run(IBaseFilter *iface, REFERENCE_TIME tSta ...@@ -91,7 +91,7 @@ static HRESULT WINAPI SmartTeeFilter_Run(IBaseFilter *iface, REFERENCE_TIME tSta
/* We share an allocator among all pins, an allocator can only get committed /* We share an allocator among all pins, an allocator can only get committed
* once, state transitions occur in upstream order, and only output pins * 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. */ * commit allocators, so let the filter attached to the input pin worry about it. */
if (This->input->pin.pConnectedTo) if (This->sink.pin.pConnectedTo)
This->filter.state = State_Running; This->filter.state = State_Running;
else else
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
...@@ -123,7 +123,7 @@ static IPin *smart_tee_get_pin(BaseFilter *iface, unsigned int index) ...@@ -123,7 +123,7 @@ static IPin *smart_tee_get_pin(BaseFilter *iface, unsigned int index)
SmartTeeFilter *filter = impl_from_BaseFilter(iface); SmartTeeFilter *filter = impl_from_BaseFilter(iface);
if (index == 0) if (index == 0)
return &filter->input->pin.IPin_iface; return &filter->sink.pin.IPin_iface;
else if (index == 1) else if (index == 1)
return &filter->capture->pin.IPin_iface; return &filter->capture->pin.IPin_iface;
else if (index == 2) else if (index == 2)
...@@ -135,8 +135,7 @@ static void smart_tee_destroy(BaseFilter *iface) ...@@ -135,8 +135,7 @@ static void smart_tee_destroy(BaseFilter *iface)
{ {
SmartTeeFilter *filter = impl_from_BaseFilter(iface); SmartTeeFilter *filter = impl_from_BaseFilter(iface);
if (filter->input) strmbase_sink_cleanup(&filter->sink);
BaseInputPinImpl_Release(&filter->input->pin.IPin_iface);
if (filter->capture) if (filter->capture)
BaseOutputPinImpl_Release(&filter->capture->pin.IPin_iface); BaseOutputPinImpl_Release(&filter->capture->pin.IPin_iface);
if (filter->preview) if (filter->preview)
...@@ -204,10 +203,12 @@ static HRESULT WINAPI SmartTeeFilterInput_GetMediaType(BasePin *base, int iPosit ...@@ -204,10 +203,12 @@ static HRESULT WINAPI SmartTeeFilterInput_GetMediaType(BasePin *base, int iPosit
if (iPosition) if (iPosition)
return S_FALSE; return S_FALSE;
EnterCriticalSection(&This->filter.csFilter); EnterCriticalSection(&This->filter.csFilter);
if (This->input->pin.pConnectedTo) { if (This->sink.pin.pConnectedTo)
CopyMediaType(amt, &This->input->pin.mtCurrent); {
CopyMediaType(amt, &This->sink.pin.mtCurrent);
hr = S_OK; hr = S_OK;
} else }
else
hr = S_FALSE; hr = S_FALSE;
LeaveCriticalSection(&This->filter.csFilter); LeaveCriticalSection(&This->filter.csFilter);
return hr; return hr;
...@@ -360,9 +361,9 @@ static HRESULT WINAPI SmartTeeFilterCapture_EnumMediaTypes(IPin *iface, IEnumMed ...@@ -360,9 +361,9 @@ static HRESULT WINAPI SmartTeeFilterCapture_EnumMediaTypes(IPin *iface, IEnumMed
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%p)\n", This, ppEnum); TRACE("(%p)->(%p)\n", This, ppEnum);
EnterCriticalSection(&This->filter.csFilter); EnterCriticalSection(&This->filter.csFilter);
if (This->input->pin.pConnectedTo) { if (This->sink.pin.pConnectedTo)
hr = BasePinImpl_EnumMediaTypes(iface, ppEnum); hr = BasePinImpl_EnumMediaTypes(iface, ppEnum);
} else else
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
LeaveCriticalSection(&This->filter.csFilter); LeaveCriticalSection(&This->filter.csFilter);
return hr; return hr;
...@@ -400,7 +401,7 @@ static HRESULT WINAPI SmartTeeFilterCapture_GetMediaType(BasePin *base, int iPos ...@@ -400,7 +401,7 @@ static HRESULT WINAPI SmartTeeFilterCapture_GetMediaType(BasePin *base, int iPos
SmartTeeFilter *This = impl_from_BasePin(base); SmartTeeFilter *This = impl_from_BasePin(base);
TRACE("(%p, %d, %p)\n", This, iPosition, amt); TRACE("(%p, %d, %p)\n", This, iPosition, amt);
if (iPosition == 0) { if (iPosition == 0) {
CopyMediaType(amt, &This->input->pin.mtCurrent); CopyMediaType(amt, &This->sink.pin.mtCurrent);
return S_OK; return S_OK;
} else } else
return S_FALSE; return S_FALSE;
...@@ -410,9 +411,9 @@ static HRESULT WINAPI SmartTeeFilterCapture_DecideAllocator(BaseOutputPin *base, ...@@ -410,9 +411,9 @@ static HRESULT WINAPI SmartTeeFilterCapture_DecideAllocator(BaseOutputPin *base,
{ {
SmartTeeFilter *This = impl_from_BasePin(&base->pin); SmartTeeFilter *This = impl_from_BasePin(&base->pin);
TRACE("(%p, %p, %p)\n", This, pPin, pAlloc); TRACE("(%p, %p, %p)\n", This, pPin, pAlloc);
*pAlloc = This->input->pAllocator; *pAlloc = This->sink.pAllocator;
IMemAllocator_AddRef(This->input->pAllocator); IMemAllocator_AddRef(This->sink.pAllocator);
return IMemInputPin_NotifyAllocator(pPin, This->input->pAllocator, TRUE); return IMemInputPin_NotifyAllocator(pPin, This->sink.pAllocator, TRUE);
} }
static const BaseOutputPinFuncTable SmartTeeFilterCaptureFuncs = { static const BaseOutputPinFuncTable SmartTeeFilterCaptureFuncs = {
...@@ -443,9 +444,9 @@ static HRESULT WINAPI SmartTeeFilterPreview_EnumMediaTypes(IPin *iface, IEnumMed ...@@ -443,9 +444,9 @@ static HRESULT WINAPI SmartTeeFilterPreview_EnumMediaTypes(IPin *iface, IEnumMed
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%p)\n", This, ppEnum); TRACE("(%p)->(%p)\n", This, ppEnum);
EnterCriticalSection(&This->filter.csFilter); EnterCriticalSection(&This->filter.csFilter);
if (This->input->pin.pConnectedTo) { if (This->sink.pin.pConnectedTo)
hr = BasePinImpl_EnumMediaTypes(iface, ppEnum); hr = BasePinImpl_EnumMediaTypes(iface, ppEnum);
} else else
hr = VFW_E_NOT_CONNECTED; hr = VFW_E_NOT_CONNECTED;
LeaveCriticalSection(&This->filter.csFilter); LeaveCriticalSection(&This->filter.csFilter);
return hr; return hr;
...@@ -483,7 +484,7 @@ static HRESULT WINAPI SmartTeeFilterPreview_GetMediaType(BasePin *base, int iPos ...@@ -483,7 +484,7 @@ static HRESULT WINAPI SmartTeeFilterPreview_GetMediaType(BasePin *base, int iPos
SmartTeeFilter *This = impl_from_BasePin(base); SmartTeeFilter *This = impl_from_BasePin(base);
TRACE("(%p, %d, %p)\n", This, iPosition, amt); TRACE("(%p, %d, %p)\n", This, iPosition, amt);
if (iPosition == 0) { if (iPosition == 0) {
CopyMediaType(amt, &This->input->pin.mtCurrent); CopyMediaType(amt, &This->sink.pin.mtCurrent);
return S_OK; return S_OK;
} else } else
return S_FALSE; return S_FALSE;
...@@ -493,9 +494,9 @@ static HRESULT WINAPI SmartTeeFilterPreview_DecideAllocator(BaseOutputPin *base, ...@@ -493,9 +494,9 @@ static HRESULT WINAPI SmartTeeFilterPreview_DecideAllocator(BaseOutputPin *base,
{ {
SmartTeeFilter *This = impl_from_BasePin(&base->pin); SmartTeeFilter *This = impl_from_BasePin(&base->pin);
TRACE("(%p, %p, %p)\n", This, pPin, pAlloc); TRACE("(%p, %p, %p)\n", This, pPin, pAlloc);
*pAlloc = This->input->pAllocator; *pAlloc = This->sink.pAllocator;
IMemAllocator_AddRef(This->input->pAllocator); IMemAllocator_AddRef(This->sink.pAllocator);
return IMemInputPin_NotifyAllocator(pPin, This->input->pAllocator, TRUE); return IMemInputPin_NotifyAllocator(pPin, This->sink.pAllocator, TRUE);
} }
static const BaseOutputPinFuncTable SmartTeeFilterPreviewFuncs = { static const BaseOutputPinFuncTable SmartTeeFilterPreviewFuncs = {
...@@ -526,12 +527,10 @@ IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr) ...@@ -526,12 +527,10 @@ IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
(DWORD_PTR)(__FILE__ ": SmartTeeFilter.csFilter"), &SmartTeeFilterFuncs); (DWORD_PTR)(__FILE__ ": SmartTeeFilter.csFilter"), &SmartTeeFilterFuncs);
inputPinInfo.pFilter = &This->filter.IBaseFilter_iface; inputPinInfo.pFilter = &This->filter.IBaseFilter_iface;
hr = BaseInputPin_Construct(&SmartTeeFilterInputVtbl, sizeof(BaseInputPin), &inputPinInfo, strmbase_sink_init(&This->sink, &SmartTeeFilterInputVtbl, &inputPinInfo,
&SmartTeeFilterInputFuncs, &This->filter.csFilter, NULL, (IPin**)&This->input); &SmartTeeFilterInputFuncs, &This->filter.csFilter, NULL);
if (FAILED(hr))
goto end;
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
&IID_IMemAllocator, (void**)&This->input->pAllocator); &IID_IMemAllocator, (void**)&This->sink.pAllocator);
if (FAILED(hr)) if (FAILED(hr))
goto end; goto end;
......
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