Commit 7e6ab5e5 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Move "AttemptConnection" to the base source pin function table.

parent e48559b2
......@@ -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,
},
......
......@@ -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
......
......@@ -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
},
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
......@@ -219,7 +219,6 @@ static const BaseFilterFuncTable RendererBaseFilterFuncTable = {
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
{
BaseRenderer_Input_CheckMediaType,
NULL,
BasePinImpl_GetMediaTypeVersion,
BasePinImpl_GetMediaType
},
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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);
......
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