Commit 7602829c authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

strmbase: Add GetMediaType and GetMediaTypeVersion to BasePin function table.

Allows for more widespread use of the BasePinImpl version of EnumMediaTypes.
parent 3c2dfd18
...@@ -692,7 +692,9 @@ static HRESULT WINAPI VfwPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocato ...@@ -692,7 +692,9 @@ static HRESULT WINAPI VfwPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocato
static const BasePinFuncTable output_BaseFuncTable = { static const BasePinFuncTable output_BaseFuncTable = {
NULL, NULL,
BaseOutputPinImpl_AttemptConnection BaseOutputPinImpl_AttemptConnection,
VfwPin_GetMediaTypeVersion,
VfwPin_GetMediaType
}; };
static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
...@@ -784,7 +786,7 @@ VfwPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum) ...@@ -784,7 +786,7 @@ VfwPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
VfwPinImpl *This = (VfwPinImpl *)iface; VfwPinImpl *This = (VfwPinImpl *)iface;
hr = qcap_driver_get_format(This->driver_info, &pmt); hr = qcap_driver_get_format(This->driver_info, &pmt);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = EnumMediaTypes_Construct((BasePin*)iface, VfwPin_GetMediaType, VfwPin_GetMediaTypeVersion, ppEnum); hr = BasePinImpl_EnumMediaTypes(iface, ppEnum);
TRACE("%p -- %x\n", This, hr); TRACE("%p -- %x\n", This, hr);
DeleteMediaType(pmt); DeleteMediaType(pmt);
......
...@@ -386,7 +386,9 @@ static const BaseFilterFuncTable BaseFuncTable = { ...@@ -386,7 +386,9 @@ static const BaseFilterFuncTable BaseFuncTable = {
static const BasePinFuncTable input_BaseFuncTable = { static const BasePinFuncTable input_BaseFuncTable = {
DSoundRender_CheckMediaType, DSoundRender_CheckMediaType,
NULL NULL,
BasePinImpl_GetMediaTypeVersion,
BasePinImpl_GetMediaType
}; };
static const BaseInputPinFuncTable input_BaseInputFuncTable = { static const BaseInputPinFuncTable input_BaseInputFuncTable = {
......
...@@ -760,13 +760,6 @@ static ULONG WINAPI FileAsyncReaderPin_Release(IPin * iface) ...@@ -760,13 +760,6 @@ static ULONG WINAPI FileAsyncReaderPin_Release(IPin * iface)
return refCount; return refCount;
} }
static HRESULT WINAPI FileAsyncReaderPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
{
TRACE("(%p)\n", ppEnum);
return EnumMediaTypes_Construct((BasePin*)iface, FileAsyncReaderPin_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum);
}
static const IPinVtbl FileAsyncReaderPin_Vtbl = static const IPinVtbl FileAsyncReaderPin_Vtbl =
{ {
FileAsyncReaderPin_QueryInterface, FileAsyncReaderPin_QueryInterface,
...@@ -781,7 +774,7 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl = ...@@ -781,7 +774,7 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl =
BasePinImpl_QueryDirection, BasePinImpl_QueryDirection,
BasePinImpl_QueryId, BasePinImpl_QueryId,
FileAsyncReaderPin_QueryAccept, FileAsyncReaderPin_QueryAccept,
FileAsyncReaderPin_EnumMediaTypes, BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections, BasePinImpl_QueryInternalConnections,
BaseOutputPinImpl_EndOfStream, BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush, BaseOutputPinImpl_BeginFlush,
...@@ -839,7 +832,9 @@ static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(BaseOutputPin *iface, ...@@ -839,7 +832,9 @@ static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(BaseOutputPin *iface,
static const BasePinFuncTable output_BaseFuncTable = { static const BasePinFuncTable output_BaseFuncTable = {
NULL, NULL,
FileAsyncReaderPin_AttemptConnection FileAsyncReaderPin_AttemptConnection,
BasePinImpl_GetMediaTypeVersion,
FileAsyncReaderPin_GetMediaType
}; };
static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
......
...@@ -108,7 +108,9 @@ static const BaseFilterFuncTable BaseFuncTable = { ...@@ -108,7 +108,9 @@ static const BaseFilterFuncTable BaseFuncTable = {
static const BasePinFuncTable input_BaseFuncTable = { static const BasePinFuncTable input_BaseFuncTable = {
NullRenderer_CheckMediaType, NullRenderer_CheckMediaType,
NULL NULL,
BasePinImpl_GetMediaTypeVersion,
BasePinImpl_GetMediaType
}; };
static const BaseInputPinFuncTable input_BaseInputFuncTable = { static const BaseInputPinFuncTable input_BaseInputFuncTable = {
......
...@@ -44,6 +44,7 @@ static HRESULT WINAPI Parser_ChangeStart(IMediaSeeking *iface); ...@@ -44,6 +44,7 @@ static HRESULT WINAPI Parser_ChangeStart(IMediaSeeking *iface);
static HRESULT WINAPI Parser_ChangeStop(IMediaSeeking *iface); static HRESULT WINAPI Parser_ChangeStop(IMediaSeeking *iface);
static HRESULT WINAPI Parser_ChangeRate(IMediaSeeking *iface); static HRESULT WINAPI Parser_ChangeRate(IMediaSeeking *iface);
static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest); static HRESULT WINAPI Parser_OutputPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
static HRESULT WINAPI Parser_OutputPin_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt);
static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
{ {
...@@ -409,7 +410,9 @@ HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo) ...@@ -409,7 +410,9 @@ HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo)
static const BasePinFuncTable output_BaseFuncTable = { static const BasePinFuncTable output_BaseFuncTable = {
NULL, NULL,
BaseOutputPinImpl_AttemptConnection BaseOutputPinImpl_AttemptConnection,
BasePinImpl_GetMediaTypeVersion,
Parser_OutputPin_GetMediaType
}; };
static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
...@@ -618,15 +621,6 @@ static ULONG WINAPI Parser_OutputPin_Release(IPin * iface) ...@@ -618,15 +621,6 @@ static ULONG WINAPI Parser_OutputPin_Release(IPin * iface)
return refCount; return refCount;
} }
static HRESULT WINAPI Parser_OutputPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
{
TRACE("(%p)\n", ppEnum);
/* override this method to allow enumeration of your types */
return EnumMediaTypes_Construct((BasePin*)iface, Parser_OutputPin_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum);
}
static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
{ {
Parser_OutputPin *This = (Parser_OutputPin *)iface; Parser_OutputPin *This = (Parser_OutputPin *)iface;
...@@ -664,7 +658,7 @@ static const IPinVtbl Parser_OutputPin_Vtbl = ...@@ -664,7 +658,7 @@ static const IPinVtbl Parser_OutputPin_Vtbl =
BasePinImpl_QueryDirection, BasePinImpl_QueryDirection,
BasePinImpl_QueryId, BasePinImpl_QueryId,
Parser_OutputPin_QueryAccept, Parser_OutputPin_QueryAccept,
Parser_OutputPin_EnumMediaTypes, BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections, BasePinImpl_QueryInternalConnections,
BaseOutputPinImpl_EndOfStream, BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush, BaseOutputPinImpl_BeginFlush,
......
...@@ -556,7 +556,9 @@ static const BaseFilterFuncTable BaseFuncTable = { ...@@ -556,7 +556,9 @@ static const BaseFilterFuncTable BaseFuncTable = {
static const BasePinFuncTable input_BaseFuncTable = { static const BasePinFuncTable input_BaseFuncTable = {
VideoRenderer_CheckMediaType, VideoRenderer_CheckMediaType,
NULL NULL,
BasePinImpl_GetMediaTypeVersion,
BasePinImpl_GetMediaType
}; };
static const BaseInputPinFuncTable input_BaseInputFuncTable = { static const BaseInputPinFuncTable input_BaseInputFuncTable = {
......
...@@ -320,7 +320,7 @@ HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnu ...@@ -320,7 +320,7 @@ HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnu
/* override this method to allow enumeration of your types */ /* override this method to allow enumeration of your types */
return EnumMediaTypes_Construct(This, BasePinImpl_GetMediaType, BasePinImpl_GetMediaTypeVersion , ppEnum); return EnumMediaTypes_Construct(This, This->pFuncsTable->pfnGetMediaType, This->pFuncsTable->pfnGetMediaTypeVersion , ppEnum);
} }
HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin) HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin)
......
...@@ -108,6 +108,18 @@ static HRESULT WINAPI TransformFilter_Output_DecideBufferSize(BaseOutputPin *Thi ...@@ -108,6 +108,18 @@ static HRESULT WINAPI TransformFilter_Output_DecideBufferSize(BaseOutputPin *Thi
return pTransformFilter->pFuncsTable->pfnDecideBufferSize(pTransformFilter, pAlloc, ppropInputRequest); return pTransformFilter->pFuncsTable->pfnDecideBufferSize(pTransformFilter, pAlloc, ppropInputRequest);
} }
static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPosition, AM_MEDIA_TYPE *pmt)
{
TransformFilter *pTransform = (TransformFilter *)This->pinInfo.pFilter;
if (iPosition < 0)
return E_INVALIDARG;
if (iPosition > 0)
return VFW_S_NO_MORE_ITEMS;
CopyMediaType(pmt, &pTransform->pmt);
return S_OK;
}
static IPin* WINAPI TransformFilter_GetPin(BaseFilter *iface, int pos) static IPin* WINAPI TransformFilter_GetPin(BaseFilter *iface, int pos)
{ {
TransformFilter *This = (TransformFilter *)iface; TransformFilter *This = (TransformFilter *)iface;
...@@ -134,6 +146,8 @@ static const BaseFilterFuncTable tfBaseFuncTable = { ...@@ -134,6 +146,8 @@ static const BaseFilterFuncTable tfBaseFuncTable = {
static const BasePinFuncTable tf_input_BaseFuncTable = { static const BasePinFuncTable tf_input_BaseFuncTable = {
TransformFilter_Input_CheckMediaType, TransformFilter_Input_CheckMediaType,
NULL, NULL,
BasePinImpl_GetMediaTypeVersion,
BasePinImpl_GetMediaType
}; };
static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = {
...@@ -143,6 +157,8 @@ static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { ...@@ -143,6 +157,8 @@ static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = {
static const BasePinFuncTable tf_output_BaseFuncTable = { static const BasePinFuncTable tf_output_BaseFuncTable = {
NULL, NULL,
BaseOutputPinImpl_AttemptConnection, BaseOutputPinImpl_AttemptConnection,
BasePinImpl_GetMediaTypeVersion,
TransformFilter_Output_GetMediaType
}; };
static const BaseOutputPinFuncTable tf_output_BaseOutputFuncTable = { static const BaseOutputPinFuncTable tf_output_BaseOutputFuncTable = {
...@@ -508,26 +524,6 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl = ...@@ -508,26 +524,6 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
TransformFilter_InputPin_NewSegment TransformFilter_InputPin_NewSegment
}; };
static HRESULT WINAPI TransformFilter_Output_GetMediaType(BasePin *This, int iPosition, AM_MEDIA_TYPE *pmt)
{
TransformFilter *pTransform = (TransformFilter *)This->pinInfo.pFilter;
if (iPosition < 0)
return E_INVALIDARG;
if (iPosition > 0)
return VFW_S_NO_MORE_ITEMS;
CopyMediaType(pmt, &pTransform->pmt);
return S_OK;
}
static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
{
BasePin *This = (BasePin *)iface;
TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum);
return EnumMediaTypes_Construct(This, TransformFilter_Output_GetMediaType, BasePinImpl_GetMediaTypeVersion, ppEnum);
}
static const IPinVtbl TransformFilter_OutputPin_Vtbl = static const IPinVtbl TransformFilter_OutputPin_Vtbl =
{ {
BaseOutputPinImpl_QueryInterface, BaseOutputPinImpl_QueryInterface,
...@@ -542,7 +538,7 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl = ...@@ -542,7 +538,7 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl =
BasePinImpl_QueryDirection, BasePinImpl_QueryDirection,
BasePinImpl_QueryId, BasePinImpl_QueryId,
TransformFilter_Output_QueryAccept, TransformFilter_Output_QueryAccept,
TransformFilter_Output_EnumMediaTypes, BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections, BasePinImpl_QueryInternalConnections,
BaseOutputPinImpl_EndOfStream, BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush, BaseOutputPinImpl_BeginFlush,
......
...@@ -48,6 +48,9 @@ typedef struct BasePinFuncTable { ...@@ -48,6 +48,9 @@ typedef struct BasePinFuncTable {
BasePin_CheckMediaType pfnCheckMediaType; BasePin_CheckMediaType pfnCheckMediaType;
/* Required for Output Pins*/ /* Required for Output Pins*/
BasePin_AttemptConnection pfnAttemptConnection; BasePin_AttemptConnection pfnAttemptConnection;
/* Required for BasePinImpl_EnumMediaTypes */
BasePin_GetMediaTypeVersion pfnGetMediaTypeVersion;
BasePin_GetMediaType pfnGetMediaType;
} BasePinFuncTable; } BasePinFuncTable;
typedef struct BaseOutputPin typedef struct BaseOutputPin
......
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