Commit 444c6a16 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

evr: Use strmbase filter aggregation support.

parent 664789ce
......@@ -35,148 +35,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(evr);
typedef struct
{
BaseFilter filter;
IUnknown IUnknown_inner;
} evr_filter;
static inline evr_filter *impl_from_inner_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, evr_filter, IUnknown_inner);
}
static HRESULT WINAPI inner_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
evr_filter *This = impl_from_inner_IUnknown(iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown))
*ppv = &This->IUnknown_inner;
else if (IsEqualIID(riid, &IID_IAMCertifiedOutputProtection))
FIXME("No interface for IID_IAMCertifiedOutputProtection\n");
else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
FIXME("No interface for IID_IAMFilterMiscFlags\n");
else if (IsEqualIID(riid, &IID_IBaseFilter))
*ppv =&This->filter.IBaseFilter_iface;
else if (IsEqualIID(riid, &IID_IMediaFilter))
*ppv =&This->filter.IBaseFilter_iface;
else if (IsEqualIID(riid, &IID_IPersist))
*ppv =&This->filter.IBaseFilter_iface;
else if (IsEqualIID(riid, &IID_IKsPropertySet))
FIXME("No interface for IID_IKsPropertySet\n");
else if (IsEqualIID(riid, &IID_IMediaEventSink))
FIXME("No interface for IID_IMediaEventSink\n");
else if (IsEqualIID(riid, &IID_IMediaSeeking))
FIXME("No interface for IID_IMediaSeeking\n");
else if (IsEqualIID(riid, &IID_IQualityControl))
FIXME("No interface for IID_IQualityControl\n");
else if (IsEqualIID(riid, &IID_IQualProp))
FIXME("No interface for IID_IQualProp\n");
else if (IsEqualIID(riid, &IID_IEVRFilterConfig))
FIXME("No interface for IID_IEVRFilterConfig\n");
else if (IsEqualIID(riid, &IID_IMFGetService))
FIXME("No interface for IID_IMFGetService\n");
else if (IsEqualIID(riid, &IID_IMFVideoPositionMapper))
FIXME("No interface for IID_IMFVideoPositionMapper\n");
else if (IsEqualIID(riid, &IID_IMFVideoRenderer))
FIXME("No interface for IID_IMFVideoRenderer\n");
else if (IsEqualIID(riid, &IID_IMemInputPin))
FIXME("No interface for IID_IMemInputPin\n");
else if (IsEqualIID(riid, &IID_IPin))
FIXME("No interface for IID_IPin\n");
else if (IsEqualIID(riid, &IID_IQualityControl))
FIXME("No interface for IID_IQualityControl\n");
else if (IsEqualIID(riid, &IID_IDirectXVideoMemoryConfiguration))
FIXME("No interface for IID_IDirectXVideoMemoryConfiguration\n");
if (*ppv)
{
IUnknown_AddRef((IUnknown *)(*ppv));
return S_OK;
}
FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
static ULONG WINAPI inner_AddRef(IUnknown *iface)
{
evr_filter *This = impl_from_inner_IUnknown(iface);
ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface);
TRACE("(%p, %p)->(): new ref %d\n", iface, This, ref);
return ref;
}
static ULONG WINAPI inner_Release(IUnknown *iface)
{
evr_filter *This = impl_from_inner_IUnknown(iface);
ULONG ref = InterlockedDecrement(&This->filter.refcount);
TRACE("(%p, %p)->(): new ref %d\n", iface, This, ref);
if (!ref)
{
strmbase_filter_cleanup(&This->filter);
CoTaskMemFree(This);
}
return ref;
}
static const IUnknownVtbl evr_inner_vtbl =
{
inner_QueryInterface,
inner_AddRef,
inner_Release
};
static inline evr_filter *impl_from_IBaseFilter(IBaseFilter *iface)
{
return CONTAINING_RECORD(iface, evr_filter, filter);
}
static HRESULT WINAPI filter_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppv)
{
evr_filter *This = impl_from_IBaseFilter(iface);
return IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppv);
}
static ULONG WINAPI filter_AddRef(IBaseFilter *iface)
{
evr_filter *This = impl_from_IBaseFilter(iface);
LONG ret;
ret = IUnknown_AddRef(&This->IUnknown_inner);
TRACE("(%p)->AddRef from %d\n", iface, ret - 1);
return ret;
}
static ULONG WINAPI filter_Release(IBaseFilter *iface)
{
evr_filter *This = impl_from_IBaseFilter(iface);
LONG ret;
ret = IUnknown_Release(&This->IUnknown_inner);
TRACE("(%p)->Release from %d\n", iface, ret + 1);
return ret;
}
static const IBaseFilterVtbl basefilter_vtbl =
{
filter_QueryInterface,
filter_AddRef,
filter_Release,
BaseFilterImpl_QueryInterface,
BaseFilterImpl_AddRef,
BaseFilterImpl_Release,
BaseFilterImpl_GetClassID,
BaseRendererImpl_Stop,
BaseRendererImpl_Pause,
......@@ -191,41 +56,45 @@ static const IBaseFilterVtbl basefilter_vtbl =
BaseFilterImpl_QueryVendorInfo
};
static inline evr_filter *impl_from_BaseFilter(BaseFilter *iface)
{
return CONTAINING_RECORD(iface, evr_filter, filter);
}
static IPin *evr_get_pin(BaseFilter *iface, unsigned int index)
{
FIXME("iface %p, index %u, stub!\n", iface, index);
return NULL;
}
static void evr_destroy(BaseFilter *iface)
{
evr_filter *filter = impl_from_BaseFilter(iface);
strmbase_filter_cleanup(&filter->filter);
CoTaskMemFree(filter);
}
static const BaseFilterFuncTable basefilter_functable =
{
.filter_get_pin = evr_get_pin,
.filter_destroy = evr_destroy,
};
HRESULT evr_filter_create(IUnknown *outer_unk, void **ppv)
HRESULT evr_filter_create(IUnknown *outer, void **out)
{
evr_filter *object;
TRACE("(%p, %p)\n", outer_unk, ppv);
*ppv = NULL;
if(outer_unk != NULL)
{
FIXME("Aggregation yet unsupported!\n");
return E_NOINTERFACE;
}
*out = NULL;
object = CoTaskMemAlloc(sizeof(evr_filter));
if (!object)
return E_OUTOFMEMORY;
strmbase_filter_init(&object->filter, &basefilter_vtbl, NULL, &CLSID_EnhancedVideoRenderer,
strmbase_filter_init(&object->filter, &basefilter_vtbl, outer, &CLSID_EnhancedVideoRenderer,
(DWORD_PTR)(__FILE__ ": EVR.csFilter"), &basefilter_functable);
object->IUnknown_inner.lpVtbl = &evr_inner_vtbl;
*ppv = &object->IUnknown_inner;
*out = &object->filter.IUnknown_inner;
return S_OK;
}
......@@ -91,8 +91,7 @@ static void test_aggregation(void)
hr = CoCreateInstance(&CLSID_EnhancedVideoRenderer, &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);
......
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