dmime: Use the generic IPersistStream for DMWaveTrack.
This commit is contained in:
parent
f70498f121
commit
0789ddc322
|
@ -492,17 +492,16 @@ static void test_track(void)
|
||||||
const struct {
|
const struct {
|
||||||
REFCLSID clsid;
|
REFCLSID clsid;
|
||||||
const char *name;
|
const char *name;
|
||||||
BOOL todo;
|
|
||||||
} class[] = {
|
} class[] = {
|
||||||
{ X(DirectMusicLyricsTrack), FALSE },
|
{ X(DirectMusicLyricsTrack) },
|
||||||
{ X(DirectMusicMarkerTrack), FALSE },
|
{ X(DirectMusicMarkerTrack) },
|
||||||
{ X(DirectMusicParamControlTrack), FALSE },
|
{ X(DirectMusicParamControlTrack) },
|
||||||
{ X(DirectMusicSegmentTriggerTrack), FALSE },
|
{ X(DirectMusicSegmentTriggerTrack) },
|
||||||
{ X(DirectMusicSeqTrack), FALSE },
|
{ X(DirectMusicSeqTrack) },
|
||||||
{ X(DirectMusicSysExTrack), FALSE },
|
{ X(DirectMusicSysExTrack) },
|
||||||
{ X(DirectMusicTempoTrack), FALSE },
|
{ X(DirectMusicTempoTrack) },
|
||||||
{ X(DirectMusicTimeSigTrack), FALSE },
|
{ X(DirectMusicTimeSigTrack) },
|
||||||
{ X(DirectMusicWaveTrack), TRUE }
|
{ X(DirectMusicWaveTrack) }
|
||||||
};
|
};
|
||||||
#undef X
|
#undef X
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -517,21 +516,11 @@ static void test_track(void)
|
||||||
hr = IDirectMusicTrack_QueryInterface(dmt, &IID_IPersistStream, (void**)&ps);
|
hr = IDirectMusicTrack_QueryInterface(dmt, &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, &classid);
|
hr = IPersistStream_GetClassID(ps, &classid);
|
||||||
if (class[i].todo) {
|
|
||||||
todo_wine {
|
|
||||||
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
||||||
ok(IsEqualGUID(&classid, class[i].clsid),
|
ok(IsEqualGUID(&classid, class[i].clsid),
|
||||||
"Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid));
|
"Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid));
|
||||||
hr = IPersistStream_IsDirty(ps);
|
hr = IPersistStream_IsDirty(ps);
|
||||||
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ok(hr == S_OK, "IPersistStream_GetClassID failed: %08x\n", hr);
|
|
||||||
ok(IsEqualGUID(&classid, class[i].clsid),
|
|
||||||
"Expected class %s got %s\n", class[i].name, wine_dbgstr_guid(&classid));
|
|
||||||
hr = IPersistStream_IsDirty(ps);
|
|
||||||
ok(hr == S_FALSE, "IPersistStream_IsDirty failed: %08x\n", hr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Unimplemented IPersistStream methods */
|
/* Unimplemented IPersistStream methods */
|
||||||
hr = IPersistStream_GetSizeMax(ps, &size);
|
hr = IPersistStream_GetSizeMax(ps, &size);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
@ -29,9 +30,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmime);
|
||||||
*/
|
*/
|
||||||
typedef struct IDirectMusicWaveTrack {
|
typedef struct IDirectMusicWaveTrack {
|
||||||
IDirectMusicTrack8 IDirectMusicTrack8_iface;
|
IDirectMusicTrack8 IDirectMusicTrack8_iface;
|
||||||
const IPersistStreamVtbl *PersistStreamVtbl;
|
struct dmobject dmobj; /* IPersistStream only */
|
||||||
LONG ref;
|
LONG ref;
|
||||||
DMUS_OBJECTDESC *pDesc;
|
|
||||||
} IDirectMusicWaveTrack;
|
} IDirectMusicWaveTrack;
|
||||||
|
|
||||||
/* IDirectMusicWaveTrack IDirectMusicTrack8 part: */
|
/* IDirectMusicWaveTrack IDirectMusicTrack8 part: */
|
||||||
|
@ -53,7 +53,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;
|
||||||
|
@ -249,52 +249,21 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
|
||||||
IDirectMusicTrack8Impl_Join
|
IDirectMusicTrack8Impl_Join
|
||||||
};
|
};
|
||||||
|
|
||||||
/* IDirectMusicWaveTrack IPersistStream part: */
|
static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
|
||||||
static HRESULT WINAPI IDirectMusicWaveTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
|
{
|
||||||
ICOM_THIS_MULTI(IDirectMusicWaveTrack, PersistStreamVtbl, iface);
|
|
||||||
return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicWaveTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicWaveTrack, PersistStreamVtbl, iface);
|
|
||||||
return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IDirectMusicWaveTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
|
|
||||||
ICOM_THIS_MULTI(IDirectMusicWaveTrack, PersistStreamVtbl, iface);
|
|
||||||
return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicWaveTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicWaveTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static HRESULT WINAPI IDirectMusicWaveTrack_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 IDirectMusicWaveTrack_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 IDirectMusicWaveTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
|
dmobj_IPersistStream_GetClassID,
|
||||||
return E_NOTIMPL;
|
unimpl_IPersistStream_IsDirty,
|
||||||
}
|
IPersistStreamImpl_Load,
|
||||||
|
unimpl_IPersistStream_Save,
|
||||||
static const IPersistStreamVtbl DirectMusicWaveTrack_PersistStream_Vtbl = {
|
unimpl_IPersistStream_GetSizeMax
|
||||||
IDirectMusicWaveTrack_IPersistStream_QueryInterface,
|
|
||||||
IDirectMusicWaveTrack_IPersistStream_AddRef,
|
|
||||||
IDirectMusicWaveTrack_IPersistStream_Release,
|
|
||||||
IDirectMusicWaveTrack_IPersistStream_GetClassID,
|
|
||||||
IDirectMusicWaveTrack_IPersistStream_IsDirty,
|
|
||||||
IDirectMusicWaveTrack_IPersistStream_Load,
|
|
||||||
IDirectMusicWaveTrack_IPersistStream_Save,
|
|
||||||
IDirectMusicWaveTrack_IPersistStream_GetSizeMax
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* for ClassFactory */
|
/* for ClassFactory */
|
||||||
|
@ -309,12 +278,10 @@ HRESULT WINAPI create_dmwavetrack(REFIID lpcGUID, void **ppobj)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
|
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
|
||||||
track->PersistStreamVtbl = &DirectMusicWaveTrack_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_DirectMusicWaveTrack;
|
|
||||||
track->ref = 1;
|
track->ref = 1;
|
||||||
|
dmobject_init(&track->dmobj, &CLSID_DirectMusicWaveTrack,
|
||||||
|
(IUnknown *)&track->IDirectMusicTrack8_iface);
|
||||||
|
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
|
||||||
|
|
||||||
DMIME_LockModule();
|
DMIME_LockModule();
|
||||||
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
|
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
|
||||||
|
|
Loading…
Reference in New Issue