strmbase: Support aggregation in the base transform filter.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0d0f1e0ff7
commit
f500b1dc19
|
@ -375,25 +375,20 @@ static const TransformFilterFuncTable ACMWrapper_FuncsTable = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
HRESULT ACMWrapper_create(IUnknown *outer, void **out)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ACMWrapperImpl* This;
|
ACMWrapperImpl* This;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", pUnkOuter, ppv);
|
*out = NULL;
|
||||||
|
|
||||||
*ppv = NULL;
|
hr = strmbase_transform_create(sizeof(ACMWrapperImpl), outer, &CLSID_ACMWrapper,
|
||||||
|
|
||||||
if (pUnkOuter)
|
|
||||||
return CLASS_E_NOAGGREGATION;
|
|
||||||
|
|
||||||
hr = strmbase_transform_create(sizeof(ACMWrapperImpl), &CLSID_ACMWrapper,
|
|
||||||
&ACMWrapper_FuncsTable, (IBaseFilter **)&This);
|
&ACMWrapper_FuncsTable, (IBaseFilter **)&This);
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
*ppv = &This->tf.filter.IBaseFilter_iface;
|
*out = &This->tf.filter.IUnknown_inner;
|
||||||
This->lasttime_real = This->lasttime_sent = -1;
|
This->lasttime_real = This->lasttime_sent = -1;
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -390,19 +390,14 @@ static const TransformFilterFuncTable AVIDec_FuncsTable = {
|
||||||
AVIDec_NotifyDrop
|
AVIDec_NotifyDrop
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
HRESULT AVIDec_create(IUnknown *outer, void **out)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
AVIDecImpl * This;
|
AVIDecImpl * This;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", pUnkOuter, ppv);
|
*out = NULL;
|
||||||
|
|
||||||
*ppv = NULL;
|
hr = strmbase_transform_create(sizeof(AVIDecImpl), outer, &CLSID_AVIDec,
|
||||||
|
|
||||||
if (pUnkOuter)
|
|
||||||
return CLASS_E_NOAGGREGATION;
|
|
||||||
|
|
||||||
hr = strmbase_transform_create(sizeof(AVIDecImpl), &CLSID_AVIDec,
|
|
||||||
&AVIDec_FuncsTable, (IBaseFilter **)&This);
|
&AVIDec_FuncsTable, (IBaseFilter **)&This);
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
@ -412,7 +407,7 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
||||||
This->pBihIn = NULL;
|
This->pBihIn = NULL;
|
||||||
This->pBihOut = NULL;
|
This->pBihOut = NULL;
|
||||||
|
|
||||||
*ppv = &This->tf.filter.IBaseFilter_iface;
|
*out = &This->tf.filter.IUnknown_inner;
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,8 +158,7 @@ static void test_aggregation(void)
|
||||||
|
|
||||||
hr = CoCreateInstance(&CLSID_ACMWrapper, &test_outer, CLSCTX_INPROC_SERVER,
|
hr = CoCreateInstance(&CLSID_ACMWrapper, &test_outer, CLSCTX_INPROC_SERVER,
|
||||||
&IID_IUnknown, (void **)&unk);
|
&IID_IUnknown, (void **)&unk);
|
||||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
if (FAILED(hr)) return;
|
|
||||||
ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
|
ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
|
||||||
ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
|
ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
|
||||||
ref = get_refcount(unk);
|
ref = get_refcount(unk);
|
||||||
|
|
|
@ -183,8 +183,7 @@ static void test_aggregation(void)
|
||||||
|
|
||||||
hr = CoCreateInstance(&CLSID_AVIDec, &test_outer, CLSCTX_INPROC_SERVER,
|
hr = CoCreateInstance(&CLSID_AVIDec, &test_outer, CLSCTX_INPROC_SERVER,
|
||||||
&IID_IUnknown, (void **)&unk);
|
&IID_IUnknown, (void **)&unk);
|
||||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
if (FAILED(hr)) return;
|
|
||||||
ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
|
ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
|
||||||
ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
|
ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
|
||||||
ref = get_refcount(unk);
|
ref = get_refcount(unk);
|
||||||
|
|
|
@ -281,14 +281,14 @@ static const IBaseFilterVtbl transform_vtbl =
|
||||||
BaseFilterImpl_QueryVendorInfo
|
BaseFilterImpl_QueryVendorInfo
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT strmbase_transform_init(const CLSID *clsid,
|
static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
|
||||||
const TransformFilterFuncTable *func_table, TransformFilter *filter)
|
const TransformFilterFuncTable *func_table, TransformFilter *filter)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
PIN_INFO piInput;
|
PIN_INFO piInput;
|
||||||
PIN_INFO piOutput;
|
PIN_INFO piOutput;
|
||||||
|
|
||||||
strmbase_filter_init(&filter->filter, &transform_vtbl, NULL, clsid,
|
strmbase_filter_init(&filter->filter, &transform_vtbl, outer, clsid,
|
||||||
(DWORD_PTR)(__FILE__ ": TransformFilter.csFilter"), &tfBaseFuncTable);
|
(DWORD_PTR)(__FILE__ ": TransformFilter.csFilter"), &tfBaseFuncTable);
|
||||||
|
|
||||||
InitializeCriticalSection(&filter->csReceive);
|
InitializeCriticalSection(&filter->csReceive);
|
||||||
|
@ -349,7 +349,7 @@ static HRESULT strmbase_transform_init(const CLSID *clsid,
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT strmbase_transform_create(LONG filter_size, const CLSID *pClsid,
|
HRESULT strmbase_transform_create(LONG filter_size, IUnknown *outer, const CLSID *pClsid,
|
||||||
const TransformFilterFuncTable *pFuncsTable, IBaseFilter **ppTransformFilter)
|
const TransformFilterFuncTable *pFuncsTable, IBaseFilter **ppTransformFilter)
|
||||||
{
|
{
|
||||||
TransformFilter* pTf;
|
TransformFilter* pTf;
|
||||||
|
@ -365,7 +365,7 @@ HRESULT strmbase_transform_create(LONG filter_size, const CLSID *pClsid,
|
||||||
|
|
||||||
ZeroMemory(pTf, filter_size);
|
ZeroMemory(pTf, filter_size);
|
||||||
|
|
||||||
if (SUCCEEDED(strmbase_transform_init(pClsid, pFuncsTable, pTf)))
|
if (SUCCEEDED(strmbase_transform_init(outer, pClsid, pFuncsTable, pTf)))
|
||||||
{
|
{
|
||||||
*ppTransformFilter = &pTf->filter.IBaseFilter_iface;
|
*ppTransformFilter = &pTf->filter.IBaseFilter_iface;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -489,17 +489,16 @@ static HRESULT WINAPI Gstreamer_transform_QOS(TransformFilter *iface, IBaseFilte
|
||||||
return TransformFilterImpl_Notify(iface, sender, qm);
|
return TransformFilterImpl_Notify(iface, sender, qm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT Gstreamer_transform_create(IUnknown *punkouter, const CLSID *clsid, const char *name, const TransformFilterFuncTable *vtbl, void **obj)
|
static HRESULT Gstreamer_transform_create(IUnknown *outer, const CLSID *clsid,
|
||||||
|
const char *name, const TransformFilterFuncTable *vtbl, void **obj)
|
||||||
{
|
{
|
||||||
GstTfImpl *This;
|
GstTfImpl *This;
|
||||||
|
|
||||||
TRACE("%p, %p, %p, %p, %p\n", punkouter, clsid, name, vtbl, obj);
|
if (FAILED(strmbase_transform_create(sizeof(GstTfImpl), outer, clsid, vtbl, (IBaseFilter **)&This)))
|
||||||
|
|
||||||
if (FAILED(strmbase_transform_create(sizeof(GstTfImpl), clsid, vtbl, (IBaseFilter **)&This)))
|
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
This->gstreamer_name = name;
|
This->gstreamer_name = name;
|
||||||
*obj = This;
|
*obj = &This->tf.filter.IUnknown_inner;
|
||||||
|
|
||||||
TRACE("returning %p\n", This);
|
TRACE("returning %p\n", This);
|
||||||
|
|
||||||
|
|
|
@ -518,22 +518,14 @@ static const TransformFilterFuncTable QTVDecoder_FuncsTable = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
IUnknown * CALLBACK QTVDecoder_create(IUnknown * pUnkOuter, HRESULT* phr)
|
IUnknown * CALLBACK QTVDecoder_create(IUnknown *outer, HRESULT* phr)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
QTVDecoderImpl * This;
|
QTVDecoderImpl * This;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", pUnkOuter, phr);
|
|
||||||
|
|
||||||
*phr = S_OK;
|
*phr = S_OK;
|
||||||
|
|
||||||
if (pUnkOuter)
|
hr = strmbase_transform_create(sizeof(QTVDecoderImpl), outer, &CLSID_QTVDecoder,
|
||||||
{
|
|
||||||
*phr = CLASS_E_NOAGGREGATION;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = strmbase_transform_create(sizeof(QTVDecoderImpl), &CLSID_QTVDecoder,
|
|
||||||
&QTVDecoder_FuncsTable, (IBaseFilter **)&This);
|
&QTVDecoder_FuncsTable, (IBaseFilter **)&This);
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
@ -543,5 +535,5 @@ IUnknown * CALLBACK QTVDecoder_create(IUnknown * pUnkOuter, HRESULT* phr)
|
||||||
}
|
}
|
||||||
|
|
||||||
*phr = hr;
|
*phr = hr;
|
||||||
return (IUnknown*)This;
|
return &This->tf.filter.IUnknown_inner;
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ typedef struct TransformFilterFuncTable {
|
||||||
|
|
||||||
HRESULT WINAPI TransformFilterImpl_Notify(TransformFilter *iface, IBaseFilter *sender, Quality qm);
|
HRESULT WINAPI TransformFilterImpl_Notify(TransformFilter *iface, IBaseFilter *sender, Quality qm);
|
||||||
|
|
||||||
HRESULT strmbase_transform_create(LONG filter_size, const CLSID *clsid,
|
HRESULT strmbase_transform_create(LONG filter_size, IUnknown *outer, const CLSID *clsid,
|
||||||
const TransformFilterFuncTable *func_table, IBaseFilter **filter);
|
const TransformFilterFuncTable *func_table, IBaseFilter **filter);
|
||||||
|
|
||||||
/* Source Seeking */
|
/* Source Seeking */
|
||||||
|
|
Loading…
Reference in New Issue