From 7e6ab5e53cc16a4ab7205789498469d44c692967 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 9 May 2019 10:12:33 -0500 Subject: [PATCH] strmbase: Move "AttemptConnection" to the base source pin function table. Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/amstream/mediastream.c | 2 -- dlls/qcap/avico.c | 3 +-- dlls/qcap/avimux.c | 5 ++--- dlls/qcap/smartteefilter.c | 5 ++--- dlls/qcap/vfwcapture.c | 2 +- dlls/quartz/filesource.c | 8 ++++---- dlls/quartz/parser.c | 2 +- dlls/strmbase/pin.c | 17 ++++++++--------- dlls/strmbase/renderer.c | 1 - dlls/strmbase/transform.c | 3 +-- dlls/winegstreamer/gstdemux.c | 2 +- dlls/wineqtdecoder/qtsplitter.c | 2 +- include/wine/strmbase.h | 10 +++++----- 13 files changed, 27 insertions(+), 35 deletions(-) diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index 4463eaafe7f..9b513519319 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -591,7 +591,6 @@ static const BaseInputPinFuncTable DirectDrawMediaStreamInputPin_FuncTable = { { DirectDrawMediaStreamInputPin_CheckMediaType, - NULL, DirectDrawMediaStreamInputPin_GetMediaTypeVersion, DirectDrawMediaStreamInputPin_GetMediaType, }, @@ -1135,7 +1134,6 @@ static const BaseInputPinFuncTable AudioMediaStreamInputPin_FuncTable = { { AudioMediaStreamInputPin_CheckMediaType, - NULL, AudioMediaStreamInputPin_GetMediaTypeVersion, AudioMediaStreamInputPin_GetMediaType, }, diff --git a/dlls/qcap/avico.c b/dlls/qcap/avico.c index 3351b36167a..bff1da474c0 100644 --- a/dlls/qcap/avico.c +++ b/dlls/qcap/avico.c @@ -574,7 +574,6 @@ static HRESULT WINAPI AVICompressorIn_Receive(BaseInputPin *base, IMediaSample * static const BaseInputPinFuncTable AVICompressorBaseInputPinVtbl = { { AVICompressorIn_CheckMediaType, - NULL, AVICompressorIn_GetMediaTypeVersion, AVICompressorIn_GetMediaType }, @@ -679,10 +678,10 @@ static HRESULT WINAPI AVICompressorOut_BreakConnect(BaseOutputPin *base) static const BaseOutputPinFuncTable AVICompressorBaseOutputPinVtbl = { { NULL, - BaseOutputPinImpl_AttemptConnection, AVICompressorOut_GetMediaTypeVersion, AVICompressorOut_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, AVICompressorOut_DecideBufferSize, AVICompressorOut_DecideAllocator, AVICompressorOut_BreakConnect diff --git a/dlls/qcap/avimux.c b/dlls/qcap/avimux.c index 427b019ec64..6ddff8f93b7 100644 --- a/dlls/qcap/avimux.c +++ b/dlls/qcap/avimux.c @@ -1229,7 +1229,7 @@ static HRESULT WINAPI AviMuxOut_CheckMediaType(BasePin *base, const AM_MEDIA_TYP return S_OK; } -static HRESULT WINAPI AviMuxOut_AttemptConnection(BasePin *base, +static HRESULT WINAPI AviMuxOut_AttemptConnection(BaseOutputPin *base, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) { PIN_DIRECTION dir; @@ -1306,10 +1306,10 @@ static HRESULT WINAPI AviMuxOut_BreakConnect(BaseOutputPin *base) static const BaseOutputPinFuncTable AviMuxOut_BaseOutputFuncTable = { { AviMuxOut_CheckMediaType, - AviMuxOut_AttemptConnection, AviMuxOut_GetMediaTypeVersion, AviMuxOut_GetMediaType }, + AviMuxOut_AttemptConnection, NULL, AviMuxOut_DecideAllocator, AviMuxOut_BreakConnect @@ -1701,7 +1701,6 @@ static HRESULT WINAPI AviMuxIn_Receive(BaseInputPin *base, IMediaSample *pSample static const BaseInputPinFuncTable AviMuxIn_BaseInputFuncTable = { { AviMuxIn_CheckMediaType, - NULL, AviMuxIn_GetMediaTypeVersion, AviMuxIn_GetMediaType }, diff --git a/dlls/qcap/smartteefilter.c b/dlls/qcap/smartteefilter.c index f052e2d0cd4..09176e3b167 100644 --- a/dlls/qcap/smartteefilter.c +++ b/dlls/qcap/smartteefilter.c @@ -425,7 +425,6 @@ static HRESULT WINAPI SmartTeeFilterInput_Receive(BaseInputPin *base, IMediaSamp static const BaseInputPinFuncTable SmartTeeFilterInputFuncs = { { SmartTeeFilterInput_CheckMediaType, - NULL, SmartTeeFilterInput_GetMediaTypeVersion, SmartTeeFilterInput_GetMediaType }, @@ -522,10 +521,10 @@ static HRESULT WINAPI SmartTeeFilterCapture_BreakConnect(BaseOutputPin *base) static const BaseOutputPinFuncTable SmartTeeFilterCaptureFuncs = { { SmartTeeFilterCapture_CheckMediaType, - BaseOutputPinImpl_AttemptConnection, SmartTeeFilterCapture_GetMediaTypeVersion, SmartTeeFilterCapture_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, NULL, SmartTeeFilterCapture_DecideAllocator, SmartTeeFilterCapture_BreakConnect @@ -621,10 +620,10 @@ static HRESULT WINAPI SmartTeeFilterPreview_BreakConnect(BaseOutputPin *base) static const BaseOutputPinFuncTable SmartTeeFilterPreviewFuncs = { { SmartTeeFilterPreview_CheckMediaType, - BaseOutputPinImpl_AttemptConnection, SmartTeeFilterPreview_GetMediaTypeVersion, SmartTeeFilterPreview_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, NULL, SmartTeeFilterPreview_DecideAllocator, SmartTeeFilterPreview_BreakConnect diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 8cf25c19b29..015f04a2149 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -707,10 +707,10 @@ static HRESULT WINAPI VfwPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocato static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { { VfwPin_CheckMediaType, - BaseOutputPinImpl_AttemptConnection, VfwPin_GetMediaTypeVersion, VfwPin_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, VfwPin_DecideBufferSize, BaseOutputPinImpl_DecideAllocator, BaseOutputPinImpl_BreakConnect diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index e53db995f43..c561424bdda 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -862,9 +862,9 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl = /* specific AM_MEDIA_TYPE - it cannot be NULL */ /* this differs from standard OutputPin_AttemptConnection only in that it * doesn't need the IMemInputPin interface on the receiving pin */ -static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(BasePin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) +static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(BaseOutputPin *This, + IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) { - BaseOutputPin *This = impl_BaseOutputPin_from_BasePin(iface); HRESULT hr; TRACE("%p->(%p, %p)\n", This, pReceivePin, pmt); @@ -876,7 +876,7 @@ static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(BasePin * iface, IPin IPin_AddRef(pReceivePin); CopyMediaType(&This->pin.mtCurrent, pmt); - hr = IPin_ReceiveConnection(pReceivePin, &iface->IPin_iface, pmt); + hr = IPin_ReceiveConnection(pReceivePin, &This->pin.IPin_iface, pmt); if (FAILED(hr)) { @@ -909,10 +909,10 @@ static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(BaseOutputPin *iface, static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { { FileAsyncReaderPin_CheckMediaType, - FileAsyncReaderPin_AttemptConnection, BasePinImpl_GetMediaTypeVersion, FileAsyncReaderPin_GetMediaType }, + FileAsyncReaderPin_AttemptConnection, FileAsyncReaderPin_DecideBufferSize, BaseOutputPinImpl_DecideAllocator, BaseOutputPinImpl_BreakConnect diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index b0cb500c56d..4145a3bf2a5 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -424,10 +424,10 @@ HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo) static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { { Parser_OutputPin_CheckMediaType, - BaseOutputPinImpl_AttemptConnection, BasePinImpl_GetMediaTypeVersion, Parser_OutputPin_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, Parser_OutputPin_DecideBufferSize, Parser_OutputPin_DecideAllocator, Parser_OutputPin_BreakConnect diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 8ae909850a8..376db5cdbe4 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -414,7 +414,7 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const /* if we have been a specific type to connect with, then we can either connect * with that or fail. We cannot choose different AM_MEDIA_TYPE */ if (pmt && !IsEqualGUID(&pmt->majortype, &GUID_NULL) && !IsEqualGUID(&pmt->subtype, &GUID_NULL)) - hr = This->pin.pFuncsTable->pfnAttemptConnection(&This->pin, pReceivePin, pmt); + hr = This->pFuncsTable->pfnAttemptConnection(This, pReceivePin, pmt); else { /* negotiate media type */ @@ -434,8 +434,8 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const if (!IsEqualGUID(&FORMAT_None, &pmtCandidate->formattype) && !IsEqualGUID(&GUID_NULL, &pmtCandidate->formattype)) assert(pmtCandidate->pbFormat); - if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) && - (This->pin.pFuncsTable->pfnAttemptConnection(&This->pin, pReceivePin, pmtCandidate) == S_OK)) + if ((!pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE)) + && This->pFuncsTable->pfnAttemptConnection(This, pReceivePin, pmtCandidate) == S_OK) { hr = S_OK; DeleteMediaType(pmtCandidate); @@ -458,8 +458,8 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const { assert(pmtCandidate); dump_AM_MEDIA_TYPE(pmtCandidate); - if (( !pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE) ) && - (This->pin.pFuncsTable->pfnAttemptConnection(&This->pin, pReceivePin, pmtCandidate) == S_OK)) + if ((!pmt || CompareMediaTypes(pmt, pmtCandidate, TRUE)) + && This->pFuncsTable->pfnAttemptConnection(This, pReceivePin, pmtCandidate) == S_OK) { hr = S_OK; DeleteMediaType(pmtCandidate); @@ -699,9 +699,8 @@ HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputP /* Function called as a helper to IPin_Connect */ /* specific AM_MEDIA_TYPE - it cannot be NULL */ -HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin* iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) +HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *This, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) { - BaseOutputPin *This = impl_BaseOutputPin_from_BasePin(iface); HRESULT hr; IMemAllocator * pMemAlloc = NULL; @@ -715,7 +714,7 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin* iface, IPin * pRecei IPin_AddRef(pReceivePin); CopyMediaType(&This->pin.mtCurrent, pmt); - hr = IPin_ReceiveConnection(pReceivePin, &iface->IPin_iface, pmt); + hr = IPin_ReceiveConnection(pReceivePin, &This->pin.IPin_iface, pmt); /* get the IMemInputPin interface we will use to deliver samples to the * connected pin */ @@ -792,7 +791,7 @@ HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outp } assert(outputpin_size >= sizeof(BaseOutputPin)); - assert(vtbl->base.pfnAttemptConnection); + assert(vtbl->pfnAttemptConnection); pPinImpl = CoTaskMemAlloc(outputpin_size); diff --git a/dlls/strmbase/renderer.c b/dlls/strmbase/renderer.c index 70b2d7150cb..47478ca537a 100644 --- a/dlls/strmbase/renderer.c +++ b/dlls/strmbase/renderer.c @@ -219,7 +219,6 @@ static const BaseFilterFuncTable RendererBaseFilterFuncTable = { static const BaseInputPinFuncTable input_BaseInputFuncTable = { { BaseRenderer_Input_CheckMediaType, - NULL, BasePinImpl_GetMediaTypeVersion, BasePinImpl_GetMediaType }, diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index c942e92c5cf..6bb75c1e6fe 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -152,7 +152,6 @@ static const BaseFilterFuncTable tfBaseFuncTable = { static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { { TransformFilter_Input_CheckMediaType, - NULL, BasePinImpl_GetMediaTypeVersion, BasePinImpl_GetMediaType }, @@ -162,10 +161,10 @@ static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { static const BaseOutputPinFuncTable tf_output_BaseOutputFuncTable = { { TransformFilter_Output_CheckMediaType, - BaseOutputPinImpl_AttemptConnection, BasePinImpl_GetMediaTypeVersion, TransformFilter_Output_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, TransformFilter_Output_DecideBufferSize, BaseOutputPinImpl_DecideAllocator, BaseOutputPinImpl_BreakConnect diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 200913f2491..eb20c05e1f6 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1872,10 +1872,10 @@ static const IPinVtbl GST_OutputPin_Vtbl = { static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { { GSTOutPin_CheckMediaType, - BaseOutputPinImpl_AttemptConnection, BasePinImpl_GetMediaTypeVersion, GSTOutPin_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, GSTOutPin_DecideBufferSize, GSTOutPin_DecideAllocator, GSTOutPin_BreakConnect diff --git a/dlls/wineqtdecoder/qtsplitter.c b/dlls/wineqtdecoder/qtsplitter.c index d2255b15d9c..056bd564dbd 100644 --- a/dlls/wineqtdecoder/qtsplitter.c +++ b/dlls/wineqtdecoder/qtsplitter.c @@ -1515,10 +1515,10 @@ static const IQualityControlVtbl QTOutPin_QualityControl_Vtbl = { static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { { QTOutPin_CheckMediaType, - BaseOutputPinImpl_AttemptConnection, BasePinImpl_GetMediaTypeVersion, QTOutPin_GetMediaType }, + BaseOutputPinImpl_AttemptConnection, QTOutPin_DecideBufferSize, QTOutPin_DecideAllocator, QTOutPin_BreakConnect diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index c49e085ba3d..b702c0788fd 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -44,15 +44,12 @@ typedef struct BasePin } BasePin; typedef HRESULT (WINAPI *BasePin_CheckMediaType)(BasePin *This, const AM_MEDIA_TYPE *pmt); -typedef HRESULT (WINAPI *BasePin_AttemptConnection)(BasePin *This, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt); typedef LONG (WINAPI *BasePin_GetMediaTypeVersion)(BasePin *This); typedef HRESULT (WINAPI *BasePin_GetMediaType)(BasePin *This, int iPosition, AM_MEDIA_TYPE *amt); typedef struct BasePinFuncTable { - /* Required for Input Pins*/ + /* Required for QueryAccept(), Connect(), ReceiveConnection(). */ BasePin_CheckMediaType pfnCheckMediaType; - /* Required for Output Pins*/ - BasePin_AttemptConnection pfnAttemptConnection; /* Required for BasePinImpl_EnumMediaTypes */ BasePin_GetMediaTypeVersion pfnGetMediaTypeVersion; BasePin_GetMediaType pfnGetMediaType; @@ -68,6 +65,7 @@ typedef struct BaseOutputPin const struct BaseOutputPinFuncTable* pFuncsTable; } BaseOutputPin; +typedef HRESULT (WINAPI *BaseOutputPin_AttemptConnection)(BaseOutputPin *pin, IPin *peer, const AM_MEDIA_TYPE *mt); typedef HRESULT (WINAPI *BaseOutputPin_DecideBufferSize)(BaseOutputPin *This, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest); typedef HRESULT (WINAPI *BaseOutputPin_DecideAllocator)(BaseOutputPin *This, IMemInputPin *pPin, IMemAllocator **pAlloc); typedef HRESULT (WINAPI *BaseOutputPin_BreakConnect)(BaseOutputPin * This); @@ -75,6 +73,8 @@ typedef HRESULT (WINAPI *BaseOutputPin_BreakConnect)(BaseOutputPin * This); typedef struct BaseOutputPinFuncTable { BasePinFuncTable base; + /* Required for Connect(). */ + BaseOutputPin_AttemptConnection pfnAttemptConnection; /* Required for BaseOutputPinImpl_DecideAllocator */ BaseOutputPin_DecideBufferSize pfnDecideBufferSize; /* Required for BaseOutputPinImpl_AttemptConnection */ @@ -135,7 +135,7 @@ HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin * This); HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin * This); HRESULT WINAPI BaseOutputPinImpl_InitAllocator(BaseOutputPin *This, IMemAllocator **pMemAlloc); HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputPin *pPin, IMemAllocator **pAlloc); -HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin *This, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt); +HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *pin, IPin *peer, const AM_MEDIA_TYPE *mt); HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); HRESULT WINAPI BaseOutputPin_Destroy(BaseOutputPin *This);