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:
Zebediah Figura 2019-06-06 11:22:53 -04:00 committed by Alexandre Julliard
parent 0d0f1e0ff7
commit f500b1dc19
8 changed files with 22 additions and 43 deletions

View File

@ -375,25 +375,20 @@ static const TransformFilterFuncTable ACMWrapper_FuncsTable = {
NULL
};
HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
HRESULT ACMWrapper_create(IUnknown *outer, void **out)
{
HRESULT hr;
ACMWrapperImpl* This;
TRACE("(%p, %p)\n", pUnkOuter, ppv);
*out = NULL;
*ppv = NULL;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
hr = strmbase_transform_create(sizeof(ACMWrapperImpl), &CLSID_ACMWrapper,
hr = strmbase_transform_create(sizeof(ACMWrapperImpl), outer, &CLSID_ACMWrapper,
&ACMWrapper_FuncsTable, (IBaseFilter **)&This);
if (FAILED(hr))
return hr;
*ppv = &This->tf.filter.IBaseFilter_iface;
*out = &This->tf.filter.IUnknown_inner;
This->lasttime_real = This->lasttime_sent = -1;
return hr;

View File

@ -390,19 +390,14 @@ static const TransformFilterFuncTable AVIDec_FuncsTable = {
AVIDec_NotifyDrop
};
HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
HRESULT AVIDec_create(IUnknown *outer, void **out)
{
HRESULT hr;
AVIDecImpl * This;
TRACE("(%p, %p)\n", pUnkOuter, ppv);
*out = NULL;
*ppv = NULL;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
hr = strmbase_transform_create(sizeof(AVIDecImpl), &CLSID_AVIDec,
hr = strmbase_transform_create(sizeof(AVIDecImpl), outer, &CLSID_AVIDec,
&AVIDec_FuncsTable, (IBaseFilter **)&This);
if (FAILED(hr))
@ -412,7 +407,7 @@ HRESULT AVIDec_create(IUnknown * pUnkOuter, LPVOID * ppv)
This->pBihIn = NULL;
This->pBihOut = NULL;
*ppv = &This->tf.filter.IBaseFilter_iface;
*out = &This->tf.filter.IUnknown_inner;
return hr;
}

View File

@ -158,8 +158,7 @@ static void test_aggregation(void)
hr = CoCreateInstance(&CLSID_ACMWrapper, &test_outer, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&unk);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
if (FAILED(hr)) return;
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
ref = get_refcount(unk);

View File

@ -183,8 +183,7 @@ static void test_aggregation(void)
hr = CoCreateInstance(&CLSID_AVIDec, &test_outer, CLSCTX_INPROC_SERVER,
&IID_IUnknown, (void **)&unk);
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
if (FAILED(hr)) return;
ok(hr == S_OK, "Got hr %#x.\n", hr);
ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
ok(unk != &test_outer, "Returned IUnknown should not be outer IUnknown.\n");
ref = get_refcount(unk);

View File

@ -281,14 +281,14 @@ static const IBaseFilterVtbl transform_vtbl =
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)
{
HRESULT hr;
PIN_INFO piInput;
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);
InitializeCriticalSection(&filter->csReceive);
@ -349,7 +349,7 @@ static HRESULT strmbase_transform_init(const CLSID *clsid,
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)
{
TransformFilter* pTf;
@ -365,7 +365,7 @@ HRESULT strmbase_transform_create(LONG filter_size, const CLSID *pClsid,
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;
return S_OK;

View File

@ -489,17 +489,16 @@ static HRESULT WINAPI Gstreamer_transform_QOS(TransformFilter *iface, IBaseFilte
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;
TRACE("%p, %p, %p, %p, %p\n", punkouter, clsid, name, vtbl, obj);
if (FAILED(strmbase_transform_create(sizeof(GstTfImpl), clsid, vtbl, (IBaseFilter **)&This)))
if (FAILED(strmbase_transform_create(sizeof(GstTfImpl), outer, clsid, vtbl, (IBaseFilter **)&This)))
return E_OUTOFMEMORY;
This->gstreamer_name = name;
*obj = This;
*obj = &This->tf.filter.IUnknown_inner;
TRACE("returning %p\n", This);

View File

@ -518,22 +518,14 @@ static const TransformFilterFuncTable QTVDecoder_FuncsTable = {
NULL
};
IUnknown * CALLBACK QTVDecoder_create(IUnknown * pUnkOuter, HRESULT* phr)
IUnknown * CALLBACK QTVDecoder_create(IUnknown *outer, HRESULT* phr)
{
HRESULT hr;
QTVDecoderImpl * This;
TRACE("(%p, %p)\n", pUnkOuter, phr);
*phr = S_OK;
if (pUnkOuter)
{
*phr = CLASS_E_NOAGGREGATION;
return NULL;
}
hr = strmbase_transform_create(sizeof(QTVDecoderImpl), &CLSID_QTVDecoder,
hr = strmbase_transform_create(sizeof(QTVDecoderImpl), outer, &CLSID_QTVDecoder,
&QTVDecoder_FuncsTable, (IBaseFilter **)&This);
if (FAILED(hr))
@ -543,5 +535,5 @@ IUnknown * CALLBACK QTVDecoder_create(IUnknown * pUnkOuter, HRESULT* phr)
}
*phr = hr;
return (IUnknown*)This;
return &This->tf.filter.IUnknown_inner;
}

View File

@ -249,7 +249,7 @@ typedef struct TransformFilterFuncTable {
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);
/* Source Seeking */