Commit 4fe2be86 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Add support for MediaSeekingPassThru to transform filter.

parent f48f6099
...@@ -326,7 +326,7 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -326,7 +326,7 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
This = CoTaskMemAlloc(sizeof(ACMWrapperImpl)); This = CoTaskMemAlloc(sizeof(ACMWrapperImpl));
ZeroMemory(This, sizeof(ACMWrapperImpl)); ZeroMemory(This, sizeof(ACMWrapperImpl));
hr = TransformFilter_Create(&(This->tf), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable, NULL, NULL, NULL); hr = TransformFilter_Create(&(This->tf), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
......
...@@ -331,7 +331,7 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv) ...@@ -331,7 +331,7 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
This->pBihIn = NULL; This->pBihIn = NULL;
This->pBihOut = NULL; This->pBihOut = NULL;
hr = TransformFilter_Create(&(This->tf), &CLSID_AVIDec, &AVIDec_FuncsTable, NULL, NULL, NULL); hr = TransformFilter_Create(&(This->tf), &CLSID_AVIDec, &AVIDec_FuncsTable);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
......
...@@ -73,80 +73,7 @@ static HRESULT TransformFilter_Output_QueryAccept(LPVOID iface, const AM_MEDIA_T ...@@ -73,80 +73,7 @@ static HRESULT TransformFilter_Output_QueryAccept(LPVOID iface, const AM_MEDIA_T
return S_FALSE; return S_FALSE;
} }
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
};
/* These shouldn't be implemented by default.
* Usually only source filters should implement these
* and even it's not needed all of the time
*/
static HRESULT TransformFilter_ChangeCurrent(IBaseFilter *iface)
{
TRACE("(%p) filter hasn't implemented current position change!\n", iface);
return S_OK;
}
static HRESULT TransformFilter_ChangeStop(IBaseFilter *iface)
{
TRACE("(%p) filter hasn't implemented stop position change!\n", iface);
return S_OK;
}
static HRESULT TransformFilter_ChangeRate(IBaseFilter *iface)
{
TRACE("(%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; HRESULT hr;
PIN_INFO piInput; PIN_INFO piInput;
...@@ -195,18 +122,14 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI ...@@ -195,18 +122,14 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
ERR("Cannot create output pin (%x)\n", hr); ERR("Cannot create output pin (%x)\n", hr);
else else
{ {
if (!stop) ISeekingPassThru *passthru;
stop = TransformFilter_ChangeStop; hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)pTransformFilter, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pTransformFilter->seekthru_unk);
if (!current) IUnknown_QueryInterface(pTransformFilter->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
current = TransformFilter_ChangeCurrent; ISeekingPassThru_Init(passthru, FALSE, (IPin*)pTransformFilter->ppPins[0]);
if (!rate) ISeekingPassThru_Release(passthru);
rate = TransformFilter_ChangeRate;
MediaSeekingImpl_Init((IBaseFilter*)pTransformFilter, stop, current, rate, &pTransformFilter->mediaSeeking, &pTransformFilter->csFilter);
pTransformFilter->mediaSeeking.lpVtbl = &TransformFilter_Seeking_Vtbl;
} }
} }
else if (FAILED(hr))
{ {
CoTaskMemFree(pTransformFilter->ppPins); CoTaskMemFree(pTransformFilter->ppPins);
pTransformFilter->csFilter.DebugInfo->Spare[0] = 0; pTransformFilter->csFilter.DebugInfo->Spare[0] = 0;
...@@ -233,7 +156,7 @@ static HRESULT WINAPI TransformFilter_QueryInterface(IBaseFilter * iface, REFIID ...@@ -233,7 +156,7 @@ static HRESULT WINAPI TransformFilter_QueryInterface(IBaseFilter * iface, REFIID
else if (IsEqualIID(riid, &IID_IBaseFilter)) else if (IsEqualIID(riid, &IID_IBaseFilter))
*ppv = This; *ppv = This;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
*ppv = &This->mediaSeeking; return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
if (*ppv) if (*ppv)
{ {
......
...@@ -34,6 +34,7 @@ typedef struct TransformFuncsTable { ...@@ -34,6 +34,7 @@ typedef struct TransformFuncsTable {
struct TransformFilterImpl struct TransformFilterImpl
{ {
const IBaseFilterVtbl * lpVtbl; const IBaseFilterVtbl * lpVtbl;
IUnknown *seekthru_unk;
LONG refCount; LONG refCount;
CRITICAL_SECTION csFilter; CRITICAL_SECTION csFilter;
...@@ -42,7 +43,6 @@ struct TransformFilterImpl ...@@ -42,7 +43,6 @@ struct TransformFilterImpl
IReferenceClock * pClock; IReferenceClock * pClock;
FILTER_INFO filterInfo; FILTER_INFO filterInfo;
CLSID clsid; CLSID clsid;
struct MediaSeekingImpl mediaSeeking;
IPin **ppPins; IPin **ppPins;
ULONG npins; ULONG npins;
...@@ -51,4 +51,4 @@ struct TransformFilterImpl ...@@ -51,4 +51,4 @@ struct TransformFilterImpl
const TransformFuncsTable * pFuncsTable; const TransformFuncsTable * pFuncsTable;
}; };
HRESULT TransformFilter_Create(TransformFilterImpl*, const CLSID*, const TransformFuncsTable* pFuncsTable, CHANGEPROC stop, CHANGEPROC current, CHANGEPROC rate); HRESULT TransformFilter_Create(TransformFilterImpl*, const CLSID*, const TransformFuncsTable* pFuncsTable);
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