Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
bb88427e
Commit
bb88427e
authored
Mar 16, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Mar 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dmime: Reimplement the segment form parser.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
117a2081
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
94 deletions
+63
-94
segment.c
dlls/dmime/segment.c
+63
-94
No files found.
dlls/dmime/segment.c
View file @
bb88427e
...
@@ -819,20 +819,14 @@ static HRESULT parse_track_form(IDirectMusicSegment8Impl *This, DMUS_PRIVATE_CHU
...
@@ -819,20 +819,14 @@ static HRESULT parse_track_form(IDirectMusicSegment8Impl *This, DMUS_PRIVATE_CHU
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
parse_track_list
(
IDirectMusicSegment8Impl
*
This
,
DMUS_PRIVATE_CHUNK
*
pChunk
,
static
HRESULT
parse_track_list
(
IDirectMusicSegment8Impl
*
This
,
DWORD
StreamSize
,
IStream
*
pStm
)
IStream
*
pStm
)
{
{
HRESULT
hr
=
E_FAIL
;
HRESULT
hr
=
E_FAIL
;
DMUS_PRIVATE_CHUNK
Chunk
;
DMUS_PRIVATE_CHUNK
Chunk
;
DWORD
StreamSize
,
ListSize
[
3
],
ListCount
[
3
];
DWORD
ListSize
[
3
],
ListCount
[
3
];
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
if
(
pChunk
->
fccID
!=
DMUS_FOURCC_TRACK_LIST
)
{
ListSize
[
0
]
=
StreamSize
-
sizeof
(
FOURCC
);
ERR_
(
dmfile
)(
": %s chunk should be a TRACK list
\n
"
,
debugstr_fourcc
(
pChunk
->
fccID
));
return
E_FAIL
;
}
ListSize
[
0
]
=
pChunk
->
dwSize
-
sizeof
(
FOURCC
);
ListCount
[
0
]
=
0
;
ListCount
[
0
]
=
0
;
do
{
do
{
...
@@ -873,94 +867,69 @@ static HRESULT parse_track_list(IDirectMusicSegment8Impl *This, DMUS_PRIVATE_CHU
...
@@ -873,94 +867,69 @@ static HRESULT parse_track_list(IDirectMusicSegment8Impl *This, DMUS_PRIVATE_CHU
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
parse_segment_form
(
IDirectMusicSegment8Impl
*
This
,
DWORD
StreamSize
,
IStream
*
pStm
)
static
inline
void
dump_segment_header
(
DMUS_IO_SEGMENT_HEADER
*
h
,
DWORD
size
)
{
{
HRESULT
hr
=
E_FAIL
;
unsigned
int
dx
=
9
;
DMUS_PRIVATE_CHUNK
Chunk
;
DWORD
StreamCount
;
if
(
size
==
offsetof
(
DMUS_IO_SEGMENT_HEADER
,
rtLength
))
LARGE_INTEGER
liMove
;
/* used when skipping chunks */
dx
=
7
;
else
if
(
size
==
offsetof
(
DMUS_IO_SEGMENT_HEADER
,
rtLoopStart
))
StreamSize
-=
sizeof
(
FOURCC
);
dx
=
8
;
StreamCount
=
0
;
TRACE
(
"Found DirectX%d DMUS_IO_SEGMENT_HEADER
\n
"
,
dx
);
TRACE
(
"
\t
dwRepeats: %u
\n
"
,
h
->
dwRepeats
);
TRACE
(
"
\t
mtLength: %u
\n
"
,
h
->
mtLength
);
TRACE
(
"
\t
mtPlayStart: %u
\n
"
,
h
->
mtPlayStart
);
TRACE
(
"
\t
mtLoopStart: %u
\n
"
,
h
->
mtLoopStart
);
TRACE
(
"
\t
mtLoopEnd: %u
\n
"
,
h
->
mtLoopEnd
);
TRACE
(
"
\t
dwResolution: %u
\n
"
,
h
->
dwResolution
);
if
(
dx
>=
8
)
{
TRACE
(
"
\t
rtLength: %s
\n
"
,
wine_dbgstr_longlong
(
h
->
rtLength
));
TRACE
(
"
\t
dwFlags: %u
\n
"
,
h
->
dwFlags
);
TRACE
(
"
\t
dwReserved: %u
\n
"
,
h
->
dwReserved
);
}
if
(
dx
==
9
)
{
TRACE
(
"
\t
rtLoopStart: %s
\n
"
,
wine_dbgstr_longlong
(
h
->
rtLoopStart
));
TRACE
(
"
\t
rtLoopEnd: %s
\n
"
,
wine_dbgstr_longlong
(
h
->
rtLoopEnd
));
TRACE
(
"
\t
rtPlayStart: %s
\n
"
,
wine_dbgstr_longlong
(
h
->
rtPlayStart
));
}
}
do
{
static
HRESULT
parse_segment_form
(
IDirectMusicSegment8Impl
*
This
,
IStream
*
stream
,
IStream_Read
(
pStm
,
&
Chunk
,
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
),
NULL
);
const
struct
chunk_entry
*
riff
)
StreamCount
+=
sizeof
(
FOURCC
)
+
sizeof
(
DWORD
)
+
Chunk
.
dwSize
;
{
TRACE_
(
dmfile
)(
": %s chunk (size = %d)"
,
debugstr_fourcc
(
Chunk
.
fccID
),
Chunk
.
dwSize
);
struct
chunk_entry
chunk
=
{.
parent
=
riff
};
HRESULT
hr
;
switch
(
Chunk
.
fccID
)
{
TRACE
(
"Parsing segment form in %p: %s
\n
"
,
stream
,
debugstr_chunk
(
riff
));
case
DMUS_FOURCC_SEGMENT_CHUNK
:
{
DWORD
checkSz
=
sizeof
(
FOURCC
);
while
((
hr
=
stream_next_chunk
(
stream
,
&
chunk
))
==
S_OK
)
{
TRACE_
(
dmfile
)(
": segment chunk
\n
"
);
switch
(
chunk
.
id
)
{
/** DX 7 */
case
DMUS_FOURCC_SEGMENT_CHUNK
:
IStream_Read
(
pStm
,
&
This
->
header
.
dwRepeats
,
sizeof
(
This
->
header
.
dwRepeats
),
NULL
);
/* DX7, DX8 and DX9 structure sizes */
checkSz
+=
sizeof
(
This
->
header
.
dwRepeats
);
if
(
chunk
.
size
!=
offsetof
(
DMUS_IO_SEGMENT_HEADER
,
rtLength
)
&&
IStream_Read
(
pStm
,
&
This
->
header
.
mtLength
,
sizeof
(
This
->
header
.
mtLength
),
NULL
);
chunk
.
size
!=
offsetof
(
DMUS_IO_SEGMENT_HEADER
,
rtLoopStart
)
&&
checkSz
+=
sizeof
(
This
->
header
.
mtLength
);
chunk
.
size
!=
sizeof
(
DMUS_IO_SEGMENT_HEADER
))
{
IStream_Read
(
pStm
,
&
This
->
header
.
mtPlayStart
,
sizeof
(
This
->
header
.
mtPlayStart
),
NULL
);
WARN
(
"Invalid size of %s
\n
"
,
debugstr_chunk
(
&
chunk
));
checkSz
+=
sizeof
(
This
->
header
.
mtPlayStart
);
break
;
IStream_Read
(
pStm
,
&
This
->
header
.
mtLoopStart
,
sizeof
(
This
->
header
.
mtLoopStart
),
NULL
);
}
checkSz
+=
sizeof
(
This
->
header
.
mtLoopStart
);
if
(
FAILED
(
hr
=
stream_chunk_get_data
(
stream
,
&
chunk
,
&
This
->
header
,
chunk
.
size
)))
{
IStream_Read
(
pStm
,
&
This
->
header
.
mtLoopEnd
,
sizeof
(
This
->
header
.
mtLoopEnd
),
NULL
);
WARN
(
"Failed to read data of %s
\n
"
,
debugstr_chunk
(
&
chunk
));
checkSz
+=
sizeof
(
This
->
header
.
mtLoopEnd
);
return
hr
;
IStream_Read
(
pStm
,
&
This
->
header
.
dwResolution
,
sizeof
(
This
->
header
.
dwResolution
),
NULL
);
}
checkSz
+=
sizeof
(
This
->
header
.
dwResolution
);
dump_segment_header
(
&
This
->
header
,
chunk
.
size
);
TRACE_
(
dmfile
)(
"dwRepeats: %u
\n
"
,
This
->
header
.
dwRepeats
);
break
;
TRACE_
(
dmfile
)(
"mtLength: %u
\n
"
,
This
->
header
.
mtLength
);
case
FOURCC_LIST
:
TRACE_
(
dmfile
)(
"mtPlayStart: %u
\n
"
,
This
->
header
.
mtPlayStart
);
if
(
chunk
.
type
==
DMUS_FOURCC_TRACK_LIST
)
TRACE_
(
dmfile
)(
"mtLoopStart: %u
\n
"
,
This
->
header
.
mtLoopStart
);
if
(
FAILED
(
hr
=
parse_track_list
(
This
,
chunk
.
size
,
stream
)))
TRACE_
(
dmfile
)(
"mtLoopEnd: %u
\n
"
,
This
->
header
.
mtLoopEnd
);
return
hr
;
TRACE_
(
dmfile
)(
"dwResolution: %u
\n
"
,
This
->
header
.
dwResolution
);
break
;
/** DX 8 */
case
FOURCC_RIFF
:
if
(
Chunk
.
dwSize
>
checkSz
)
{
FIXME
(
"Loading of embedded RIFF form %s"
,
debugstr_fourcc
(
chunk
.
type
));
IStream_Read
(
pStm
,
&
This
->
header
.
rtLength
,
sizeof
(
This
->
header
.
rtLength
),
NULL
);
break
;
checkSz
+=
sizeof
(
This
->
header
.
rtLength
);
}
IStream_Read
(
pStm
,
&
This
->
header
.
dwFlags
,
sizeof
(
This
->
header
.
dwFlags
),
NULL
);
checkSz
+=
sizeof
(
This
->
header
.
dwFlags
);
}
/** DX 9 */
if
(
Chunk
.
dwSize
>
checkSz
)
{
IStream_Read
(
pStm
,
&
This
->
header
.
rtLoopStart
,
sizeof
(
This
->
header
.
rtLoopStart
),
NULL
);
checkSz
+=
sizeof
(
This
->
header
.
rtLoopStart
);
IStream_Read
(
pStm
,
&
This
->
header
.
rtLoopEnd
,
sizeof
(
This
->
header
.
rtLoopEnd
),
NULL
);
checkSz
+=
sizeof
(
This
->
header
.
rtLoopEnd
);
IStream_Read
(
pStm
,
&
This
->
header
.
rtPlayStart
,
sizeof
(
This
->
header
.
rtPlayStart
),
NULL
);
checkSz
+=
sizeof
(
This
->
header
.
rtPlayStart
);
}
liMove
.
QuadPart
=
Chunk
.
dwSize
-
checkSz
+
sizeof
(
FOURCC
);
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
case
FOURCC_LIST
:
{
IStream_Read
(
pStm
,
&
Chunk
.
fccID
,
sizeof
(
FOURCC
),
NULL
);
TRACE_
(
dmfile
)(
": LIST chunk of type %s"
,
debugstr_fourcc
(
Chunk
.
fccID
));
switch
(
Chunk
.
fccID
)
{
case
DMUS_FOURCC_TRACK_LIST
:
{
TRACE_
(
dmfile
)(
": TRACK list
\n
"
);
hr
=
parse_track_list
(
This
,
&
Chunk
,
pStm
);
if
(
FAILED
(
hr
))
return
hr
;
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown (skipping)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
-
sizeof
(
FOURCC
);
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
}
break
;
}
default:
{
TRACE_
(
dmfile
)(
": unknown chunk (irrelevant & skipping)
\n
"
);
liMove
.
QuadPart
=
Chunk
.
dwSize
;
IStream_Seek
(
pStm
,
liMove
,
STREAM_SEEK_CUR
,
NULL
);
break
;
}
}
}
TRACE_
(
dmfile
)(
": StreamCount[0] = %d < StreamSize[0] = %d
\n
"
,
StreamCount
,
StreamSize
);
}
while
(
StreamCount
<
StreamSize
);
return
S_OK
;
return
SUCCEEDED
(
hr
)
?
S_OK
:
hr
;
}
}
static
inline
IDirectMusicSegment8Impl
*
impl_from_IPersistStream
(
IPersistStream
*
iface
)
static
inline
IDirectMusicSegment8Impl
*
impl_from_IPersistStream
(
IPersistStream
*
iface
)
...
@@ -990,7 +959,7 @@ static HRESULT WINAPI seg_IPersistStream_Load(IPersistStream *iface, IStream *st
...
@@ -990,7 +959,7 @@ static HRESULT WINAPI seg_IPersistStream_Load(IPersistStream *iface, IStream *st
stream_reset_chunk_data
(
stream
,
&
riff
);
stream_reset_chunk_data
(
stream
,
&
riff
);
if
(
riff
.
type
==
DMUS_FOURCC_SEGMENT_FORM
)
if
(
riff
.
type
==
DMUS_FOURCC_SEGMENT_FORM
)
hr
=
parse_segment_form
(
This
,
riff
.
size
,
stream
);
hr
=
parse_segment_form
(
This
,
stream
,
&
riff
);
else
{
else
{
FIXME
(
"WAVE form loading not implemented
\n
"
);
FIXME
(
"WAVE form loading not implemented
\n
"
);
hr
=
S_OK
;
hr
=
S_OK
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment