dmcompos: Use the generic IPersistStream for DMSignPostTrack.
This commit is contained in:
parent
61343bdce6
commit
3e62435989
|
@ -78,17 +78,9 @@ typedef struct {
|
||||||
} guid_info;
|
} guid_info;
|
||||||
|
|
||||||
/* used for initialising structs (primarily for DMUS_OBJECTDESC) */
|
/* used for initialising structs (primarily for DMUS_OBJECTDESC) */
|
||||||
#define DM_STRUCT_INIT(x) \
|
|
||||||
do { \
|
|
||||||
memset((x), 0, sizeof(*(x))); \
|
|
||||||
(x)->dwSize = sizeof(*x); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define FE(x) { x, #x }
|
#define FE(x) { x, #x }
|
||||||
#define GE(x) { &x, #x }
|
#define GE(x) { &x, #x }
|
||||||
|
|
||||||
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
|
|
||||||
|
|
||||||
/* FOURCC to string conversion for debug messages */
|
/* FOURCC to string conversion for debug messages */
|
||||||
extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
|
extern const char *debugstr_fourcc (DWORD fourcc) DECLSPEC_HIDDEN;
|
||||||
/* returns name of given GUID */
|
/* returns name of given GUID */
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dmcompos_private.h"
|
#include "dmcompos_private.h"
|
||||||
|
#include "dmobject.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
|
WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
|
||||||
|
|
||||||
|
@ -26,9 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmcompos);
|
||||||
*/
|
*/
|
||||||
typedef struct IDirectMusicSignPostTrack {
|
typedef struct IDirectMusicSignPostTrack {
|
||||||
IDirectMusicTrack8 IDirectMusicTrack8_iface;
|
IDirectMusicTrack8 IDirectMusicTrack8_iface;
|
||||||
const IPersistStreamVtbl *PersistStreamVtbl;
|
struct dmobject dmobj; /* IPersistStream only */
|
||||||
LONG ref;
|
LONG ref;
|
||||||
DMUS_OBJECTDESC *pDesc;
|
|
||||||
} IDirectMusicSignPostTrack;
|
} IDirectMusicSignPostTrack;
|
||||||
|
|
||||||
/* IDirectMusicSignPostTrack IDirectMusicTrack8 part: */
|
/* IDirectMusicSignPostTrack IDirectMusicTrack8 part: */
|
||||||
|
@ -50,7 +50,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *
|
||||||
IsEqualIID(riid, &IID_IDirectMusicTrack8))
|
IsEqualIID(riid, &IID_IDirectMusicTrack8))
|
||||||
*ret_iface = iface;
|
*ret_iface = iface;
|
||||||
else if (IsEqualIID(riid, &IID_IPersistStream))
|
else if (IsEqualIID(riid, &IID_IPersistStream))
|
||||||
*ret_iface = &This->PersistStreamVtbl;
|
*ret_iface = &This->dmobj.IPersistStream_iface;
|
||||||
else {
|
else {
|
||||||
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
|
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -238,54 +238,33 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
|
||||||
IDirectMusicTrack8Impl_Join
|
IDirectMusicTrack8Impl_Join
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IDirectMusicSignPostTrack IPersistStream part: */
|
static inline IDirectMusicSignPostTrack * impl_from_IPersistStream(IPersistStream *iface)
|
||||||
static HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
|
{
|
||||||
ICOM_THIS_MULTI(IDirectMusicSignPostTrack, PersistStreamVtbl, iface);
|
return CONTAINING_RECORD(iface, IDirectMusicSignPostTrack, dmobj.IPersistStream_iface);
|
||||||
return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicSignPostTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
|
static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm)
|
||||||
ICOM_THIS_MULTI(IDirectMusicSignPostTrack, PersistStreamVtbl, iface);
|
{
|
||||||
return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface);
|
IDirectMusicSignPostTrack *This = impl_from_IPersistStream(iface);
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicSignPostTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicSignPostTrack, PersistStreamVtbl, iface);
|
|
||||||
return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicSignPostTrack, PersistStreamVtbl, iface);
|
|
||||||
FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
|
FIXME("(%p, %p): Loading not implemented yet\n", This, pStm);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
|
static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
|
||||||
return E_NOTIMPL;
|
BOOL cleardirty)
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const IPersistStreamVtbl DirectMusicSignPostTrack_PersistStream_Vtbl =
|
|
||||||
{
|
{
|
||||||
IDirectMusicSignPostTrack_IPersistStream_QueryInterface,
|
return E_NOTIMPL;
|
||||||
IDirectMusicSignPostTrack_IPersistStream_AddRef,
|
}
|
||||||
IDirectMusicSignPostTrack_IPersistStream_Release,
|
|
||||||
IDirectMusicSignPostTrack_IPersistStream_GetClassID,
|
static const IPersistStreamVtbl persiststream_vtbl = {
|
||||||
IDirectMusicSignPostTrack_IPersistStream_IsDirty,
|
dmobj_IPersistStream_QueryInterface,
|
||||||
IDirectMusicSignPostTrack_IPersistStream_Load,
|
dmobj_IPersistStream_AddRef,
|
||||||
IDirectMusicSignPostTrack_IPersistStream_Save,
|
dmobj_IPersistStream_Release,
|
||||||
IDirectMusicSignPostTrack_IPersistStream_GetSizeMax
|
dmobj_IPersistStream_GetClassID,
|
||||||
|
unimpl_IPersistStream_IsDirty,
|
||||||
|
IPersistStreamImpl_Load,
|
||||||
|
IPersistStreamImpl_Save,
|
||||||
|
unimpl_IPersistStream_GetSizeMax
|
||||||
};
|
};
|
||||||
|
|
||||||
/* for ClassFactory */
|
/* for ClassFactory */
|
||||||
|
@ -300,12 +279,10 @@ HRESULT WINAPI create_dmsignposttrack(REFIID lpcGUID, void **ppobj)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
|
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
|
||||||
track->PersistStreamVtbl = &DirectMusicSignPostTrack_PersistStream_Vtbl;
|
|
||||||
track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
|
|
||||||
DM_STRUCT_INIT(track->pDesc);
|
|
||||||
track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
|
|
||||||
track->pDesc->guidClass = CLSID_DirectMusicSignPostTrack;
|
|
||||||
track->ref = 1;
|
track->ref = 1;
|
||||||
|
dmobject_init(&track->dmobj, &CLSID_DirectMusicSignPostTrack,
|
||||||
|
(IUnknown *)&track->IDirectMusicTrack8_iface);
|
||||||
|
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
|
||||||
|
|
||||||
DMCOMPOS_LockModule();
|
DMCOMPOS_LockModule();
|
||||||
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
|
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
|
||||||
|
|
|
@ -383,15 +383,15 @@ static void test_signposttrack(void)
|
||||||
hr = IDirectMusicTrack8_QueryInterface(dmt8, &IID_IPersistStream, (void**)&ps);
|
hr = IDirectMusicTrack8_QueryInterface(dmt8, &IID_IPersistStream, (void**)&ps);
|
||||||
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr);
|
||||||
hr = IPersistStream_GetClassID(ps, &class);
|
hr = IPersistStream_GetClassID(ps, &class);
|
||||||
todo_wine ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
||||||
todo_wine ok(IsEqualGUID(&class, &CLSID_DirectMusicSignPostTrack),
|
ok(IsEqualGUID(&class, &CLSID_DirectMusicSignPostTrack),
|
||||||
"Expected class CLSID_DirectMusicSignPostTrack got %s\n", wine_dbgstr_guid(&class));
|
"Expected class CLSID_DirectMusicSignPostTrack got %s\n", wine_dbgstr_guid(&class));
|
||||||
hr = IPersistStream_Save(ps, NULL, TRUE);
|
hr = IPersistStream_Save(ps, NULL, TRUE);
|
||||||
todo_wine ok(hr == E_POINTER, "IPersistStream_Save failed: %08x\n", hr);
|
todo_wine ok(hr == E_POINTER, "IPersistStream_Save failed: %08x\n", hr);
|
||||||
|
|
||||||
/* Unimplemented IPersistStream methods */
|
/* Unimplemented IPersistStream methods */
|
||||||
hr = IPersistStream_IsDirty(ps);
|
hr = IPersistStream_IsDirty(ps);
|
||||||
todo_wine ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
||||||
hr = IPersistStream_GetSizeMax(ps, &size);
|
hr = IPersistStream_GetSizeMax(ps, &size);
|
||||||
ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
|
ok(hr == E_NOTIMPL, "IPersistStream_GetSizeMax failed: %08x\n", hr);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue