quartz: Implement seeking stubs for transform filters.

This commit is contained in:
Maarten Lankhorst 2008-04-01 13:41:25 -07:00 committed by Alexandre Julliard
parent 9faf7e3586
commit e18129068e
5 changed files with 97 additions and 6 deletions

View File

@ -261,7 +261,7 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
This->reinit_codec = TRUE;
hr = TransformFilter_Create(&(This->tf), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable);
hr = TransformFilter_Create(&(This->tf), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable, NULL, NULL, NULL);
if (FAILED(hr))
return hr;

View File

@ -291,7 +291,7 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
This->pBihIn = NULL;
This->pBihOut = NULL;
hr = TransformFilter_Create(&(This->tf), &CLSID_AVIDec, &AVIDec_FuncsTable);
hr = TransformFilter_Create(&(This->tf), &CLSID_AVIDec, &AVIDec_FuncsTable, NULL, NULL, NULL);
if (FAILED(hr))
return hr;

View File

@ -18,6 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef QUARTZ_CONTROL_H
#define QUARTZ_CONTROL_H
typedef HRESULT (* CHANGEPROC)(IBaseFilter *pUserData);
typedef struct MediaSeekingImpl
@ -55,3 +58,5 @@ HRESULT WINAPI MediaSeekingImpl_GetAvailable(IMediaSeeking * iface, LONGLONG * p
HRESULT WINAPI MediaSeekingImpl_SetRate(IMediaSeeking * iface, double dRate);
HRESULT WINAPI MediaSeekingImpl_GetRate(IMediaSeeking * iface, double * dRate);
HRESULT WINAPI MediaSeekingImpl_GetPreroll(IMediaSeeking * iface, LONGLONG * pPreroll);
#endif /*QUARTZ_CONTROL_H*/

View File

@ -143,7 +143,76 @@ static HRESULT TransformFilter_OutputPin_Construct(const PIN_INFO * pPinInfo, co
return E_FAIL;
}
HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSID* pClsid, const TransformFuncsTable* pFuncsTable)
static inline TransformFilterImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
{
return (TransformFilterImpl *)((char*)iface - FIELD_OFFSET(TransformFilterImpl, mediaSeeking.lpVtbl));
}
static HRESULT WINAPI TransformFilter_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv)
{
TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
return IUnknown_QueryInterface((IUnknown *)This, riid, ppv);
}
static ULONG WINAPI TransformFilter_Seeking_AddRef(IMediaSeeking * iface)
{
TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
return IUnknown_AddRef((IUnknown *)This);
}
static ULONG WINAPI TransformFilter_Seeking_Release(IMediaSeeking * iface)
{
TransformFilterImpl *This = impl_from_IMediaSeeking(iface);
return IUnknown_Release((IUnknown *)This);
}
static const IMediaSeekingVtbl TransformFilter_Seeking_Vtbl =
{
TransformFilter_Seeking_QueryInterface,
TransformFilter_Seeking_AddRef,
TransformFilter_Seeking_Release,
MediaSeekingImpl_GetCapabilities,
MediaSeekingImpl_CheckCapabilities,
MediaSeekingImpl_IsFormatSupported,
MediaSeekingImpl_QueryPreferredFormat,
MediaSeekingImpl_GetTimeFormat,
MediaSeekingImpl_IsUsingTimeFormat,
MediaSeekingImpl_SetTimeFormat,
MediaSeekingImpl_GetDuration,
MediaSeekingImpl_GetStopPosition,
MediaSeekingImpl_GetCurrentPosition,
MediaSeekingImpl_ConvertTimeFormat,
MediaSeekingImpl_SetPositions,
MediaSeekingImpl_GetPositions,
MediaSeekingImpl_GetAvailable,
MediaSeekingImpl_SetRate,
MediaSeekingImpl_GetRate,
MediaSeekingImpl_GetPreroll
};
static HRESULT TransformFilter_ChangeCurrent(IBaseFilter *iface)
{
FIXME("(%p) filter hasn't implemented current position change!\n", iface);
return S_OK;
}
static HRESULT TransformFilter_ChangeStop(IBaseFilter *iface)
{
FIXME("(%p) filter hasn't implemented stop position change!\n", iface);
return S_OK;
}
static HRESULT TransformFilter_ChangeRate(IBaseFilter *iface)
{
FIXME("(%p) filter hasn't implemented rate change!\n", iface);
return S_OK;
}
HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSID* pClsid, const TransformFuncsTable* pFuncsTable, CHANGEPROC stop, CHANGEPROC current, CHANGEPROC rate)
{
HRESULT hr;
PIN_INFO piInput;
@ -184,8 +253,20 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
hr = TransformFilter_OutputPin_Construct(&piOutput, &props, pTransformFilter, TransformFilter_Output_QueryAccept, &pTransformFilter->csFilter, &pTransformFilter->ppPins[1]);
if (FAILED(hr))
ERR("Cannot create output pin (%x)\n", hr);
if (FAILED(hr))
ERR("Cannot create output pin (%x)\n", hr);
else
{
if (!stop)
stop = TransformFilter_ChangeStop;
if (!current)
current = TransformFilter_ChangeCurrent;
if (!rate)
rate = TransformFilter_ChangeRate;
MediaSeekingImpl_Init((IBaseFilter*)pTransformFilter, stop, current, rate, &pTransformFilter->mediaSeeking, &pTransformFilter->csFilter);
pTransformFilter->mediaSeeking.lpVtbl = &TransformFilter_Seeking_Vtbl;
}
}
else
{
@ -213,6 +294,8 @@ static HRESULT WINAPI TransformFilter_QueryInterface(IBaseFilter * iface, REFIID
*ppv = (LPVOID)This;
else if (IsEqualIID(riid, &IID_IBaseFilter))
*ppv = (LPVOID)This;
else if (IsEqualIID(riid, &IID_IMediaSeeking))
*ppv = &This->mediaSeeking;
if (*ppv)
{

View File

@ -18,6 +18,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "control_private.h"
typedef struct TransformFilterImpl TransformFilterImpl;
typedef struct TransformFuncsTable {
@ -40,10 +42,11 @@ struct TransformFilterImpl
IReferenceClock * pClock;
FILTER_INFO filterInfo;
CLSID clsid;
struct MediaSeekingImpl mediaSeeking;
IPin ** ppPins;
const TransformFuncsTable * pFuncsTable;
};
HRESULT TransformFilter_Create(TransformFilterImpl*, const CLSID*, const TransformFuncsTable* pFuncsTable);
HRESULT TransformFilter_Create(TransformFilterImpl*, const CLSID*, const TransformFuncsTable* pFuncsTable, CHANGEPROC stop, CHANGEPROC current, CHANGEPROC rate);