dsound: Add COM aggregation to DirectSound for internal use.
This commit is contained in:
parent
bd4c67396b
commit
9cb53818e8
|
@ -42,8 +42,9 @@
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||||
|
|
||||||
typedef struct IDirectSoundImpl {
|
typedef struct IDirectSoundImpl {
|
||||||
IUnknown IUnknown_iface; /* Separate refcount, not for COM aggregation */
|
IUnknown IUnknown_inner;
|
||||||
IDirectSound8 IDirectSound8_iface;
|
IDirectSound8 IDirectSound8_iface;
|
||||||
|
IUnknown *outer_unk; /* internal */
|
||||||
LONG ref, refds, numIfaces;
|
LONG ref, refds, numIfaces;
|
||||||
DirectSoundDevice *device;
|
DirectSoundDevice *device;
|
||||||
BOOL has_ds8;
|
BOOL has_ds8;
|
||||||
|
@ -129,7 +130,7 @@ static void directsound_destroy(IDirectSoundImpl *This)
|
||||||
*/
|
*/
|
||||||
static inline IDirectSoundImpl *impl_from_IUnknown(IUnknown *iface)
|
static inline IDirectSoundImpl *impl_from_IUnknown(IUnknown *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, IDirectSoundImpl, IUnknown_iface);
|
return CONTAINING_RECORD(iface, IDirectSoundImpl, IUnknown_inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
||||||
|
@ -145,7 +146,7 @@ static HRESULT WINAPI IUnknownImpl_QueryInterface(IUnknown *iface, REFIID riid,
|
||||||
*ppv = NULL;
|
*ppv = NULL;
|
||||||
|
|
||||||
if (IsEqualIID(riid, &IID_IUnknown))
|
if (IsEqualIID(riid, &IID_IUnknown))
|
||||||
*ppv = &This->IUnknown_iface;
|
*ppv = &This->IUnknown_inner;
|
||||||
else if (IsEqualIID(riid, &IID_IDirectSound) ||
|
else if (IsEqualIID(riid, &IID_IDirectSound) ||
|
||||||
(IsEqualIID(riid, &IID_IDirectSound8) && This->has_ds8))
|
(IsEqualIID(riid, &IID_IDirectSound8) && This->has_ds8))
|
||||||
*ppv = &This->IDirectSound8_iface;
|
*ppv = &This->IDirectSound8_iface;
|
||||||
|
@ -204,7 +205,7 @@ static HRESULT WINAPI IDirectSound8Impl_QueryInterface(IDirectSound8 *iface, REF
|
||||||
{
|
{
|
||||||
IDirectSoundImpl *This = impl_from_IDirectSound8(iface);
|
IDirectSoundImpl *This = impl_from_IDirectSound8(iface);
|
||||||
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
|
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppv);
|
||||||
return IUnknown_QueryInterface(&This->IUnknown_iface, riid, ppv);
|
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirectSound8Impl_AddRef(IDirectSound8 *iface)
|
static ULONG WINAPI IDirectSound8Impl_AddRef(IDirectSound8 *iface)
|
||||||
|
@ -317,7 +318,7 @@ static const IDirectSound8Vtbl ds8_vtbl =
|
||||||
IDirectSound8Impl_VerifyCertification
|
IDirectSound8Impl_VerifyCertification
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT IDirectSoundImpl_Create(REFIID riid, void **ppv, BOOL has_ds8)
|
HRESULT IDirectSoundImpl_Create(IUnknown *outer_unk, REFIID riid, void **ppv, BOOL has_ds8)
|
||||||
{
|
{
|
||||||
IDirectSoundImpl *obj;
|
IDirectSoundImpl *obj;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -333,7 +334,7 @@ static HRESULT IDirectSoundImpl_Create(REFIID riid, void **ppv, BOOL has_ds8)
|
||||||
|
|
||||||
setup_dsound_options();
|
setup_dsound_options();
|
||||||
|
|
||||||
obj->IUnknown_iface.lpVtbl = &unk_vtbl;
|
obj->IUnknown_inner.lpVtbl = &unk_vtbl;
|
||||||
obj->IDirectSound8_iface.lpVtbl = &ds8_vtbl;
|
obj->IDirectSound8_iface.lpVtbl = &ds8_vtbl;
|
||||||
obj->ref = 1;
|
obj->ref = 1;
|
||||||
obj->refds = 0;
|
obj->refds = 0;
|
||||||
|
@ -341,20 +342,26 @@ static HRESULT IDirectSoundImpl_Create(REFIID riid, void **ppv, BOOL has_ds8)
|
||||||
obj->device = NULL;
|
obj->device = NULL;
|
||||||
obj->has_ds8 = has_ds8;
|
obj->has_ds8 = has_ds8;
|
||||||
|
|
||||||
hr = IUnknown_QueryInterface(&obj->IUnknown_iface, riid, ppv);
|
/* COM aggregation supported only internally */
|
||||||
IUnknown_Release(&obj->IUnknown_iface);
|
if (outer_unk)
|
||||||
|
obj->outer_unk = outer_unk;
|
||||||
|
else
|
||||||
|
obj->outer_unk = &obj->IUnknown_inner;
|
||||||
|
|
||||||
|
hr = IUnknown_QueryInterface(&obj->IUnknown_inner, riid, ppv);
|
||||||
|
IUnknown_Release(&obj->IUnknown_inner);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT DSOUND_Create(REFIID riid, void **ppv)
|
HRESULT DSOUND_Create(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
return IDirectSoundImpl_Create(riid, ppv, FALSE);
|
return IDirectSoundImpl_Create(NULL, riid, ppv, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT DSOUND_Create8(REFIID riid, void **ppv)
|
HRESULT DSOUND_Create8(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
return IDirectSoundImpl_Create(riid, ppv, TRUE);
|
return IDirectSoundImpl_Create(NULL, riid, ppv, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -263,6 +263,7 @@ HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, IKsPropertySet **piks) DEC
|
||||||
|
|
||||||
HRESULT DSOUND_Create(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
HRESULT DSOUND_Create(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
||||||
HRESULT DSOUND_Create8(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
HRESULT DSOUND_Create8(REFIID riid, void **ppv) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT IDirectSoundImpl_Create(IUnknown *outer_unk, REFIID riid, void **ppv, BOOL has_ds8) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/* primary.c */
|
/* primary.c */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue