dmstyle: Use the generic IPersistStream for DMMuteTrack.

This commit is contained in:
Michael Stefaniuc 2015-06-30 09:23:26 +02:00 committed by Alexandre Julliard
parent 43c9f3a0bc
commit 2387bbfe3b
2 changed files with 21 additions and 48 deletions

View File

@ -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);
@ -26,9 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
*/ */
typedef struct IDirectMusicMuteTrack { typedef struct IDirectMusicMuteTrack {
IDirectMusicTrack8 IDirectMusicTrack8_iface; IDirectMusicTrack8 IDirectMusicTrack8_iface;
const IPersistStreamVtbl *PersistStreamVtbl; struct dmobject dmobj; /* IPersistStream only */
LONG ref; LONG ref;
DMUS_OBJECTDESC *pDesc;
} IDirectMusicMuteTrack; } IDirectMusicMuteTrack;
/* IDirectMusicMuteTrack IDirectMusicTrack8 part: */ /* IDirectMusicMuteTrack 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;
@ -247,52 +247,27 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
IDirectMusicTrack8Impl_Join IDirectMusicTrack8Impl_Join
}; };
/* IDirectMusicMuteTrack IPersistStream part: */ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
static HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { {
ICOM_THIS_MULTI(IDirectMusicMuteTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj);
}
static ULONG WINAPI IDirectMusicMuteTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicMuteTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface);
}
static ULONG WINAPI IDirectMusicMuteTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicMuteTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface);
}
static HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
return E_NOTIMPL;
}
static HRESULT WINAPI IDirectMusicMuteTrack_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 IDirectMusicMuteTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
BOOL cleardirty)
{
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDirectMusicMuteTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { static const IPersistStreamVtbl persiststream_vtbl = {
return E_NOTIMPL; dmobj_IPersistStream_QueryInterface,
} dmobj_IPersistStream_AddRef,
dmobj_IPersistStream_Release,
static const IPersistStreamVtbl DirectMusicMuteTrack_PersistStream_Vtbl = { dmobj_IPersistStream_GetClassID,
IDirectMusicMuteTrack_IPersistStream_QueryInterface, unimpl_IPersistStream_IsDirty,
IDirectMusicMuteTrack_IPersistStream_AddRef, IPersistStreamImpl_Load,
IDirectMusicMuteTrack_IPersistStream_Release, IPersistStreamImpl_Save,
IDirectMusicMuteTrack_IPersistStream_GetClassID, unimpl_IPersistStream_GetSizeMax
IDirectMusicMuteTrack_IPersistStream_IsDirty,
IDirectMusicMuteTrack_IPersistStream_Load,
IDirectMusicMuteTrack_IPersistStream_Save,
IDirectMusicMuteTrack_IPersistStream_GetSizeMax
}; };
/* for ClassFactory */ /* for ClassFactory */
@ -307,12 +282,10 @@ HRESULT WINAPI create_dmmutetrack(REFIID lpcGUID, void **ppobj)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
track->PersistStreamVtbl = &DirectMusicMuteTrack_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_DirectMusicMuteTrack;
track->ref = 1; track->ref = 1;
dmobject_init(&track->dmobj, &CLSID_DirectMusicMuteTrack,
(IUnknown *)&track->IDirectMusicTrack8_iface);
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
DMSTYLE_LockModule(); DMSTYLE_LockModule();
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj); hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);

View File

@ -258,7 +258,7 @@ static void test_track(void)
{ X(DirectMusicChordTrack), TRUE, TRUE, FALSE }, { X(DirectMusicChordTrack), TRUE, TRUE, FALSE },
{ X(DirectMusicCommandTrack), TRUE, TRUE, TRUE }, { X(DirectMusicCommandTrack), TRUE, TRUE, TRUE },
{ X(DirectMusicMotifTrack), FALSE, FALSE, TRUE }, { X(DirectMusicMotifTrack), FALSE, FALSE, TRUE },
{ X(DirectMusicMuteTrack), TRUE, FALSE, TRUE }, { X(DirectMusicMuteTrack), TRUE, FALSE, FALSE },
{ X(DirectMusicStyleTrack), FALSE, TRUE, FALSE }, { X(DirectMusicStyleTrack), FALSE, TRUE, FALSE },
}; };
#undef X #undef X