qcap/smartteefilter: Store the preview source pin inline in the SmartTeeFilter structure.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d7b374ed8
commit
8cc83d7f5d
|
@ -38,8 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BaseFilter filter;
|
BaseFilter filter;
|
||||||
BaseInputPin sink;
|
BaseInputPin sink;
|
||||||
BaseOutputPin capture;
|
BaseOutputPin capture, preview;
|
||||||
BaseOutputPin *preview;
|
|
||||||
} SmartTeeFilter;
|
} SmartTeeFilter;
|
||||||
|
|
||||||
static inline SmartTeeFilter *impl_from_BaseFilter(BaseFilter *filter)
|
static inline SmartTeeFilter *impl_from_BaseFilter(BaseFilter *filter)
|
||||||
|
@ -127,7 +126,7 @@ static IPin *smart_tee_get_pin(BaseFilter *iface, unsigned int index)
|
||||||
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)
|
||||||
return &filter->preview->pin.IPin_iface;
|
return &filter->preview.pin.IPin_iface;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,8 +136,7 @@ static void smart_tee_destroy(BaseFilter *iface)
|
||||||
|
|
||||||
strmbase_sink_cleanup(&filter->sink);
|
strmbase_sink_cleanup(&filter->sink);
|
||||||
strmbase_source_cleanup(&filter->capture);
|
strmbase_source_cleanup(&filter->capture);
|
||||||
if (filter->preview)
|
strmbase_source_cleanup(&filter->preview);
|
||||||
BaseOutputPinImpl_Release(&filter->preview->pin.IPin_iface);
|
|
||||||
strmbase_filter_cleanup(&filter->filter);
|
strmbase_filter_cleanup(&filter->filter);
|
||||||
CoTaskMemFree(filter);
|
CoTaskMemFree(filter);
|
||||||
}
|
}
|
||||||
|
@ -316,14 +314,14 @@ static HRESULT WINAPI SmartTeeFilterInput_Receive(BaseInputPin *base, IMediaSamp
|
||||||
IMediaSample_Release(captureSample);
|
IMediaSample_Release(captureSample);
|
||||||
|
|
||||||
EnterCriticalSection(&This->filter.csFilter);
|
EnterCriticalSection(&This->filter.csFilter);
|
||||||
if (This->preview->pin.pConnectedTo)
|
if (This->preview.pin.pConnectedTo)
|
||||||
hrPreview = copy_sample(inputSample, This->preview->pAllocator, &previewSample);
|
hrPreview = copy_sample(inputSample, This->preview.pAllocator, &previewSample);
|
||||||
LeaveCriticalSection(&This->filter.csFilter);
|
LeaveCriticalSection(&This->filter.csFilter);
|
||||||
/* No timestamps on preview stream: */
|
/* No timestamps on preview stream: */
|
||||||
if (SUCCEEDED(hrPreview))
|
if (SUCCEEDED(hrPreview))
|
||||||
hrPreview = IMediaSample_SetTime(previewSample, NULL, NULL);
|
hrPreview = IMediaSample_SetTime(previewSample, NULL, NULL);
|
||||||
if (SUCCEEDED(hrPreview))
|
if (SUCCEEDED(hrPreview))
|
||||||
hrPreview = BaseOutputPinImpl_Deliver(This->preview, previewSample);
|
hrPreview = BaseOutputPinImpl_Deliver(&This->preview, previewSample);
|
||||||
if (previewSample)
|
if (previewSample)
|
||||||
IMediaSample_Release(previewSample);
|
IMediaSample_Release(previewSample);
|
||||||
|
|
||||||
|
@ -531,22 +529,20 @@ IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
|
||||||
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
|
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
|
||||||
&IID_IMemAllocator, (void**)&This->sink.pAllocator);
|
&IID_IMemAllocator, (void**)&This->sink.pAllocator);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
goto end;
|
{
|
||||||
|
*phr = hr;
|
||||||
|
strmbase_filter_cleanup(&This->filter);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
capturePinInfo.pFilter = &This->filter.IBaseFilter_iface;
|
capturePinInfo.pFilter = &This->filter.IBaseFilter_iface;
|
||||||
strmbase_source_init(&This->capture, &SmartTeeFilterCaptureVtbl, &capturePinInfo,
|
strmbase_source_init(&This->capture, &SmartTeeFilterCaptureVtbl, &capturePinInfo,
|
||||||
&SmartTeeFilterCaptureFuncs, &This->filter.csFilter);
|
&SmartTeeFilterCaptureFuncs, &This->filter.csFilter);
|
||||||
|
|
||||||
previewPinInfo.pFilter = &This->filter.IBaseFilter_iface;
|
previewPinInfo.pFilter = &This->filter.IBaseFilter_iface;
|
||||||
hr = BaseOutputPin_Construct(&SmartTeeFilterPreviewVtbl, sizeof(BaseOutputPin), &previewPinInfo,
|
strmbase_source_init(&This->preview, &SmartTeeFilterPreviewVtbl, &previewPinInfo,
|
||||||
&SmartTeeFilterPreviewFuncs, &This->filter.csFilter, (IPin**)&This->preview);
|
&SmartTeeFilterPreviewFuncs, &This->filter.csFilter);
|
||||||
|
|
||||||
end:
|
*phr = S_OK;
|
||||||
*phr = hr;
|
return &This->filter.IUnknown_inner;
|
||||||
if (SUCCEEDED(hr)) {
|
|
||||||
return &This->filter.IUnknown_inner;
|
|
||||||
} else {
|
|
||||||
strmbase_filter_cleanup(&This->filter);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue