strmbase: Remove code duplicated by every user of ISeekingPassThruImpl.
This commit is contained in:
parent
c76f0beeab
commit
f53fa4f05b
|
@ -42,7 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
||||||
typedef struct ACMWrapperImpl
|
typedef struct ACMWrapperImpl
|
||||||
{
|
{
|
||||||
TransformFilter tf;
|
TransformFilter tf;
|
||||||
IUnknown *seekthru_unk;
|
|
||||||
|
|
||||||
HACMSTREAM has;
|
HACMSTREAM has;
|
||||||
LPWAVEFORMATEX pWfIn;
|
LPWAVEFORMATEX pWfIn;
|
||||||
|
@ -399,14 +398,6 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return 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, This->tf.ppPins[0]);
|
|
||||||
ISeekingPassThru_Release(passthru);
|
|
||||||
}
|
|
||||||
|
|
||||||
*ppv = This;
|
*ppv = This;
|
||||||
This->lasttime_real = This->lasttime_sent = -1;
|
This->lasttime_real = This->lasttime_sent = -1;
|
||||||
|
@ -414,24 +405,9 @@ HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI ACMWrapper_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
ACMWrapperImpl *This = impl_from_IBaseFilter(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 =
|
static const IBaseFilterVtbl ACMWrapper_Vtbl =
|
||||||
{
|
{
|
||||||
ACMWrapper_QueryInterface,
|
TransformFilterImpl_QueryInterface,
|
||||||
BaseFilterImpl_AddRef,
|
BaseFilterImpl_AddRef,
|
||||||
TransformFilterImpl_Release,
|
TransformFilterImpl_Release,
|
||||||
BaseFilterImpl_GetClassID,
|
BaseFilterImpl_GetClassID,
|
||||||
|
|
|
@ -43,7 +43,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
||||||
typedef struct AVIDecImpl
|
typedef struct AVIDecImpl
|
||||||
{
|
{
|
||||||
TransformFilter tf;
|
TransformFilter tf;
|
||||||
IUnknown *seekthru_unk;
|
|
||||||
|
|
||||||
HIC hvid;
|
HIC hvid;
|
||||||
BITMAPINFOHEADER* pBihIn;
|
BITMAPINFOHEADER* pBihIn;
|
||||||
|
@ -417,14 +416,6 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return 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, This->tf.ppPins[0]);
|
|
||||||
ISeekingPassThru_Release(passthru);
|
|
||||||
}
|
|
||||||
|
|
||||||
This->hvid = NULL;
|
This->hvid = NULL;
|
||||||
This->pBihIn = NULL;
|
This->pBihIn = NULL;
|
||||||
|
@ -435,23 +426,9 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI AVIDec_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
AVIDecImpl *This = impl_from_IBaseFilter(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 =
|
static const IBaseFilterVtbl AVIDec_Vtbl =
|
||||||
{
|
{
|
||||||
AVIDec_QueryInterface,
|
TransformFilterImpl_QueryInterface,
|
||||||
BaseFilterImpl_AddRef,
|
BaseFilterImpl_AddRef,
|
||||||
TransformFilterImpl_Release,
|
TransformFilterImpl_Release,
|
||||||
BaseFilterImpl_GetClassID,
|
BaseFilterImpl_GetClassID,
|
||||||
|
|
|
@ -238,6 +238,20 @@ static HRESULT TransformFilter_Init(const IBaseFilterVtbl *pVtbl, const CLSID* p
|
||||||
pTransformFilter->qcimpl->IQualityControl_iface.lpVtbl = &TransformFilter_QualityControl_Vtbl;
|
pTransformFilter->qcimpl->IQualityControl_iface.lpVtbl = &TransformFilter_QualityControl_Vtbl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
ISeekingPassThru *passthru;
|
||||||
|
pTransformFilter->seekthru_unk = NULL;
|
||||||
|
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)pTransformFilter, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pTransformFilter->seekthru_unk);
|
||||||
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
|
IUnknown_QueryInterface(pTransformFilter->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
|
||||||
|
ISeekingPassThru_Init(passthru, FALSE, pTransformFilter->ppPins[0]);
|
||||||
|
ISeekingPassThru_Release(passthru);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
CoTaskMemFree(pTransformFilter->ppPins);
|
CoTaskMemFree(pTransformFilter->ppPins);
|
||||||
|
@ -283,6 +297,11 @@ HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID ri
|
||||||
IUnknown_AddRef((IUnknown*)*ppv);
|
IUnknown_AddRef((IUnknown*)*ppv);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
else if (IsEqualIID(riid, &IID_IMediaSeeking) ||
|
||||||
|
IsEqualIID(riid, &IID_IMediaPosition))
|
||||||
|
{
|
||||||
|
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
||||||
|
}
|
||||||
hr = BaseFilterImpl_QueryInterface(iface, riid, ppv);
|
hr = BaseFilterImpl_QueryInterface(iface, riid, ppv);
|
||||||
|
|
||||||
if (FAILED(hr) && !IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow) &&
|
if (FAILED(hr) && !IsEqualIID(riid, &IID_IPin) && !IsEqualIID(riid, &IID_IVideoWindow) &&
|
||||||
|
@ -325,6 +344,7 @@ ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface)
|
||||||
FreeMediaType(&This->pmt);
|
FreeMediaType(&This->pmt);
|
||||||
QualityControlImpl_Destroy(This->qcimpl);
|
QualityControlImpl_Destroy(This->qcimpl);
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
|
IUnknown_Release(This->seekthru_unk);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,6 @@ static const char *Gstreamer_FindMatch(const char *strcaps)
|
||||||
|
|
||||||
typedef struct GstTfImpl {
|
typedef struct GstTfImpl {
|
||||||
TransformFilter tf;
|
TransformFilter tf;
|
||||||
IUnknown *seekthru_unk;
|
|
||||||
const char *gstreamer_name;
|
const char *gstreamer_name;
|
||||||
GstElement *filter;
|
GstElement *filter;
|
||||||
GstPad *my_src, *my_sink, *their_src, *their_sink;
|
GstPad *my_src, *my_sink, *their_src, *their_sink;
|
||||||
|
@ -450,14 +449,6 @@ static HRESULT Gstreamer_transform_create(IUnknown *punkout, const CLSID *clsid,
|
||||||
|
|
||||||
if (FAILED(TransformFilter_Construct(&GSTTf_Vtbl, sizeof(GstTfImpl), clsid, vtbl, (IBaseFilter**)&This)))
|
if (FAILED(TransformFilter_Construct(&GSTTf_Vtbl, sizeof(GstTfImpl), clsid, vtbl, (IBaseFilter**)&This)))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
else
|
|
||||||
{
|
|
||||||
ISeekingPassThru *passthru;
|
|
||||||
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->gstreamer_name = name;
|
This->gstreamer_name = name;
|
||||||
*obj = This;
|
*obj = This;
|
||||||
|
@ -830,23 +821,9 @@ IUnknown * CALLBACK Gstreamer_AudioConvert_create(IUnknown *punkout, HRESULT *ph
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI GSTTf_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
GstTfImpl *This = (GstTfImpl*)iface;
|
|
||||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
|
|
||||||
|
|
||||||
if (IsEqualIID(riid, &IID_IMediaSeeking) || IsEqualIID(riid, &IID_IMediaPosition))
|
|
||||||
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
|
||||||
|
|
||||||
hr = TransformFilterImpl_QueryInterface(iface, riid, ppv);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const IBaseFilterVtbl GSTTf_Vtbl =
|
static const IBaseFilterVtbl GSTTf_Vtbl =
|
||||||
{
|
{
|
||||||
GSTTf_QueryInterface,
|
TransformFilterImpl_QueryInterface,
|
||||||
BaseFilterImpl_AddRef,
|
BaseFilterImpl_AddRef,
|
||||||
TransformFilterImpl_Release,
|
TransformFilterImpl_Release,
|
||||||
BaseFilterImpl_GetClassID,
|
BaseFilterImpl_GetClassID,
|
||||||
|
|
|
@ -136,7 +136,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
|
||||||
typedef struct QTVDecoderImpl
|
typedef struct QTVDecoderImpl
|
||||||
{
|
{
|
||||||
TransformFilter tf;
|
TransformFilter tf;
|
||||||
IUnknown *seekthru_unk;
|
|
||||||
|
|
||||||
ImageDescriptionHandle hImageDescription;
|
ImageDescriptionHandle hImageDescription;
|
||||||
CFMutableDictionaryRef outputBufferAttributes;
|
CFMutableDictionaryRef outputBufferAttributes;
|
||||||
|
@ -545,36 +544,14 @@ IUnknown * CALLBACK QTVDecoder_create(IUnknown * pUnkOuter, HRESULT* phr)
|
||||||
*phr = hr;
|
*phr = hr;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
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, This->tf.ppPins[0]);
|
|
||||||
ISeekingPassThru_Release(passthru);
|
|
||||||
}
|
|
||||||
|
|
||||||
*phr = hr;
|
*phr = hr;
|
||||||
return (IUnknown*)This;
|
return (IUnknown*)This;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI QTVDecoder_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
QTVDecoderImpl *This = impl_from_IBaseFilter(iface);
|
|
||||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
|
|
||||||
|
|
||||||
if (IsEqualIID(riid, &IID_IMediaSeeking) || IsEqualIID(riid, &IID_IMediaPosition))
|
|
||||||
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
|
||||||
|
|
||||||
hr = TransformFilterImpl_QueryInterface(iface, riid, ppv);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const IBaseFilterVtbl QTVDecoder_Vtbl =
|
static const IBaseFilterVtbl QTVDecoder_Vtbl =
|
||||||
{
|
{
|
||||||
QTVDecoder_QueryInterface,
|
TransformFilterImpl_QueryInterface,
|
||||||
BaseFilterImpl_AddRef,
|
BaseFilterImpl_AddRef,
|
||||||
TransformFilterImpl_Release,
|
TransformFilterImpl_Release,
|
||||||
BaseFilterImpl_GetClassID,
|
BaseFilterImpl_GetClassID,
|
||||||
|
|
|
@ -207,6 +207,8 @@ typedef struct TransformFilter
|
||||||
|
|
||||||
const struct TransformFilterFuncTable * pFuncsTable;
|
const struct TransformFilterFuncTable * pFuncsTable;
|
||||||
struct QualityControlImpl *qcimpl;
|
struct QualityControlImpl *qcimpl;
|
||||||
|
/* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */
|
||||||
|
IUnknown *seekthru_unk;
|
||||||
} TransformFilter;
|
} TransformFilter;
|
||||||
|
|
||||||
typedef HRESULT (WINAPI *TransformFilter_DecideBufferSize) (TransformFilter *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
|
typedef HRESULT (WINAPI *TransformFilter_DecideBufferSize) (TransformFilter *iface, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest);
|
||||||
|
|
Loading…
Reference in New Issue