dmime: Use the generic IPersistStream for DMMarkerTrack.

This commit is contained in:
Michael Stefaniuc 2015-07-02 11:50:59 +02:00 committed by Alexandre Julliard
parent ef6a803592
commit 5bf9d04581
2 changed files with 18 additions and 51 deletions

View File

@ -18,6 +18,7 @@
*/
#include "dmime_private.h"
#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmime);
@ -26,9 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmime);
*/
typedef struct IDirectMusicMarkerTrack {
IDirectMusicTrack IDirectMusicTrack_iface;
const IPersistStreamVtbl *PersistStreamVtbl;
struct dmobject dmobj; /* IPersistStream only */
LONG ref;
DMUS_OBJECTDESC *pDesc;
} IDirectMusicMarkerTrack;
/* IDirectMusicMarkerTrack IDirectMusicTrack8 part: */
@ -49,7 +49,7 @@ static HRESULT WINAPI IDirectMusicTrackImpl_QueryInterface(IDirectMusicTrack *if
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicTrack))
*ret_iface = iface;
else if (IsEqualIID(riid, &IID_IPersistStream))
*ret_iface = &This->PersistStreamVtbl;
*ret_iface = &This->dmobj.IPersistStream_iface;
else {
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
@ -188,52 +188,21 @@ static const IDirectMusicTrackVtbl dmtrack_vtbl = {
IDirectMusicTrackImpl_Clone
};
/* IDirectMusicMarkerTrack IPersistStream part: */
static HRESULT WINAPI IDirectMusicMarkerTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicMarkerTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack_QueryInterface(&This->IDirectMusicTrack_iface, riid, ppobj);
}
static ULONG WINAPI IDirectMusicMarkerTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicMarkerTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack_AddRef(&This->IDirectMusicTrack_iface);
}
static ULONG WINAPI IDirectMusicMarkerTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicMarkerTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack_Release(&This->IDirectMusicTrack_iface);
}
static HRESULT WINAPI IDirectMusicMarkerTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicMarkerTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicMarkerTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
{
FIXME(": Loading not implemented yet\n");
return S_OK;
}
static HRESULT WINAPI IDirectMusicMarkerTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicMarkerTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
return E_NOTIMPL;
}
static const IPersistStreamVtbl DirectMusicMarkerTrack_PersistStream_Vtbl = {
IDirectMusicMarkerTrack_IPersistStream_QueryInterface,
IDirectMusicMarkerTrack_IPersistStream_AddRef,
IDirectMusicMarkerTrack_IPersistStream_Release,
IDirectMusicMarkerTrack_IPersistStream_GetClassID,
IDirectMusicMarkerTrack_IPersistStream_IsDirty,
IDirectMusicMarkerTrack_IPersistStream_Load,
IDirectMusicMarkerTrack_IPersistStream_Save,
IDirectMusicMarkerTrack_IPersistStream_GetSizeMax
static const IPersistStreamVtbl persiststream_vtbl = {
dmobj_IPersistStream_QueryInterface,
dmobj_IPersistStream_AddRef,
dmobj_IPersistStream_Release,
dmobj_IPersistStream_GetClassID,
unimpl_IPersistStream_IsDirty,
IPersistStreamImpl_Load,
unimpl_IPersistStream_Save,
unimpl_IPersistStream_GetSizeMax
};
/* for ClassFactory */
@ -248,12 +217,10 @@ HRESULT WINAPI create_dmmarkertrack(REFIID lpcGUID, void **ppobj)
return E_OUTOFMEMORY;
}
track->IDirectMusicTrack_iface.lpVtbl = &dmtrack_vtbl;
track->PersistStreamVtbl = &DirectMusicMarkerTrack_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_DirectMusicMarkerTrack;
track->ref = 1;
dmobject_init(&track->dmobj, &CLSID_DirectMusicMarkerTrack,
(IUnknown *)&track->IDirectMusicTrack_iface);
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
DMIME_LockModule();
hr = IDirectMusicTrack_QueryInterface(&track->IDirectMusicTrack_iface, lpcGUID, ppobj);

View File

@ -495,7 +495,7 @@ static void test_track(void)
BOOL todo;
} class[] = {
{ X(DirectMusicLyricsTrack), TRUE },
{ X(DirectMusicMarkerTrack), TRUE },
{ X(DirectMusicMarkerTrack), FALSE },
{ X(DirectMusicParamControlTrack), TRUE },
{ X(DirectMusicSegmentTriggerTrack), FALSE },
{ X(DirectMusicSeqTrack), TRUE },