dmime: Use the generic IPersistStream for DMTimeSigTrack.

This commit is contained in:
Michael Stefaniuc 2015-07-02 11:53:27 +02:00 committed by Alexandre Julliard
parent ad81735d05
commit 7123c74532
2 changed files with 18 additions and 51 deletions

View File

@ -501,7 +501,7 @@ static void test_track(void)
{ X(DirectMusicSeqTrack), TRUE }, { X(DirectMusicSeqTrack), TRUE },
{ X(DirectMusicSysExTrack), TRUE }, { X(DirectMusicSysExTrack), TRUE },
{ X(DirectMusicTempoTrack), FALSE }, { X(DirectMusicTempoTrack), FALSE },
{ X(DirectMusicTimeSigTrack), TRUE }, { X(DirectMusicTimeSigTrack), FALSE },
{ X(DirectMusicWaveTrack), TRUE } { X(DirectMusicWaveTrack), TRUE }
}; };
#undef X #undef X

View File

@ -18,6 +18,7 @@
*/ */
#include "dmime_private.h" #include "dmime_private.h"
#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmime); WINE_DEFAULT_DEBUG_CHANNEL(dmime);
@ -26,9 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmime);
*/ */
typedef struct IDirectMusicTimeSigTrack { typedef struct IDirectMusicTimeSigTrack {
IDirectMusicTrack IDirectMusicTrack_iface; IDirectMusicTrack IDirectMusicTrack_iface;
const IPersistStreamVtbl *PersistStreamVtbl; struct dmobject dmobj; /* IPersistStream only */
LONG ref; LONG ref;
DMUS_OBJECTDESC *pDesc;
} IDirectMusicTimeSigTrack; } IDirectMusicTimeSigTrack;
/* IDirectMusicTimeSigTrack IDirectMusicTrack8 part: */ /* IDirectMusicTimeSigTrack IDirectMusicTrack8 part: */
@ -49,7 +49,7 @@ static HRESULT WINAPI IDirectMusicTrackImpl_QueryInterface(IDirectMusicTrack *if
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack))
*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;
@ -189,52 +189,21 @@ static const IDirectMusicTrackVtbl dmtack_vtbl = {
IDirectMusicTrackImpl_Clone IDirectMusicTrackImpl_Clone
}; };
/* IDirectMusicTimeSigTrack IPersistStream part: */ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
static HRESULT WINAPI IDirectMusicTimeSigTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { {
ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack_QueryInterface(&This->IDirectMusicTrack_iface, riid, ppobj);
}
static ULONG WINAPI IDirectMusicTimeSigTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack_AddRef(&This->IDirectMusicTrack_iface);
}
static ULONG WINAPI IDirectMusicTimeSigTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack_Release(&This->IDirectMusicTrack_iface);
}
static HRESULT WINAPI IDirectMusicTimeSigTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicTimeSigTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicTimeSigTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
FIXME(": Loading not implemented yet\n"); FIXME(": Loading not implemented yet\n");
return S_OK; return S_OK;
} }
static HRESULT WINAPI IDirectMusicTimeSigTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { static const IPersistStreamVtbl persiststream_vtbl = {
return E_NOTIMPL; dmobj_IPersistStream_QueryInterface,
} dmobj_IPersistStream_AddRef,
dmobj_IPersistStream_Release,
static HRESULT WINAPI IDirectMusicTimeSigTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { dmobj_IPersistStream_GetClassID,
return E_NOTIMPL; unimpl_IPersistStream_IsDirty,
} IPersistStreamImpl_Load,
unimpl_IPersistStream_Save,
static const IPersistStreamVtbl DirectMusicTimeSigTrack_PersistStream_Vtbl = { unimpl_IPersistStream_GetSizeMax
IDirectMusicTimeSigTrack_IPersistStream_QueryInterface,
IDirectMusicTimeSigTrack_IPersistStream_AddRef,
IDirectMusicTimeSigTrack_IPersistStream_Release,
IDirectMusicTimeSigTrack_IPersistStream_GetClassID,
IDirectMusicTimeSigTrack_IPersistStream_IsDirty,
IDirectMusicTimeSigTrack_IPersistStream_Load,
IDirectMusicTimeSigTrack_IPersistStream_Save,
IDirectMusicTimeSigTrack_IPersistStream_GetSizeMax
}; };
/* for ClassFactory */ /* for ClassFactory */
@ -249,12 +218,10 @@ HRESULT WINAPI create_dmtimesigtrack(REFIID lpcGUID, void **ppobj)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
track->IDirectMusicTrack_iface.lpVtbl = &dmtack_vtbl; track->IDirectMusicTrack_iface.lpVtbl = &dmtack_vtbl;
track->PersistStreamVtbl = &DirectMusicTimeSigTrack_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_DirectMusicTimeSigTrack;
track->ref = 1; track->ref = 1;
dmobject_init(&track->dmobj, &CLSID_DirectMusicTimeSigTrack,
(IUnknown *)&track->IDirectMusicTrack_iface);
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
DMIME_LockModule(); DMIME_LockModule();
hr = IDirectMusicTrack_QueryInterface(&track->IDirectMusicTrack_iface, lpcGUID, ppobj); hr = IDirectMusicTrack_QueryInterface(&track->IDirectMusicTrack_iface, lpcGUID, ppobj);