From 7602829c4f5d255c1ecd7ecef386b4b2011e6137 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Wed, 13 Oct 2010 11:02:08 -0500 Subject: [PATCH] strmbase: Add GetMediaType and GetMediaTypeVersion to BasePin function table. Allows for more widespread use of the BasePinImpl version of EnumMediaTypes. --- dlls/qcap/vfwcapture.c | 6 ++++-- dlls/quartz/dsoundrender.c | 4 +++- dlls/quartz/filesource.c | 13 ++++--------- dlls/quartz/nullrenderer.c | 4 +++- dlls/quartz/parser.c | 16 +++++----------- dlls/quartz/videorenderer.c | 4 +++- dlls/strmbase/pin.c | 2 +- dlls/strmbase/transform.c | 38 +++++++++++++++++-------------------- include/wine/strmbase.h | 3 +++ 9 files changed, 43 insertions(+), 47 deletions(-) diff --git a/dlls/qcap/vfwcapture.c b/dlls/qcap/vfwcapture.c index 87dab5d7c8..a0d7ad73bb 100644 --- a/dlls/qcap/vfwcapture.c +++ b/dlls/qcap/vfwcapture.c @@ -692,7 +692,9 @@ static HRESULT WINAPI VfwPin_DecideBufferSize(BaseOutputPin *iface, IMemAllocato static const BasePinFuncTable output_BaseFuncTable = { NULL, - BaseOutputPinImpl_AttemptConnection + BaseOutputPinImpl_AttemptConnection, + VfwPin_GetMediaTypeVersion, + VfwPin_GetMediaType }; static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { @@ -784,7 +786,7 @@ VfwPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum) VfwPinImpl *This = (VfwPinImpl *)iface; hr = qcap_driver_get_format(This->driver_info, &pmt); if (SUCCEEDED(hr)) - hr = EnumMediaTypes_Construct((BasePin*)iface, VfwPin_GetMediaType, VfwPin_GetMediaTypeVersion, ppEnum); + hr = BasePinImpl_EnumMediaTypes(iface, ppEnum); TRACE("%p -- %x\n", This, hr); DeleteMediaType(pmt); diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index b28743ddd3..a51da6cb1f 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -386,7 +386,9 @@ static const BaseFilterFuncTable BaseFuncTable = { static const BasePinFuncTable input_BaseFuncTable = { DSoundRender_CheckMediaType, - NULL + NULL, + BasePinImpl_GetMediaTypeVersion, + BasePinImpl_GetMediaType }; static const BaseInputPinFuncTable input_BaseInputFuncTable = { diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c index 613e1d4c83..a985d9bb54 100644 --- a/dlls/quartz/filesource.c +++ b/dlls/quartz/filesource.c @@ -760,13 +760,6 @@ static ULONG WINAPI FileAsyncReaderPin_Release(IPin * iface) 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 = { FileAsyncReaderPin_QueryInterface, @@ -781,7 +774,7 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl = BasePinImpl_QueryDirection, BasePinImpl_QueryId, FileAsyncReaderPin_QueryAccept, - FileAsyncReaderPin_EnumMediaTypes, + BasePinImpl_EnumMediaTypes, BasePinImpl_QueryInternalConnections, BaseOutputPinImpl_EndOfStream, BaseOutputPinImpl_BeginFlush, @@ -839,7 +832,9 @@ static HRESULT WINAPI FileAsyncReaderPin_DecideBufferSize(BaseOutputPin *iface, static const BasePinFuncTable output_BaseFuncTable = { NULL, - FileAsyncReaderPin_AttemptConnection + FileAsyncReaderPin_AttemptConnection, + BasePinImpl_GetMediaTypeVersion, + FileAsyncReaderPin_GetMediaType }; static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { diff --git a/dlls/quartz/nullrenderer.c b/dlls/quartz/nullrenderer.c index f1389b46bd..1764e2380f 100644 --- a/dlls/quartz/nullrenderer.c +++ b/dlls/quartz/nullrenderer.c @@ -108,7 +108,9 @@ static const BaseFilterFuncTable BaseFuncTable = { static const BasePinFuncTable input_BaseFuncTable = { NullRenderer_CheckMediaType, - NULL + NULL, + BasePinImpl_GetMediaTypeVersion, + BasePinImpl_GetMediaType }; static const BaseInputPinFuncTable input_BaseInputFuncTable = { diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c index e73e5e2a99..e5e12aceb4 100644 --- a/dlls/quartz/parser.c +++ b/dlls/quartz/parser.c @@ -44,6 +44,7 @@ static HRESULT WINAPI Parser_ChangeStart(IMediaSeeking *iface); static HRESULT WINAPI Parser_ChangeStop(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_GetMediaType(BasePin *iface, int iPosition, AM_MEDIA_TYPE *pmt); static inline ParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) { @@ -409,7 +410,9 @@ HRESULT WINAPI Parser_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo) static const BasePinFuncTable output_BaseFuncTable = { NULL, - BaseOutputPinImpl_AttemptConnection + BaseOutputPinImpl_AttemptConnection, + BasePinImpl_GetMediaTypeVersion, + Parser_OutputPin_GetMediaType }; static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { @@ -618,15 +621,6 @@ static ULONG WINAPI Parser_OutputPin_Release(IPin * iface) 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) { Parser_OutputPin *This = (Parser_OutputPin *)iface; @@ -664,7 +658,7 @@ static const IPinVtbl Parser_OutputPin_Vtbl = BasePinImpl_QueryDirection, BasePinImpl_QueryId, Parser_OutputPin_QueryAccept, - Parser_OutputPin_EnumMediaTypes, + BasePinImpl_EnumMediaTypes, BasePinImpl_QueryInternalConnections, BaseOutputPinImpl_EndOfStream, BaseOutputPinImpl_BeginFlush, diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 159e2eeac5..b309b1cef8 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -556,7 +556,9 @@ static const BaseFilterFuncTable BaseFuncTable = { static const BasePinFuncTable input_BaseFuncTable = { VideoRenderer_CheckMediaType, - NULL + NULL, + BasePinImpl_GetMediaTypeVersion, + BasePinImpl_GetMediaType }; static const BaseInputPinFuncTable input_BaseInputFuncTable = { diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index c996c4478b..96def2c3cf 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -320,7 +320,7 @@ HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnu /* 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) diff --git a/dlls/strmbase/transform.c b/dlls/strmbase/transform.c index f3bc4593ae..fce543d89d 100644 --- a/dlls/strmbase/transform.c +++ b/dlls/strmbase/transform.c @@ -108,6 +108,18 @@ static HRESULT WINAPI TransformFilter_Output_DecideBufferSize(BaseOutputPin *Thi 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) { TransformFilter *This = (TransformFilter *)iface; @@ -134,6 +146,8 @@ static const BaseFilterFuncTable tfBaseFuncTable = { static const BasePinFuncTable tf_input_BaseFuncTable = { TransformFilter_Input_CheckMediaType, NULL, + BasePinImpl_GetMediaTypeVersion, + BasePinImpl_GetMediaType }; static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { @@ -143,6 +157,8 @@ static const BaseInputPinFuncTable tf_input_BaseInputFuncTable = { static const BasePinFuncTable tf_output_BaseFuncTable = { NULL, BaseOutputPinImpl_AttemptConnection, + BasePinImpl_GetMediaTypeVersion, + TransformFilter_Output_GetMediaType }; static const BaseOutputPinFuncTable tf_output_BaseOutputFuncTable = { @@ -508,26 +524,6 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl = 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 = { BaseOutputPinImpl_QueryInterface, @@ -542,7 +538,7 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl = BasePinImpl_QueryDirection, BasePinImpl_QueryId, TransformFilter_Output_QueryAccept, - TransformFilter_Output_EnumMediaTypes, + BasePinImpl_EnumMediaTypes, BasePinImpl_QueryInternalConnections, BaseOutputPinImpl_EndOfStream, BaseOutputPinImpl_BeginFlush, diff --git a/include/wine/strmbase.h b/include/wine/strmbase.h index f1614ef8fe..3ca7d79ae4 100644 --- a/include/wine/strmbase.h +++ b/include/wine/strmbase.h @@ -48,6 +48,9 @@ typedef struct BasePinFuncTable { BasePin_CheckMediaType pfnCheckMediaType; /* Required for Output Pins*/ BasePin_AttemptConnection pfnAttemptConnection; + /* Required for BasePinImpl_EnumMediaTypes */ + BasePin_GetMediaTypeVersion pfnGetMediaTypeVersion; + BasePin_GetMediaType pfnGetMediaType; } BasePinFuncTable; typedef struct BaseOutputPin -- 2.32.0.93.g670b81a890