dmstyle: Use the generic IPersistStream for DMStyleTrack.
This commit is contained in:
parent
f143c16bb8
commit
2026a21525
|
@ -27,8 +27,6 @@ typedef struct _DMUS_PRIVATE_CHUNK {
|
||||||
DWORD dwSize; /* size of the chunk */
|
DWORD dwSize; /* size of the chunk */
|
||||||
} DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
|
} DMUS_PRIVATE_CHUNK, *LPDMUS_PRIVATE_CHUNK;
|
||||||
|
|
||||||
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parsing utilities
|
* Parsing utilities
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dmstyle_private.h"
|
#include "dmstyle_private.h"
|
||||||
|
#include "dmobject.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
|
WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
|
||||||
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
|
WINE_DECLARE_DEBUG_CHANNEL(dmfile);
|
||||||
|
@ -27,9 +28,8 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile);
|
||||||
*/
|
*/
|
||||||
typedef struct IDirectMusicStyleTrack {
|
typedef struct IDirectMusicStyleTrack {
|
||||||
IDirectMusicTrack8 IDirectMusicTrack8_iface;
|
IDirectMusicTrack8 IDirectMusicTrack8_iface;
|
||||||
const IPersistStreamVtbl *PersistStreamVtbl;
|
struct dmobject dmobj; /* IPersistStream only */
|
||||||
LONG ref;
|
LONG ref;
|
||||||
DMUS_OBJECTDESC *pDesc;
|
|
||||||
struct list Items;
|
struct list Items;
|
||||||
} IDirectMusicStyleTrack;
|
} IDirectMusicStyleTrack;
|
||||||
|
|
||||||
|
@ -52,7 +52,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;
|
||||||
|
@ -250,35 +250,6 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
|
||||||
IDirectMusicTrack8Impl_Join
|
IDirectMusicTrack8Impl_Join
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IDirectMusicStyleTrack IPersistStream part: */
|
|
||||||
static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
|
||||||
return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicStyleTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
|
||||||
return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicStyleTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
|
||||||
return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
|
||||||
TRACE("(%p, %p)\n", This, pClassID);
|
|
||||||
*pClassID = CLSID_DirectMusicStyleTrack;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
|
||||||
FIXME("(%p): stub, always S_FALSE\n", This);
|
|
||||||
return S_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK *pChunk,
|
static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK *pChunk,
|
||||||
IStream *pStm)
|
IStream *pStm)
|
||||||
{
|
{
|
||||||
|
@ -326,7 +297,7 @@ static HRESULT parse_style_ref(IDirectMusicStyleTrack *This, DMUS_PRIVATE_CHUNK
|
||||||
*/
|
*/
|
||||||
case DMUS_FOURCC_REF_LIST: {
|
case DMUS_FOURCC_REF_LIST: {
|
||||||
FIXME_(dmfile)(": DMRF (DM References) list, not yet handled\n");
|
FIXME_(dmfile)(": DMRF (DM References) list, not yet handled\n");
|
||||||
hr = IDirectMusicUtils_IPersistStream_ParseReference((IPersistStream*)&This->PersistStreamVtbl,
|
hr = IDirectMusicUtils_IPersistStream_ParseReference(&This->dmobj.IPersistStream_iface,
|
||||||
&Chunk, pStm, &pObject);
|
&Chunk, pStm, &pObject);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
ERR(": could not load Reference\n");
|
ERR(": could not load Reference\n");
|
||||||
|
@ -418,9 +389,14 @@ static HRESULT parse_styletrack_list(IDirectMusicStyleTrack *This, DMUS_PRIVATE_
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
|
static inline IDirectMusicStyleTrack *impl_from_IPersistStream(IPersistStream *iface)
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
{
|
||||||
|
return CONTAINING_RECORD(iface, IDirectMusicStyleTrack, dmobj.IPersistStream_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm)
|
||||||
|
{
|
||||||
|
IDirectMusicStyleTrack *This = impl_from_IPersistStream(iface);
|
||||||
DMUS_PRIVATE_CHUNK Chunk;
|
DMUS_PRIVATE_CHUNK Chunk;
|
||||||
LARGE_INTEGER liMove;
|
LARGE_INTEGER liMove;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -461,27 +437,15 @@ static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Load (LPPERSISTSTREA
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
|
static const IPersistStreamVtbl persiststream_vtbl = {
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
dmobj_IPersistStream_QueryInterface,
|
||||||
FIXME("(%p): Saving not implemented yet\n", This);
|
dmobj_IPersistStream_AddRef,
|
||||||
return E_NOTIMPL;
|
dmobj_IPersistStream_Release,
|
||||||
}
|
dmobj_IPersistStream_GetClassID,
|
||||||
|
unimpl_IPersistStream_IsDirty,
|
||||||
static HRESULT WINAPI IDirectMusicStyleTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
|
IPersistStreamImpl_Load,
|
||||||
ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);
|
unimpl_IPersistStream_Save,
|
||||||
FIXME("(%p, %p): stub\n", This, pcbSize);
|
unimpl_IPersistStream_GetSizeMax
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const IPersistStreamVtbl DirectMusicStyleTrack_PersistStream_Vtbl = {
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_QueryInterface,
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_AddRef,
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_Release,
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_GetClassID,
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_IsDirty,
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_Load,
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_Save,
|
|
||||||
IDirectMusicStyleTrack_IPersistStream_GetSizeMax
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* for ClassFactory */
|
/* for ClassFactory */
|
||||||
|
@ -496,12 +460,10 @@ HRESULT WINAPI create_dmstyletrack(REFIID lpcGUID, void **ppobj)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
|
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
|
||||||
track->PersistStreamVtbl = &DirectMusicStyleTrack_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_DirectMusicStyleTrack;
|
|
||||||
track->ref = 1;
|
track->ref = 1;
|
||||||
|
dmobject_init(&track->dmobj, &CLSID_DirectMusicStyleTrack,
|
||||||
|
(IUnknown *)&track->IDirectMusicTrack8_iface);
|
||||||
|
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
|
||||||
list_init (&track->Items);
|
list_init (&track->Items);
|
||||||
|
|
||||||
DMSTYLE_LockModule();
|
DMSTYLE_LockModule();
|
||||||
|
|
Loading…
Reference in New Issue