Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
4259b17b
Commit
4259b17b
authored
Aug 23, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsdiff: add local variable "remaining_bytes"
Remember the chunk's total size.
parent
828ea700
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
DsdiffDecoderPlugin.cxx
src/decoder/plugins/DsdiffDecoderPlugin.cxx
+6
-5
No files found.
src/decoder/plugins/DsdiffDecoderPlugin.cxx
View file @
4259b17b
...
@@ -356,7 +356,7 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
...
@@ -356,7 +356,7 @@ bit_reverse_buffer(uint8_t *p, uint8_t *end)
static
bool
static
bool
dsdiff_decode_chunk
(
Decoder
&
decoder
,
InputStream
&
is
,
dsdiff_decode_chunk
(
Decoder
&
decoder
,
InputStream
&
is
,
unsigned
channels
,
unsigned
sample_rate
,
unsigned
channels
,
unsigned
sample_rate
,
offset_type
chunk_size
)
const
offset_type
total_bytes
)
{
{
uint8_t
buffer
[
8192
];
uint8_t
buffer
[
8192
];
...
@@ -365,12 +365,13 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
...
@@ -365,12 +365,13 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
const
unsigned
buffer_frames
=
sizeof
(
buffer
)
/
frame_size
;
const
unsigned
buffer_frames
=
sizeof
(
buffer
)
/
frame_size
;
const
size_t
buffer_size
=
buffer_frames
*
frame_size
;
const
size_t
buffer_size
=
buffer_frames
*
frame_size
;
while
(
chunk_size
>=
frame_size
)
{
for
(
offset_type
remaining_bytes
=
total_bytes
;
remaining_bytes
>=
frame_size
;)
{
/* see how much aligned data from the remaining chunk
/* see how much aligned data from the remaining chunk
fits into the local buffer */
fits into the local buffer */
size_t
now_size
=
buffer_size
;
size_t
now_size
=
buffer_size
;
if
(
chunk_size
<
(
offset_type
)
now_size
)
{
if
(
remaining_bytes
<
(
offset_type
)
now_size
)
{
unsigned
now_frames
=
chunk_size
/
frame_size
;
unsigned
now_frames
=
remaining_bytes
/
frame_size
;
now_size
=
now_frames
*
frame_size
;
now_size
=
now_frames
*
frame_size
;
}
}
...
@@ -378,7 +379,7 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
...
@@ -378,7 +379,7 @@ dsdiff_decode_chunk(Decoder &decoder, InputStream &is,
return
false
;
return
false
;
const
size_t
nbytes
=
now_size
;
const
size_t
nbytes
=
now_size
;
chunk_size
-=
nbytes
;
remaining_bytes
-=
nbytes
;
if
(
lsbitfirst
)
if
(
lsbitfirst
)
bit_reverse_buffer
(
buffer
,
buffer
+
nbytes
);
bit_reverse_buffer
(
buffer
,
buffer
+
nbytes
);
...
...
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