strmbase: Standardize aggregation of the seeking passthrough object.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
00d5584280
commit
d30fd37176
|
@ -103,7 +103,7 @@ static void test_aggregation(void)
|
||||||
|
|
||||||
hr = ISeekingPassThru_QueryInterface(passthrough, &IID_IUnknown, (void **)&unk2);
|
hr = ISeekingPassThru_QueryInterface(passthrough, &IID_IUnknown, (void **)&unk2);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
todo_wine ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
|
ok(unk2 == (IUnknown *)0xdeadbeef, "Got unexpected IUnknown %p.\n", unk2);
|
||||||
|
|
||||||
hr = ISeekingPassThru_QueryInterface(passthrough, &IID_ISeekingPassThru, (void **)&passthrough2);
|
hr = ISeekingPassThru_QueryInterface(passthrough, &IID_ISeekingPassThru, (void **)&passthrough2);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
|
@ -119,8 +119,8 @@ static void test_aggregation(void)
|
||||||
|
|
||||||
ISeekingPassThru_Release(passthrough);
|
ISeekingPassThru_Release(passthrough);
|
||||||
ref = IUnknown_Release(unk);
|
ref = IUnknown_Release(unk);
|
||||||
todo_wine ok(!ref, "Got unexpected refcount %d.\n", ref);
|
ok(!ref, "Got unexpected refcount %d.\n", ref);
|
||||||
todo_wine ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
|
ok(outer_ref == 1, "Got unexpected refcount %d.\n", outer_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(passthrough)
|
START_TEST(passthrough)
|
||||||
|
|
|
@ -36,8 +36,6 @@ typedef struct PassThruImpl {
|
||||||
LONG ref;
|
LONG ref;
|
||||||
IUnknown * outer_unk;
|
IUnknown * outer_unk;
|
||||||
IPin * pin;
|
IPin * pin;
|
||||||
BOOL bUnkOuterValid;
|
|
||||||
BOOL bAggregatable;
|
|
||||||
BOOL renderer;
|
BOOL renderer;
|
||||||
CRITICAL_SECTION time_cs;
|
CRITICAL_SECTION time_cs;
|
||||||
BOOL timevalid;
|
BOOL timevalid;
|
||||||
|
@ -70,9 +68,6 @@ static HRESULT WINAPI SeekInner_QueryInterface(IUnknown * iface,
|
||||||
PassThruImpl *This = impl_from_IUnknown_inner(iface);
|
PassThruImpl *This = impl_from_IUnknown_inner(iface);
|
||||||
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
|
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
|
||||||
|
|
||||||
if (This->bAggregatable)
|
|
||||||
This->bUnkOuterValid = TRUE;
|
|
||||||
|
|
||||||
if (IsEqualGUID(&IID_IUnknown, riid))
|
if (IsEqualGUID(&IID_IUnknown, riid))
|
||||||
{
|
{
|
||||||
*ppvObj = &(This->IUnknown_inner);
|
*ppvObj = &(This->IUnknown_inner);
|
||||||
|
@ -127,74 +122,25 @@ static const IUnknownVtbl IInner_VTable =
|
||||||
SeekInner_Release
|
SeekInner_Release
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Generic functions for aggregation */
|
static HRESULT WINAPI SeekingPassThru_QueryInterface(ISeekingPassThru *iface, REFIID iid, void **out)
|
||||||
static HRESULT SeekOuter_QueryInterface(PassThruImpl *This, REFIID riid, LPVOID *ppv)
|
|
||||||
{
|
{
|
||||||
if (This->bAggregatable)
|
PassThruImpl *passthrough = impl_from_ISeekingPassThru(iface);
|
||||||
This->bUnkOuterValid = TRUE;
|
|
||||||
|
|
||||||
if (This->outer_unk)
|
return IUnknown_QueryInterface(passthrough->outer_unk, iid, out);
|
||||||
{
|
|
||||||
if (This->bAggregatable)
|
|
||||||
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
|
||||||
|
|
||||||
if (IsEqualIID(riid, &IID_IUnknown))
|
|
||||||
{
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
IUnknown_AddRef(&This->IUnknown_inner);
|
|
||||||
hr = IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppv);
|
|
||||||
IUnknown_Release(&This->IUnknown_inner);
|
|
||||||
This->bAggregatable = TRUE;
|
|
||||||
return hr;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ppv = NULL;
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppv);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG SeekOuter_AddRef(PassThruImpl *This)
|
|
||||||
{
|
|
||||||
if (This->outer_unk && This->bUnkOuterValid)
|
|
||||||
return IUnknown_AddRef(This->outer_unk);
|
|
||||||
return IUnknown_AddRef(&This->IUnknown_inner);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG SeekOuter_Release(PassThruImpl *This)
|
|
||||||
{
|
|
||||||
if (This->outer_unk && This->bUnkOuterValid)
|
|
||||||
return IUnknown_Release(This->outer_unk);
|
|
||||||
return IUnknown_Release(&This->IUnknown_inner);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI SeekingPassThru_QueryInterface(ISeekingPassThru *iface, REFIID riid, LPVOID *ppvObj)
|
|
||||||
{
|
|
||||||
PassThruImpl *This = impl_from_ISeekingPassThru(iface);
|
|
||||||
|
|
||||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
|
|
||||||
|
|
||||||
return SeekOuter_QueryInterface(This, riid, ppvObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI SeekingPassThru_AddRef(ISeekingPassThru *iface)
|
static ULONG WINAPI SeekingPassThru_AddRef(ISeekingPassThru *iface)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_ISeekingPassThru(iface);
|
PassThruImpl *passthrough = impl_from_ISeekingPassThru(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", This, iface);
|
return IUnknown_AddRef(passthrough->outer_unk);
|
||||||
|
|
||||||
return SeekOuter_AddRef(This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI SeekingPassThru_Release(ISeekingPassThru *iface)
|
static ULONG WINAPI SeekingPassThru_Release(ISeekingPassThru *iface)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_ISeekingPassThru(iface);
|
PassThruImpl *passthrough = impl_from_ISeekingPassThru(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", This, iface);
|
return IUnknown_Release(passthrough->outer_unk);
|
||||||
|
|
||||||
return SeekOuter_Release(This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SeekingPassThru_Init(ISeekingPassThru *iface, BOOL renderer, IPin *pin)
|
static HRESULT WINAPI SeekingPassThru_Init(ISeekingPassThru *iface, BOOL renderer, IPin *pin)
|
||||||
|
@ -246,9 +192,7 @@ HRESULT WINAPI PosPassThru_Construct(IUnknown *pUnkOuter, LPVOID *ppPassThru)
|
||||||
if (!fimpl)
|
if (!fimpl)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
fimpl->outer_unk = pUnkOuter;
|
fimpl->outer_unk = pUnkOuter ? pUnkOuter : &fimpl->IUnknown_inner;
|
||||||
fimpl->bUnkOuterValid = FALSE;
|
|
||||||
fimpl->bAggregatable = FALSE;
|
|
||||||
fimpl->IUnknown_inner.lpVtbl = &IInner_VTable;
|
fimpl->IUnknown_inner.lpVtbl = &IInner_VTable;
|
||||||
fimpl->ISeekingPassThru_iface.lpVtbl = &ISeekingPassThru_Vtbl;
|
fimpl->ISeekingPassThru_iface.lpVtbl = &ISeekingPassThru_Vtbl;
|
||||||
fimpl->IMediaSeeking_iface.lpVtbl = &IMediaSeekingPassThru_Vtbl;
|
fimpl->IMediaSeeking_iface.lpVtbl = &IMediaSeekingPassThru_Vtbl;
|
||||||
|
@ -261,31 +205,25 @@ HRESULT WINAPI PosPassThru_Construct(IUnknown *pUnkOuter, LPVOID *ppPassThru)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaSeekingPassThru_QueryInterface(IMediaSeeking *iface, REFIID riid, LPVOID *ppvObj)
|
static HRESULT WINAPI MediaSeekingPassThru_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_IMediaSeeking(iface);
|
PassThruImpl *passthrough = impl_from_IMediaSeeking(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
|
return IUnknown_QueryInterface(passthrough->outer_unk, iid, out);
|
||||||
|
|
||||||
return SeekOuter_QueryInterface(This, riid, ppvObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI MediaSeekingPassThru_AddRef(IMediaSeeking *iface)
|
static ULONG WINAPI MediaSeekingPassThru_AddRef(IMediaSeeking *iface)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_IMediaSeeking(iface);
|
PassThruImpl *passthrough = impl_from_IMediaSeeking(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", iface, This);
|
return IUnknown_AddRef(passthrough->outer_unk);
|
||||||
|
|
||||||
return SeekOuter_AddRef(This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI MediaSeekingPassThru_Release(IMediaSeeking *iface)
|
static ULONG WINAPI MediaSeekingPassThru_Release(IMediaSeeking *iface)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_IMediaSeeking(iface);
|
PassThruImpl *passthrough = impl_from_IMediaSeeking(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", iface, This);
|
return IUnknown_Release(passthrough->outer_unk);
|
||||||
|
|
||||||
return SeekOuter_Release(This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT get_connected(PassThruImpl *This, REFIID riid, LPVOID *ppvObj) {
|
static HRESULT get_connected(PassThruImpl *This, REFIID riid, LPVOID *ppvObj) {
|
||||||
|
@ -644,31 +582,25 @@ static const IMediaSeekingVtbl IMediaSeekingPassThru_Vtbl =
|
||||||
MediaSeekingPassThru_GetPreroll
|
MediaSeekingPassThru_GetPreroll
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT WINAPI MediaPositionPassThru_QueryInterface(IMediaPosition *iface, REFIID riid, LPVOID *ppvObj)
|
static HRESULT WINAPI MediaPositionPassThru_QueryInterface(IMediaPosition *iface, REFIID iid, void **out)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_IMediaPosition(iface);
|
PassThruImpl *passthrough = impl_from_IMediaPosition(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
|
return IUnknown_QueryInterface(passthrough->outer_unk, iid, out);
|
||||||
|
|
||||||
return SeekOuter_QueryInterface(This, riid, ppvObj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI MediaPositionPassThru_AddRef(IMediaPosition *iface)
|
static ULONG WINAPI MediaPositionPassThru_AddRef(IMediaPosition *iface)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_IMediaPosition(iface);
|
PassThruImpl *passthrough = impl_from_IMediaPosition(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", iface, This);
|
return IUnknown_AddRef(passthrough->outer_unk);
|
||||||
|
|
||||||
return SeekOuter_AddRef(This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI MediaPositionPassThru_Release(IMediaPosition *iface)
|
static ULONG WINAPI MediaPositionPassThru_Release(IMediaPosition *iface)
|
||||||
{
|
{
|
||||||
PassThruImpl *This = impl_from_IMediaPosition(iface);
|
PassThruImpl *passthrough = impl_from_IMediaPosition(iface);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", iface, This);
|
return IUnknown_Release(passthrough->outer_unk);
|
||||||
|
|
||||||
return SeekOuter_Release(This);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaPositionPassThru_GetTypeInfoCount(IMediaPosition *iface, UINT *count)
|
static HRESULT WINAPI MediaPositionPassThru_GetTypeInfoCount(IMediaPosition *iface, UINT *count)
|
||||||
|
|
Loading…
Reference in New Issue