strmbase: Move TransformFilter implementation to strmbase.
This commit is contained in:
parent
791087089c
commit
34f3f7cae3
|
@ -24,7 +24,6 @@ C_SRCS = \
|
|||
pin.c \
|
||||
regsvr.c \
|
||||
systemclock.c \
|
||||
transform.c \
|
||||
videorenderer.c \
|
||||
waveparser.c
|
||||
|
||||
|
|
|
@ -37,13 +37,13 @@
|
|||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "transform.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
||||
|
||||
typedef struct ACMWrapperImpl
|
||||
{
|
||||
TransformFilterImpl tf;
|
||||
TransformFilter tf;
|
||||
IUnknown *seekthru_unk;
|
||||
|
||||
HACMSTREAM has;
|
||||
LPWAVEFORMATEX pWfIn;
|
||||
LPWAVEFORMATEX pWfOut;
|
||||
|
@ -52,10 +52,11 @@ typedef struct ACMWrapperImpl
|
|||
LONGLONG lasttime_sent;
|
||||
} ACMWrapperImpl;
|
||||
|
||||
static HRESULT WINAPI ACMWrapper_ProcessSampleData(IPin *iface, IMediaSample *pSample)
|
||||
static const IBaseFilterVtbl ACMWrapper_Vtbl;
|
||||
|
||||
static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSample)
|
||||
{
|
||||
BaseInputPin *pin = (BaseInputPin*) iface;
|
||||
ACMWrapperImpl* This = (ACMWrapperImpl*)pin->pin.pinInfo.pFilter;
|
||||
ACMWrapperImpl* This = (ACMWrapperImpl*)tf;
|
||||
AM_MEDIA_TYPE amt;
|
||||
IMediaSample* pOutSample = NULL;
|
||||
DWORD cbDstStream, cbSrcStream;
|
||||
|
@ -68,18 +69,6 @@ static HRESULT WINAPI ACMWrapper_ProcessSampleData(IPin *iface, IMediaSample *pS
|
|||
LONGLONG tStart = -1, tStop = -1, tMed;
|
||||
|
||||
EnterCriticalSection(&This->tf.filter.csFilter);
|
||||
if (This->tf.filter.state == State_Stopped)
|
||||
{
|
||||
LeaveCriticalSection(&This->tf.filter.csFilter);
|
||||
return VFW_E_WRONG_STATE;
|
||||
}
|
||||
|
||||
if (pin->end_of_stream || pin->flushing)
|
||||
{
|
||||
LeaveCriticalSection(&This->tf.filter.csFilter);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -235,12 +224,15 @@ error:
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT ACMWrapper_ConnectInput(BaseInputPin *pin, const AM_MEDIA_TYPE * pmt)
|
||||
static HRESULT WINAPI ACMWrapper_SetMediaType(TransformFilter *tf, PIN_DIRECTION dir, const AM_MEDIA_TYPE * pmt)
|
||||
{
|
||||
ACMWrapperImpl* This = (ACMWrapperImpl *)pin->pin.pinInfo.pFilter;
|
||||
ACMWrapperImpl* This = (ACMWrapperImpl *)tf;
|
||||
MMRESULT res;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pmt);
|
||||
TRACE("(%p)->(%i %p)\n", This, dir, pmt);
|
||||
|
||||
if (dir != PINDIR_INPUT)
|
||||
return S_OK;
|
||||
|
||||
/* Check root (GUID w/o FOURCC) */
|
||||
if ((IsEqualIID(&pmt->majortype, &MEDIATYPE_Audio)) &&
|
||||
|
@ -287,28 +279,62 @@ static HRESULT ACMWrapper_ConnectInput(BaseInputPin *pin, const AM_MEDIA_TYPE *
|
|||
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||
}
|
||||
|
||||
static HRESULT ACMWrapper_Cleanup(BaseInputPin *pin)
|
||||
static HRESULT WINAPI ACMWrapper_CompleteConnect(TransformFilter *tf, PIN_DIRECTION dir, IPin *pin)
|
||||
{
|
||||
ACMWrapperImpl *This = (ACMWrapperImpl *)pin->pin.pinInfo.pFilter;
|
||||
ACMWrapperImpl* This = (ACMWrapperImpl *)tf;
|
||||
MMRESULT res;
|
||||
HACMSTREAM drv;
|
||||
|
||||
TRACE("(%p)->()\n", This);
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if (dir != PINDIR_INPUT)
|
||||
return S_OK;
|
||||
|
||||
if (!(res = acmStreamOpen(&drv, NULL, This->pWfIn, This->pWfOut, NULL, 0, 0, 0)))
|
||||
{
|
||||
This->has = drv;
|
||||
|
||||
/* Update buffer size of media samples in output */
|
||||
((BaseOutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pWfOut->nAvgBytesPerSec / 2;
|
||||
TRACE("Connection accepted\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("acmStreamOpen returned %d\n", res);
|
||||
TRACE("Unable to find a suitable ACM decompressor\n");
|
||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ACMWrapper_BreakConnect(TransformFilter *tf, PIN_DIRECTION dir)
|
||||
{
|
||||
ACMWrapperImpl *This = (ACMWrapperImpl *)tf;
|
||||
|
||||
TRACE("(%p)->(%i)\n", This,dir);
|
||||
|
||||
if (dir == PINDIR_INPUT)
|
||||
{
|
||||
if (This->has)
|
||||
acmStreamClose(This->has, 0);
|
||||
|
||||
This->has = 0;
|
||||
This->lasttime_real = This->lasttime_sent = -1;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const TransformFuncsTable ACMWrapper_FuncsTable = {
|
||||
static const TransformFilterFuncTable ACMWrapper_FuncsTable = {
|
||||
NULL,
|
||||
ACMWrapper_ProcessSampleData,
|
||||
ACMWrapper_Receive,
|
||||
NULL,
|
||||
NULL,
|
||||
ACMWrapper_ConnectInput,
|
||||
ACMWrapper_Cleanup
|
||||
ACMWrapper_SetMediaType,
|
||||
ACMWrapper_CompleteConnect,
|
||||
ACMWrapper_BreakConnect,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||
|
@ -323,17 +349,55 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|||
if (pUnkOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
/* Note: This memory is managed by the transform filter once created */
|
||||
This = CoTaskMemAlloc(sizeof(ACMWrapperImpl));
|
||||
ZeroMemory(This, sizeof(ACMWrapperImpl));
|
||||
|
||||
hr = TransformFilter_Create(&(This->tf), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable);
|
||||
hr = TransformFilter_Construct(&ACMWrapper_Vtbl, sizeof(ACMWrapperImpl), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable, (IBaseFilter**)&This);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
else
|
||||
{
|
||||
ISeekingPassThru *passthru;
|
||||
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)This, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&This->seekthru_unk);
|
||||
IUnknown_QueryInterface(This->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
|
||||
ISeekingPassThru_Init(passthru, FALSE, (IPin*)This->tf.ppPins[0]);
|
||||
ISeekingPassThru_Release(passthru);
|
||||
}
|
||||
|
||||
*ppv = This;
|
||||
This->lasttime_real = This->lasttime_sent = -1;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI ACMWrapper_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
ACMWrapperImpl *This = (ACMWrapperImpl *)iface;
|
||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
||||
|
||||
if (IsEqualIID(riid, &IID_IMediaSeeking))
|
||||
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
||||
|
||||
hr = TransformFilterImpl_QueryInterface(iface, riid, ppv);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
static const IBaseFilterVtbl ACMWrapper_Vtbl =
|
||||
{
|
||||
ACMWrapper_QueryInterface,
|
||||
BaseFilterImpl_AddRef,
|
||||
TransformFilterImpl_Release,
|
||||
BaseFilterImpl_GetClassID,
|
||||
TransformFilterImpl_Stop,
|
||||
TransformFilterImpl_Pause,
|
||||
TransformFilterImpl_Run,
|
||||
BaseFilterImpl_GetState,
|
||||
BaseFilterImpl_SetSyncSource,
|
||||
BaseFilterImpl_GetSyncSource,
|
||||
BaseFilterImpl_EnumPins,
|
||||
TransformFilterImpl_FindPin,
|
||||
BaseFilterImpl_QueryFilterInfo,
|
||||
BaseFilterImpl_JoinFilterGraph,
|
||||
BaseFilterImpl_QueryVendorInfo
|
||||
};
|
||||
|
|
|
@ -38,19 +38,21 @@
|
|||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "transform.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
||||
|
||||
typedef struct AVIDecImpl
|
||||
{
|
||||
TransformFilterImpl tf;
|
||||
TransformFilter tf;
|
||||
IUnknown *seekthru_unk;
|
||||
|
||||
HIC hvid;
|
||||
BITMAPINFOHEADER* pBihIn;
|
||||
BITMAPINFOHEADER* pBihOut;
|
||||
} AVIDecImpl;
|
||||
|
||||
static HRESULT AVIDec_ProcessBegin(TransformFilterImpl* pTransformFilter)
|
||||
static const IBaseFilterVtbl AVIDec_Vtbl;
|
||||
|
||||
static HRESULT WINAPI AVIDec_StartStreaming(TransformFilter* pTransformFilter)
|
||||
{
|
||||
AVIDecImpl* This = (AVIDecImpl*)pTransformFilter;
|
||||
DWORD result;
|
||||
|
@ -66,10 +68,9 @@ static HRESULT AVIDec_ProcessBegin(TransformFilterImpl* pTransformFilter)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AVIDec_ProcessSampleData(IPin *iface, IMediaSample *pSample)
|
||||
static HRESULT WINAPI AVIDec_Receive(TransformFilter *tf, IMediaSample *pSample)
|
||||
{
|
||||
BaseInputPin *pin = (BaseInputPin*)iface;
|
||||
AVIDecImpl* This = (AVIDecImpl *)pin->pin.pinInfo.pFilter;
|
||||
AVIDecImpl* This = (AVIDecImpl *)tf;
|
||||
AM_MEDIA_TYPE amt;
|
||||
HRESULT hr;
|
||||
DWORD res;
|
||||
|
@ -81,18 +82,6 @@ static HRESULT WINAPI AVIDec_ProcessSampleData(IPin *iface, IMediaSample *pSampl
|
|||
LONGLONG tStart, tStop;
|
||||
|
||||
EnterCriticalSection(&This->tf.filter.csFilter);
|
||||
if (This->tf.filter.state == State_Stopped)
|
||||
{
|
||||
LeaveCriticalSection(&This->tf.filter.csFilter);
|
||||
return VFW_E_WRONG_STATE;
|
||||
}
|
||||
|
||||
if (pin->end_of_stream || pin->flushing)
|
||||
{
|
||||
LeaveCriticalSection(&This->tf.filter.csFilter);
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -164,7 +153,7 @@ error:
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT AVIDec_ProcessEnd(TransformFilterImpl* pTransformFilter)
|
||||
static HRESULT WINAPI AVIDec_StopStreaming(TransformFilter* pTransformFilter)
|
||||
{
|
||||
AVIDecImpl* This = (AVIDecImpl*)pTransformFilter;
|
||||
DWORD result;
|
||||
|
@ -183,13 +172,16 @@ static HRESULT AVIDec_ProcessEnd(TransformFilterImpl* pTransformFilter)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT AVIDec_ConnectInput(BaseInputPin *pin, const AM_MEDIA_TYPE * pmt)
|
||||
static HRESULT WINAPI AVIDec_SetMediaType(TransformFilter *tf, PIN_DIRECTION dir, const AM_MEDIA_TYPE * pmt)
|
||||
{
|
||||
AVIDecImpl* This = (AVIDecImpl*)pin->pin.pinInfo.pFilter;
|
||||
AVIDecImpl* This = (AVIDecImpl*)tf;
|
||||
HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pmt);
|
||||
|
||||
if (dir != PINDIR_INPUT)
|
||||
return S_OK;
|
||||
|
||||
/* Check root (GUID w/o FOURCC) */
|
||||
if ((IsEqualIID(&pmt->majortype, &MEDIATYPE_Video)) &&
|
||||
(!memcmp(((const char *)&pmt->subtype)+4, ((const char *)&MEDIATYPE_Video)+4, sizeof(GUID)-4)))
|
||||
|
@ -269,9 +261,6 @@ static HRESULT AVIDec_ConnectInput(BaseInputPin *pin, const AM_MEDIA_TYPE * pmt)
|
|||
else
|
||||
assert(0);
|
||||
|
||||
/* Update buffer size of media samples in output */
|
||||
((BaseOutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pBihOut->biSizeImage;
|
||||
|
||||
TRACE("Connection accepted\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -284,12 +273,28 @@ failed:
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT AVIDec_Cleanup(BaseInputPin *pin)
|
||||
static HRESULT WINAPI AVIDec_CompleteConnect(TransformFilter *tf, PIN_DIRECTION dir, IPin *pin)
|
||||
{
|
||||
AVIDecImpl *This = (AVIDecImpl *)pin->pin.pinInfo.pFilter;
|
||||
AVIDecImpl* This = (AVIDecImpl*)tf;
|
||||
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if (dir == PINDIR_INPUT)
|
||||
{
|
||||
/* Update buffer size of media samples in output */
|
||||
((BaseOutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pBihOut->biSizeImage;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AVIDec_BreakConnect(TransformFilter *tf, PIN_DIRECTION dir)
|
||||
{
|
||||
AVIDecImpl *This = (AVIDecImpl *)tf;
|
||||
|
||||
TRACE("(%p)->()\n", This);
|
||||
|
||||
if (dir == PINDIR_INPUT)
|
||||
{
|
||||
if (This->hvid)
|
||||
ICClose(This->hvid);
|
||||
if (This->pBihIn)
|
||||
|
@ -300,17 +305,23 @@ static HRESULT AVIDec_Cleanup(BaseInputPin *pin)
|
|||
This->hvid = NULL;
|
||||
This->pBihIn = NULL;
|
||||
This->pBihOut = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const TransformFuncsTable AVIDec_FuncsTable = {
|
||||
AVIDec_ProcessBegin,
|
||||
AVIDec_ProcessSampleData,
|
||||
AVIDec_ProcessEnd,
|
||||
static const TransformFilterFuncTable AVIDec_FuncsTable = {
|
||||
AVIDec_StartStreaming,
|
||||
AVIDec_Receive,
|
||||
AVIDec_StopStreaming,
|
||||
NULL,
|
||||
AVIDec_ConnectInput,
|
||||
AVIDec_Cleanup
|
||||
AVIDec_SetMediaType,
|
||||
AVIDec_CompleteConnect,
|
||||
AVIDec_BreakConnect,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||
|
@ -325,19 +336,57 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|||
if (pUnkOuter)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
/* Note: This memory is managed by the transform filter once created */
|
||||
This = CoTaskMemAlloc(sizeof(AVIDecImpl));
|
||||
hr = TransformFilter_Construct(&AVIDec_Vtbl, sizeof(AVIDecImpl), &CLSID_AVIDec, &AVIDec_FuncsTable, (IBaseFilter**)&This);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
else
|
||||
{
|
||||
ISeekingPassThru *passthru;
|
||||
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)This, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&This->seekthru_unk);
|
||||
IUnknown_QueryInterface(This->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
|
||||
ISeekingPassThru_Init(passthru, FALSE, (IPin*)This->tf.ppPins[0]);
|
||||
ISeekingPassThru_Release(passthru);
|
||||
}
|
||||
|
||||
This->hvid = NULL;
|
||||
This->pBihIn = NULL;
|
||||
This->pBihOut = NULL;
|
||||
|
||||
hr = TransformFilter_Create(&(This->tf), &CLSID_AVIDec, &AVIDec_FuncsTable);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
*ppv = This;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI AVIDec_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
||||
{
|
||||
HRESULT hr;
|
||||
AVIDecImpl *This = (AVIDecImpl *)iface;
|
||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
||||
|
||||
if (IsEqualIID(riid, &IID_IMediaSeeking))
|
||||
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
||||
|
||||
hr = TransformFilterImpl_QueryInterface(iface, riid, ppv);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static const IBaseFilterVtbl AVIDec_Vtbl =
|
||||
{
|
||||
AVIDec_QueryInterface,
|
||||
BaseFilterImpl_AddRef,
|
||||
TransformFilterImpl_Release,
|
||||
BaseFilterImpl_GetClassID,
|
||||
TransformFilterImpl_Stop,
|
||||
TransformFilterImpl_Pause,
|
||||
TransformFilterImpl_Run,
|
||||
BaseFilterImpl_GetState,
|
||||
BaseFilterImpl_SetSyncSource,
|
||||
BaseFilterImpl_GetSyncSource,
|
||||
BaseFilterImpl_EnumPins,
|
||||
TransformFilterImpl_FindPin,
|
||||
BaseFilterImpl_QueryFilterInfo,
|
||||
BaseFilterImpl_JoinFilterGraph,
|
||||
BaseFilterImpl_QueryVendorInfo
|
||||
};
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Transform Filter declarations
|
||||
*
|
||||
* Copyright 2005 Christian Costa
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "control_private.h"
|
||||
|
||||
typedef struct TransformFilterImpl TransformFilterImpl;
|
||||
|
||||
typedef struct TransformFuncsTable {
|
||||
HRESULT (*pfnProcessBegin) (TransformFilterImpl *This);
|
||||
BaseInputPin_Receive pfnProcessSampleData;
|
||||
HRESULT (*pfnProcessEnd) (TransformFilterImpl *This);
|
||||
HRESULT (*pfnQueryConnect) (TransformFilterImpl *This, const AM_MEDIA_TYPE * pmt);
|
||||
HRESULT (*pfnConnectInput) (BaseInputPin *pin, const AM_MEDIA_TYPE * pmt);
|
||||
HRESULT (*pfnCleanup) (BaseInputPin *pin);
|
||||
HRESULT (*pfnEndOfStream) (BaseInputPin *pin);
|
||||
HRESULT (*pfnBeginFlush) (BaseInputPin *pin);
|
||||
HRESULT (*pfnEndFlush) (BaseInputPin *pin);
|
||||
HRESULT (*pfnNewSegment) (BaseInputPin *pin, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
|
||||
} TransformFuncsTable;
|
||||
|
||||
struct TransformFilterImpl
|
||||
{
|
||||
BaseFilter filter;
|
||||
IUnknown *seekthru_unk;
|
||||
|
||||
IPin **ppPins;
|
||||
ULONG npins;
|
||||
AM_MEDIA_TYPE pmt;
|
||||
|
||||
const TransformFuncsTable * pFuncsTable;
|
||||
};
|
||||
|
||||
HRESULT TransformFilter_Create(TransformFilterImpl*, const CLSID*, const TransformFuncsTable* pFuncsTable);
|
|
@ -4,6 +4,7 @@ C_SRCS = \
|
|||
enumpins.c \
|
||||
filter.c \
|
||||
mediatype.c \
|
||||
pin.c
|
||||
pin.c \
|
||||
transform.c
|
||||
|
||||
@MAKE_IMPLIB_RULES@
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Transform Filter (Base for decoders, etc...)
|
||||
*
|
||||
* Copyright 2005 Christian Costa
|
||||
* Copyright 2010 Aric Stewart, CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -17,17 +18,15 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "quartz_private.h"
|
||||
#include "control_private.h"
|
||||
#include "pin.h"
|
||||
#define COBJMACROS
|
||||
|
||||
#include "amvideo.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "dshow.h"
|
||||
#include "amvideo.h"
|
||||
#include "strmif.h"
|
||||
#include "vfw.h"
|
||||
|
||||
|
@ -35,10 +34,9 @@
|
|||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/strmbase.h"
|
||||
|
||||
#include "transform.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
|
||||
|
||||
static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
|
||||
static const WCHAR wcsOutputPinName[] = {'o','u','t','p','u','t',' ','p','i','n',0};
|
||||
|
@ -49,22 +47,53 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl;
|
|||
|
||||
static HRESULT WINAPI TransformFilter_Input_CheckMediaType(IPin *iface, const AM_MEDIA_TYPE * pmt)
|
||||
{
|
||||
TransformFilterImpl* This = (TransformFilterImpl *)((BasePin *)iface)->pinInfo.pFilter;
|
||||
TRACE("%p\n", iface);
|
||||
dump_AM_MEDIA_TYPE(pmt);
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilter * pTransform;
|
||||
|
||||
if (This->pFuncsTable->pfnQueryConnect)
|
||||
return This->pFuncsTable->pfnQueryConnect(This, pmt);
|
||||
TRACE("%p\n", iface);
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
|
||||
if (pTransform->pFuncsTable->pfnCheckInputType)
|
||||
return pTransform->pFuncsTable->pfnCheckInputType(pTransform, pmt);
|
||||
/* Assume OK if there's no query method (the connection will fail if
|
||||
needed) */
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TransformFilter_Input_Receive(IPin *iface, IMediaSample *pInSample)
|
||||
{
|
||||
HRESULT hr = S_FALSE;
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilter * pTransform;
|
||||
TRACE("%p\n", iface);
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
|
||||
EnterCriticalSection(&pTransform->filter.csFilter);
|
||||
if (pTransform->filter.state == State_Stopped)
|
||||
{
|
||||
LeaveCriticalSection(&pTransform->filter.csFilter);
|
||||
return VFW_E_WRONG_STATE;
|
||||
}
|
||||
|
||||
if (This->end_of_stream || This->flushing)
|
||||
{
|
||||
LeaveCriticalSection(&pTransform->filter.csFilter);
|
||||
return S_FALSE;
|
||||
}
|
||||
LeaveCriticalSection(&pTransform->filter.csFilter);
|
||||
|
||||
if (pTransform->pFuncsTable->pfnReceive)
|
||||
hr = pTransform->pFuncsTable->pfnReceive(pTransform, pInSample);
|
||||
else
|
||||
hr = S_FALSE;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TransformFilter_Output_QueryAccept(IPin *iface, const AM_MEDIA_TYPE * pmt)
|
||||
{
|
||||
BasePin *This = (BasePin *)iface;
|
||||
TransformFilterImpl *pTransformFilter = (TransformFilterImpl *)This->pinInfo.pFilter;
|
||||
TransformFilter *pTransformFilter = (TransformFilter *)This->pinInfo.pFilter;
|
||||
AM_MEDIA_TYPE* outpmt = &pTransformFilter->pmt;
|
||||
TRACE("%p\n", iface);
|
||||
|
||||
|
@ -76,7 +105,7 @@ static HRESULT WINAPI TransformFilter_Output_QueryAccept(IPin *iface, const AM_M
|
|||
|
||||
static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos)
|
||||
{
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
|
||||
if (pos >= This->npins || pos < 0)
|
||||
return NULL;
|
||||
|
@ -87,18 +116,18 @@ static IPin* WINAPI TransformFilter_GetPin(IBaseFilter *iface, int pos)
|
|||
|
||||
static LONG WINAPI TransformFilter_GetPinCount(IBaseFilter *iface)
|
||||
{
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
|
||||
return (This->npins+1);
|
||||
}
|
||||
|
||||
HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSID* pClsid, const TransformFuncsTable* pFuncsTable)
|
||||
static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* pClsid, const TransformFilterFuncTable* pFuncsTable, TransformFilter* pTransformFilter)
|
||||
{
|
||||
HRESULT hr;
|
||||
PIN_INFO piInput;
|
||||
PIN_INFO piOutput;
|
||||
|
||||
BaseFilter_Init(&pTransformFilter->filter, &TransformFilter_Vtbl, pClsid, (DWORD_PTR)(__FILE__ ": TransformFilterImpl.csFilter"), TransformFilter_GetPin, TransformFilter_GetPinCount);
|
||||
BaseFilter_Init(&pTransformFilter->filter, pVtbl, pClsid, (DWORD_PTR)(__FILE__ ": TransformFilter.csFilter"), TransformFilter_GetPin, TransformFilter_GetPinCount);
|
||||
|
||||
/* pTransformFilter is already allocated */
|
||||
pTransformFilter->pFuncsTable = pFuncsTable;
|
||||
|
@ -115,7 +144,7 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
|
|||
piOutput.pFilter = (IBaseFilter *)pTransformFilter;
|
||||
lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]));
|
||||
|
||||
hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, TransformFilter_Input_CheckMediaType, pFuncsTable->pfnProcessSampleData, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]);
|
||||
hr = BaseInputPin_Construct(&TransformFilter_InputPin_Vtbl, &piInput, TransformFilter_Input_CheckMediaType, TransformFilter_Input_Receive, &pTransformFilter->filter.csFilter, NULL, &pTransformFilter->ppPins[0]);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -129,58 +158,57 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
|
|||
|
||||
if (FAILED(hr))
|
||||
ERR("Cannot create output pin (%x)\n", hr);
|
||||
else
|
||||
{
|
||||
ISeekingPassThru *passthru;
|
||||
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)pTransformFilter, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pTransformFilter->seekthru_unk);
|
||||
IUnknown_QueryInterface(pTransformFilter->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
|
||||
ISeekingPassThru_Init(passthru, FALSE, (IPin*)pTransformFilter->ppPins[0]);
|
||||
ISeekingPassThru_Release(passthru);
|
||||
}
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CoTaskMemFree(pTransformFilter->ppPins);
|
||||
BaseFilterImpl_Release((IBaseFilter*)pTransformFilter);
|
||||
CoTaskMemFree(pTransformFilter);
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TransformFilter_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
||||
HRESULT TransformFilter_Construct(const IBaseFilterVtbl *pVtbl, LONG filter_size, const CLSID* pClsid, const TransformFilterFuncTable* pFuncsTable, IBaseFilter ** ppTransformFilter)
|
||||
{
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
||||
TransformFilter* pTf;
|
||||
|
||||
*ppv = NULL;
|
||||
*ppTransformFilter = NULL;
|
||||
|
||||
if (IsEqualIID(riid, &IID_IUnknown))
|
||||
*ppv = This;
|
||||
else if (IsEqualIID(riid, &IID_IPersist))
|
||||
*ppv = This;
|
||||
else if (IsEqualIID(riid, &IID_IMediaFilter))
|
||||
*ppv = This;
|
||||
else if (IsEqualIID(riid, &IID_IBaseFilter))
|
||||
*ppv = This;
|
||||
else if (IsEqualIID(riid, &IID_IMediaSeeking))
|
||||
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
||||
assert(filter_size >= sizeof(TransformFilter));
|
||||
|
||||
if (*ppv)
|
||||
pTf = CoTaskMemAlloc(filter_size);
|
||||
ZeroMemory(pTf, filter_size);
|
||||
|
||||
if (!pTf)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
if (SUCCEEDED(TransformFilter_Init(pVtbl, pClsid, pFuncsTable, pTf)))
|
||||
{
|
||||
IUnknown_AddRef((IUnknown *)(*ppv));
|
||||
*ppTransformFilter = (IBaseFilter*)(&pTf->filter.lpVtbl);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (!IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow))
|
||||
FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
|
||||
|
||||
return E_NOINTERFACE;
|
||||
CoTaskMemFree(pTf);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static ULONG WINAPI TransformFilter_Release(IBaseFilter * iface)
|
||||
HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
||||
{
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
HRESULT hr;
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
|
||||
|
||||
hr = BaseFilterImpl_QueryInterface(iface, riid, ppv);
|
||||
|
||||
if (FAILED(hr) && (!IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow)))
|
||||
FIXME("No interface for %s!\n", debugstr_guid(riid));
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface)
|
||||
{
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
ULONG refCount = BaseFilterImpl_Release(iface);
|
||||
|
||||
TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
|
||||
|
@ -217,9 +245,9 @@ static ULONG WINAPI TransformFilter_Release(IBaseFilter * iface)
|
|||
|
||||
/** IMediaFilter methods **/
|
||||
|
||||
static HRESULT WINAPI TransformFilter_Stop(IBaseFilter * iface)
|
||||
HRESULT WINAPI TransformFilterImpl_Stop(IBaseFilter * iface)
|
||||
{
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p/%p)\n", This, iface);
|
||||
|
@ -227,17 +255,17 @@ static HRESULT WINAPI TransformFilter_Stop(IBaseFilter * iface)
|
|||
EnterCriticalSection(&This->filter.csFilter);
|
||||
{
|
||||
This->filter.state = State_Stopped;
|
||||
if (This->pFuncsTable->pfnProcessEnd)
|
||||
hr = This->pFuncsTable->pfnProcessEnd(This);
|
||||
if (This->pFuncsTable->pfnStopStreaming)
|
||||
hr = This->pFuncsTable->pfnStopStreaming(This);
|
||||
}
|
||||
LeaveCriticalSection(&This->filter.csFilter);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TransformFilter_Pause(IBaseFilter * iface)
|
||||
HRESULT WINAPI TransformFilterImpl_Pause(IBaseFilter * iface)
|
||||
{
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p/%p)->()\n", This, iface);
|
||||
|
@ -257,10 +285,10 @@ static HRESULT WINAPI TransformFilter_Pause(IBaseFilter * iface)
|
|||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
|
||||
HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
|
||||
TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
|
||||
|
||||
|
@ -269,8 +297,8 @@ static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tS
|
|||
if (This->filter.state == State_Stopped)
|
||||
{
|
||||
((BaseInputPin *)This->ppPins[0])->end_of_stream = 0;
|
||||
if (This->pFuncsTable->pfnProcessBegin)
|
||||
hr = This->pFuncsTable->pfnProcessBegin(This);
|
||||
if (This->pFuncsTable->pfnStartStreaming)
|
||||
hr = This->pFuncsTable->pfnStartStreaming(This);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = BaseOutputPinImpl_Active((BaseOutputPin *)This->ppPins[1]);
|
||||
}
|
||||
|
@ -288,9 +316,9 @@ static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tS
|
|||
|
||||
/** IBaseFilter implementation **/
|
||||
|
||||
static HRESULT WINAPI TransformFilter_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
|
||||
HRESULT WINAPI TransformFilterImpl_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
|
||||
{
|
||||
TransformFilterImpl *This = (TransformFilterImpl *)iface;
|
||||
TransformFilter *This = (TransformFilter *)iface;
|
||||
|
||||
TRACE("(%p/%p)->(%p,%p)\n", This, iface, debugstr_w(Id), ppPin);
|
||||
|
||||
|
@ -299,18 +327,18 @@ static HRESULT WINAPI TransformFilter_FindPin(IBaseFilter * iface, LPCWSTR Id, I
|
|||
|
||||
static const IBaseFilterVtbl TransformFilter_Vtbl =
|
||||
{
|
||||
TransformFilter_QueryInterface,
|
||||
TransformFilterImpl_QueryInterface,
|
||||
BaseFilterImpl_AddRef,
|
||||
TransformFilter_Release,
|
||||
TransformFilterImpl_Release,
|
||||
BaseFilterImpl_GetClassID,
|
||||
TransformFilter_Stop,
|
||||
TransformFilter_Pause,
|
||||
TransformFilter_Run,
|
||||
TransformFilterImpl_Stop,
|
||||
TransformFilterImpl_Pause,
|
||||
TransformFilterImpl_Run,
|
||||
BaseFilterImpl_GetState,
|
||||
BaseFilterImpl_SetSyncSource,
|
||||
BaseFilterImpl_GetSyncSource,
|
||||
BaseFilterImpl_EnumPins,
|
||||
TransformFilter_FindPin,
|
||||
TransformFilterImpl_FindPin,
|
||||
BaseFilterImpl_QueryFilterInfo,
|
||||
BaseFilterImpl_JoinFilterGraph,
|
||||
BaseFilterImpl_QueryVendorInfo
|
||||
|
@ -319,14 +347,14 @@ static const IBaseFilterVtbl TransformFilter_Vtbl =
|
|||
static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
|
||||
{
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilterImpl* pTransform;
|
||||
TransformFilter* pTransform;
|
||||
IPin* ppin;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->()\n", iface);
|
||||
|
||||
/* Since we process samples synchronously, just forward notification downstream */
|
||||
pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
if (!pTransform)
|
||||
hr = E_FAIL;
|
||||
else
|
||||
|
@ -345,19 +373,24 @@ static HRESULT WINAPI TransformFilter_InputPin_EndOfStream(IPin * iface)
|
|||
static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
|
||||
{
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilterImpl* pTransform;
|
||||
HRESULT hr;
|
||||
TransformFilter* pTransform;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->(%p, %p)\n", iface, pReceivePin, pmt);
|
||||
|
||||
pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
|
||||
if (pTransform->pFuncsTable->pfnSetMediaType)
|
||||
hr = pTransform->pFuncsTable->pfnSetMediaType(pTransform, PINDIR_INPUT, pmt);
|
||||
|
||||
if (SUCCEEDED(hr) && pTransform->pFuncsTable->pfnCompleteConnect)
|
||||
hr = pTransform->pFuncsTable->pfnCompleteConnect(pTransform, PINDIR_INPUT, pReceivePin);
|
||||
|
||||
hr = pTransform->pFuncsTable->pfnConnectInput(This, pmt);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = BaseInputPinImpl_ReceiveConnection(iface, pReceivePin, pmt);
|
||||
if (FAILED(hr))
|
||||
pTransform->pFuncsTable->pfnCleanup(This);
|
||||
if (FAILED(hr) && pTransform->pFuncsTable->pfnBreakConnect)
|
||||
pTransform->pFuncsTable->pfnBreakConnect(pTransform, PINDIR_INPUT);
|
||||
}
|
||||
|
||||
return hr;
|
||||
|
@ -366,12 +399,13 @@ static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, I
|
|||
static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface)
|
||||
{
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilterImpl* pTransform;
|
||||
TransformFilter* pTransform;
|
||||
|
||||
TRACE("(%p)->()\n", iface);
|
||||
|
||||
pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
|
||||
pTransform->pFuncsTable->pfnCleanup(This);
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
if (pTransform->pFuncsTable->pfnBreakConnect)
|
||||
pTransform->pFuncsTable->pfnBreakConnect(pTransform, PINDIR_INPUT);
|
||||
|
||||
return BasePinImpl_Disconnect(iface);
|
||||
}
|
||||
|
@ -379,15 +413,15 @@ static HRESULT WINAPI TransformFilter_InputPin_Disconnect(IPin * iface)
|
|||
static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
|
||||
{
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilterImpl* pTransform;
|
||||
TransformFilter* pTransform;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->()\n", iface);
|
||||
|
||||
pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
EnterCriticalSection(&pTransform->filter.csFilter);
|
||||
if (pTransform->pFuncsTable->pfnBeginFlush)
|
||||
hr = pTransform->pFuncsTable->pfnBeginFlush(This);
|
||||
hr = pTransform->pFuncsTable->pfnBeginFlush(pTransform);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = BaseInputPinImpl_BeginFlush(iface);
|
||||
LeaveCriticalSection(&pTransform->filter.csFilter);
|
||||
|
@ -397,15 +431,15 @@ static HRESULT WINAPI TransformFilter_InputPin_BeginFlush(IPin * iface)
|
|||
static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface)
|
||||
{
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilterImpl* pTransform;
|
||||
TransformFilter* pTransform;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->()\n", iface);
|
||||
|
||||
pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
EnterCriticalSection(&pTransform->filter.csFilter);
|
||||
if (pTransform->pFuncsTable->pfnEndFlush)
|
||||
hr = pTransform->pFuncsTable->pfnEndFlush(This);
|
||||
hr = pTransform->pFuncsTable->pfnEndFlush(pTransform);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = BaseInputPinImpl_EndFlush(iface);
|
||||
LeaveCriticalSection(&pTransform->filter.csFilter);
|
||||
|
@ -415,15 +449,15 @@ static HRESULT WINAPI TransformFilter_InputPin_EndFlush(IPin * iface)
|
|||
static HRESULT WINAPI TransformFilter_InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
|
||||
{
|
||||
BaseInputPin* This = (BaseInputPin*) iface;
|
||||
TransformFilterImpl* pTransform;
|
||||
TransformFilter* pTransform;
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
TRACE("(%p)->()\n", iface);
|
||||
|
||||
pTransform = (TransformFilterImpl*)This->pin.pinInfo.pFilter;
|
||||
pTransform = (TransformFilter*)This->pin.pinInfo.pFilter;
|
||||
EnterCriticalSection(&pTransform->filter.csFilter);
|
||||
if (pTransform->pFuncsTable->pfnNewSegment)
|
||||
hr = pTransform->pFuncsTable->pfnNewSegment(This, tStart, tStop, dRate);
|
||||
hr = pTransform->pFuncsTable->pfnNewSegment(pTransform, tStart, tStop, dRate);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = BaseInputPinImpl_NewSegment(iface, tStart, tStop, dRate);
|
||||
LeaveCriticalSection(&pTransform->filter.csFilter);
|
||||
|
@ -455,7 +489,7 @@ static const IPinVtbl TransformFilter_InputPin_Vtbl =
|
|||
static HRESULT WINAPI TransformFilter_Output_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt)
|
||||
{
|
||||
BasePin *This = (BasePin *)iface;
|
||||
TransformFilterImpl *pTransform = (TransformFilterImpl *)This->pinInfo.pFilter;
|
||||
TransformFilter *pTransform = (TransformFilter *)This->pinInfo.pFilter;
|
||||
|
||||
if (iPosition < 0)
|
||||
return E_INVALIDARG;
|
|
@ -158,3 +158,51 @@ LONG WINAPI BaseFilterImpl_GetPinVersion(IBaseFilter* This);
|
|||
VOID WINAPI BaseFilterImpl_IncrementPinVersion(IBaseFilter* This);
|
||||
|
||||
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, BaseFilter_GetPin pfGetPin, BaseFilter_GetPinCount pfGetPinCount);
|
||||
|
||||
/* Transform Filter */
|
||||
typedef struct TransformFilter
|
||||
{
|
||||
BaseFilter filter;
|
||||
|
||||
IPin **ppPins;
|
||||
ULONG npins;
|
||||
AM_MEDIA_TYPE pmt;
|
||||
|
||||
const struct TransformFilterFuncTable * pFuncsTable;
|
||||
} TransformFilter;
|
||||
|
||||
typedef HRESULT (WINAPI *TransformFilter_StartStreaming) (TransformFilter *iface);
|
||||
typedef HRESULT (WINAPI *TransformFilter_StopStreaming) (TransformFilter *iface);
|
||||
typedef HRESULT (WINAPI *TransformFilter_Receive) (TransformFilter* iface, IMediaSample* pIn);
|
||||
typedef HRESULT (WINAPI *TransformFilter_CompleteConnect) (TransformFilter *iface, PIN_DIRECTION dir, IPin *pPin);
|
||||
typedef HRESULT (WINAPI *TransformFilter_BreakConnect) (TransformFilter *iface, PIN_DIRECTION dir);
|
||||
typedef HRESULT (WINAPI *TransformFilter_SetMediaType) (TransformFilter *iface, PIN_DIRECTION dir, const AM_MEDIA_TYPE *pMediaType);
|
||||
typedef HRESULT (WINAPI *TransformFilter_CheckInputType) (TransformFilter *iface, const AM_MEDIA_TYPE *pMediaType);
|
||||
typedef HRESULT (WINAPI *TransformFilter_EndOfStream) (TransformFilter *iface);
|
||||
typedef HRESULT (WINAPI *TransformFilter_BeginFlush) (TransformFilter *iface);
|
||||
typedef HRESULT (WINAPI *TransformFilter_EndFlush) (TransformFilter *iface);
|
||||
typedef HRESULT (WINAPI *TransformFilter_NewSegment) (TransformFilter *iface,
|
||||
REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
|
||||
|
||||
typedef struct TransformFilterFuncTable {
|
||||
TransformFilter_StartStreaming pfnStartStreaming;
|
||||
TransformFilter_Receive pfnReceive;
|
||||
TransformFilter_StopStreaming pfnStopStreaming;
|
||||
TransformFilter_CheckInputType pfnCheckInputType;
|
||||
TransformFilter_SetMediaType pfnSetMediaType;
|
||||
TransformFilter_CompleteConnect pfnCompleteConnect;
|
||||
TransformFilter_BreakConnect pfnBreakConnect;
|
||||
TransformFilter_EndOfStream pfnEndOfStream;
|
||||
TransformFilter_BeginFlush pfnBeginFlush;
|
||||
TransformFilter_EndFlush pfnEndFlush;
|
||||
TransformFilter_NewSegment pfnNewSegment;
|
||||
} TransformFilterFuncTable;
|
||||
|
||||
HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv);
|
||||
ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface);
|
||||
HRESULT WINAPI TransformFilterImpl_Stop(IBaseFilter * iface);
|
||||
HRESULT WINAPI TransformFilterImpl_Pause(IBaseFilter * iface);
|
||||
HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter * iface, REFERENCE_TIME tStart);
|
||||
HRESULT WINAPI TransformFilterImpl_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin);
|
||||
|
||||
HRESULT TransformFilter_Construct( const IBaseFilterVtbl *filterVtbl, LONG filter_size, const CLSID* pClsid, const TransformFilterFuncTable* pFuncsTable, IBaseFilter ** ppTransformFilter);
|
||||
|
|
Loading…
Reference in New Issue