Rebase against b2a099b3ceec6fef05c455408c05714232cb466f.

This commit is contained in:
Alistair Leslie-Hughes 2023-08-14 08:58:10 +10:00
parent a1e634bca9
commit 505a83ad9e
2 changed files with 1 additions and 101 deletions

View File

@ -1,100 +0,0 @@
From 4b20338821a19304650d1acc1229b0e8615896bc Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 3 Aug 2022 16:25:11 +1000
Subject: [PATCH] dmime: Store WAVE data when Loading.
---
dlls/dmime/segment.c | 56 ++++++++++++++++++++++++++++++++++++++++----
1 file changed, 52 insertions(+), 4 deletions(-)
diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index bf44c5e73b3..6bf9f3abf0c 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -33,6 +33,10 @@ typedef struct IDirectMusicSegment8Impl {
DMUS_IO_SEGMENT_HEADER header;
IDirectMusicGraph *pGraph;
struct list Tracks;
+
+ PCMWAVEFORMAT wave_format;
+ void *wave_data;
+ int data_size;
} IDirectMusicSegment8Impl;
IDirectMusicSegment8Impl *create_segment(void);
@@ -86,6 +90,9 @@ static ULONG WINAPI IDirectMusicSegment8Impl_Release(IDirectMusicSegment8 *iface
TRACE("(%p) ref=%ld\n", This, ref);
if (!ref) {
+ if (This->wave_data)
+ free(This->wave_data);
+
HeapFree(GetProcessHeap(), 0, This);
DMIME_UnlockModule();
}
@@ -818,6 +825,49 @@ static inline IDirectMusicSegment8Impl *impl_from_IPersistStream(IPersistStream
return CONTAINING_RECORD(iface, IDirectMusicSegment8Impl, dmobj.IPersistStream_iface);
}
+static HRESULT parse_wave_form(IDirectMusicSegment8Impl *This, IStream *stream, const struct chunk_entry *riff)
+{
+ HRESULT hr;
+ struct chunk_entry chunk = {.parent = riff};
+
+ TRACE("Parsing segment wave in %p: %s\n", stream, debugstr_chunk(riff));
+
+ while ((hr = stream_next_chunk(stream, &chunk)) == S_OK) {
+ switch (chunk.id) {
+ case mmioFOURCC('f','m','t',' '): {
+ if (FAILED(hr = stream_chunk_get_data(stream, &chunk, &This->wave_format, chunk.size)))
+ return hr;
+ TRACE("Wave Format tag %d\n", This->wave_format.wf.wFormatTag);
+ break;
+ }
+ case mmioFOURCC('d','a','t','a'): {
+ TRACE("Wave Data size %lu\n", chunk.size);
+ This->wave_data = malloc(chunk.size);
+ This->data_size = chunk.size;
+ if (!This->wave_data)
+ return E_OUTOFMEMORY;
+ if (FAILED(hr = stream_chunk_get_data(stream, &chunk, This->wave_data, chunk.size)))
+ return hr;
+ break;
+ }
+ case FOURCC_LIST: {
+ FIXME("Skipping LIST tag\n");
+ break;
+ }
+ case mmioFOURCC('I','S','F','T'): {
+ FIXME("Skipping ISFT tag\n");
+ break;
+ }
+ case mmioFOURCC('f','a','c','t'): {
+ FIXME("Skipping fact tag\n");
+ break;
+ }
+ }
+ }
+
+ return S_OK;
+}
+
static HRESULT WINAPI seg_IPersistStream_Load(IPersistStream *iface, IStream *stream)
{
IDirectMusicSegment8Impl *This = impl_from_IPersistStream(iface);
@@ -847,10 +897,8 @@ static HRESULT WINAPI seg_IPersistStream_Load(IPersistStream *iface, IStream *st
if (riff.type == DMUS_FOURCC_SEGMENT_FORM)
hr = parse_segment_form(This, stream, &riff);
- else {
- FIXME("WAVE form loading not implemented\n");
- hr = S_OK;
- }
+ else
+ hr = parse_wave_form(This, stream, &riff);
return hr;
}
--
2.39.1

View File

@ -1 +1 @@
ee1d3a19a4b8571ba32bdf9af845a74bca22c97b
b2a099b3ceec6fef05c455408c05714232cb466f