Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/dmime/timesigtrack.c | 63 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-)
diff --git a/dlls/dmime/timesigtrack.c b/dlls/dmime/timesigtrack.c index 697b3e3593b..0ea48613fab 100644 --- a/dlls/dmime/timesigtrack.c +++ b/dlls/dmime/timesigtrack.c @@ -29,6 +29,9 @@ typedef struct IDirectMusicTimeSigTrack { IDirectMusicTrack IDirectMusicTrack_iface; struct dmobject dmobj; /* IPersistStream only */ LONG ref; + + DMUS_IO_TIMESIGNATURE_ITEM *items; + unsigned int count; } IDirectMusicTimeSigTrack;
/* IDirectMusicTimeSigTrack IDirectMusicTrack8 part: */ @@ -37,6 +40,11 @@ static inline IDirectMusicTimeSigTrack *impl_from_IDirectMusicTrack(IDirectMusic return CONTAINING_RECORD(iface, IDirectMusicTimeSigTrack, IDirectMusicTrack_iface); }
+static inline IDirectMusicTimeSigTrack *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicTimeSigTrack, dmobj.IPersistStream_iface); +} + static HRESULT WINAPI IDirectMusicTrackImpl_QueryInterface(IDirectMusicTrack *iface, REFIID riid, void **ret_iface) { @@ -77,6 +85,7 @@ static ULONG WINAPI IDirectMusicTrackImpl_Release(IDirectMusicTrack *iface) TRACE("(%p) ref=%d\n", This, ref);
if (!ref) { + heap_free(This->items); HeapFree(GetProcessHeap(), 0, This); DMIME_UnlockModule(); } @@ -207,10 +216,60 @@ static const IDirectMusicTrackVtbl dmtack_vtbl = { IDirectMusicTrackImpl_Clone };
+static HRESULT parse_timetrack_list(IDirectMusicTimeSigTrack *This, IStream *stream, + struct chunk_entry *timesig) +{ + HRESULT hr; + struct chunk_entry chunk = {.parent = timesig}; + int i; + + TRACE("Parsing segment form in %p: %s\n", stream, debugstr_chunk(timesig)); + + if (FAILED(hr = stream_next_chunk(stream, &chunk))) { + WARN("Failed to read data of %s\n", debugstr_chunk(&chunk)); + return hr; + } + + if (chunk.id != DMUS_FOURCC_TIMESIGNATURE_TRACK) + return DMUS_E_UNSUPPORTED_STREAM; + + hr = stream_chunk_get_array(stream, &chunk, (void **)&This->items, &This->count, + sizeof(DMUS_IO_TIMESIGNATURE_ITEM)); + if (FAILED(hr)) + return hr; + + for (i = 0; i < This->count; i++) + { + TRACE("Found DMUS_IO_TIMESIGNATURE_ITEM\n"); + TRACE(" - lTime %d\n", This->items[i].lTime); + TRACE(" - bBeatsPerMeasure %d\n", This->items[i].bBeatsPerMeasure); + TRACE(" - bBeat %d\n", This->items[i].bBeat); + TRACE(" - wGridsPerBeat %d\n", This->items[i].wGridsPerBeat); + } + + return S_OK; +} + static HRESULT WINAPI time_IPersistStream_Load(IPersistStream *iface, IStream *stream) { - FIXME(": Loading not implemented yet\n"); - return S_OK; + IDirectMusicTimeSigTrack *This = impl_from_IPersistStream(iface); + HRESULT hr; + struct chunk_entry chunk = {0}; + + TRACE("%p, %p\n", This, stream); + + if (!stream) + return E_POINTER; + + if ((hr = stream_get_chunk(stream, &chunk) != S_OK)) + return hr; + + if (chunk.id == FOURCC_LIST && chunk.type == DMUS_FOURCC_TIMESIGTRACK_LIST) + hr = parse_timetrack_list(This, stream, &chunk); + else + hr = DMUS_E_UNSUPPORTED_STREAM; + + return hr; }
static const IPersistStreamVtbl persiststream_vtbl = {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76636
Your paranoid android.
=== debiant (build log) ===
/home/winetest/tools/testbot/var/wine-win32/dlls/dmime/../../../wine/dlls/dmime/timesigtrack.c:88: undefined reference to `heap_free' collect2: error: ld returned 1 exit status Task: The win32 Wine build failed
=== debiant (build log) ===
/home/winetest/tools/testbot/var/wine-wow64/dlls/dmime/../../../wine/dlls/dmime/timesigtrack.c:88: undefined reference to `heap_free' collect2: error: ld returned 1 exit status Task: The wow64 Wine build failed