From 8cc83d7f5d406c84b25370ec76ba4dc21876d66f Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 13 Jun 2019 18:09:23 -0500 Subject: [PATCH] qcap/smartteefilter: Store the preview source pin inline in the SmartTeeFilter structure. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/qcap/smartteefilter.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index 541d7a8153b..51efe17b75b 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -38,8 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap); typedef struct { BaseFilter filter; BaseInputPin sink; - BaseOutputPin capture; - BaseOutputPin *preview; + BaseOutputPin capture, preview; } SmartTeeFilter; 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) return &filter->capture.pin.IPin_iface; else if (index == 2) - return &filter->preview->pin.IPin_iface; + return &filter->preview.pin.IPin_iface; return NULL; } @@ -137,8 +136,7 @@ static void smart_tee_destroy(BaseFilter *iface) strmbase_sink_cleanup(&filter->sink); strmbase_source_cleanup(&filter->capture); - if (filter->preview) - BaseOutputPinImpl_Release(&filter->preview->pin.IPin_iface); + strmbase_source_cleanup(&filter->preview); strmbase_filter_cleanup(&filter->filter); CoTaskMemFree(filter); } @@ -316,14 +314,14 @@ static HRESULT WINAPI SmartTeeFilterInput_Receive(BaseInputPin *base, IMediaSamp IMediaSample_Release(captureSample); EnterCriticalSection(&This->filter.csFilter); - if (This->preview->pin.pConnectedTo) - hrPreview = copy_sample(inputSample, This->preview->pAllocator, &previewSample); + if (This->preview.pin.pConnectedTo) + hrPreview = copy_sample(inputSample, This->preview.pAllocator, &previewSample); LeaveCriticalSection(&This->filter.csFilter); /* No timestamps on preview stream: */ if (SUCCEEDED(hrPreview)) hrPreview = IMediaSample_SetTime(previewSample, NULL, NULL); if (SUCCEEDED(hrPreview)) - hrPreview = BaseOutputPinImpl_Deliver(This->preview, previewSample); + hrPreview = BaseOutputPinImpl_Deliver(&This->preview, previewSample); if (previewSample) IMediaSample_Release(previewSample); @@ -531,22 +529,20 @@ IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr) hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, &IID_IMemAllocator, (void**)&This->sink.pAllocator); if (FAILED(hr)) - goto end; + { + *phr = hr; + strmbase_filter_cleanup(&This->filter); + return NULL; + } capturePinInfo.pFilter = &This->filter.IBaseFilter_iface; strmbase_source_init(&This->capture, &SmartTeeFilterCaptureVtbl, &capturePinInfo, &SmartTeeFilterCaptureFuncs, &This->filter.csFilter); previewPinInfo.pFilter = &This->filter.IBaseFilter_iface; - hr = BaseOutputPin_Construct(&SmartTeeFilterPreviewVtbl, sizeof(BaseOutputPin), &previewPinInfo, - &SmartTeeFilterPreviewFuncs, &This->filter.csFilter, (IPin**)&This->preview); + strmbase_source_init(&This->preview, &SmartTeeFilterPreviewVtbl, &previewPinInfo, + &SmartTeeFilterPreviewFuncs, &This->filter.csFilter); -end: - *phr = hr; - if (SUCCEEDED(hr)) { - return &This->filter.IUnknown_inner; - } else { - strmbase_filter_cleanup(&This->filter); - return NULL; - } + *phr = S_OK; + return &This->filter.IUnknown_inner; }