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
13b78d0d
Commit
13b78d0d
authored
May 22, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/wavpack: move code to WavpackInput::ReadBytes()
parent
65c135b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
WavpackDecoderPlugin.cxx
src/decoder/plugins/WavpackDecoderPlugin.cxx
+12
-6
No files found.
src/decoder/plugins/WavpackDecoderPlugin.cxx
View file @
13b78d0d
...
@@ -333,6 +333,8 @@ struct WavpackInput {
...
@@ -333,6 +333,8 @@ struct WavpackInput {
constexpr
WavpackInput
(
Decoder
&
_decoder
,
InputStream
&
_is
)
constexpr
WavpackInput
(
Decoder
&
_decoder
,
InputStream
&
_is
)
:
decoder
(
_decoder
),
is
(
_is
),
last_byte
(
EOF
)
{}
:
decoder
(
_decoder
),
is
(
_is
),
last_byte
(
EOF
)
{}
int32_t
ReadBytes
(
void
*
data
,
size_t
bcount
);
};
};
/**
/**
...
@@ -348,12 +350,18 @@ wpin(void *id)
...
@@ -348,12 +350,18 @@ wpin(void *id)
static
int32_t
static
int32_t
wavpack_input_read_bytes
(
void
*
id
,
void
*
data
,
int32_t
bcount
)
wavpack_input_read_bytes
(
void
*
id
,
void
*
data
,
int32_t
bcount
)
{
{
return
wpin
(
id
)
->
ReadBytes
(
data
,
bcount
);
}
int32_t
WavpackInput
::
ReadBytes
(
void
*
data
,
size_t
bcount
)
{
uint8_t
*
buf
=
(
uint8_t
*
)
data
;
uint8_t
*
buf
=
(
uint8_t
*
)
data
;
int32_t
i
=
0
;
int32_t
i
=
0
;
if
(
wpin
(
id
)
->
last_byte
!=
EOF
)
{
if
(
last_byte
!=
EOF
)
{
*
buf
++
=
wpin
(
id
)
->
last_byte
;
*
buf
++
=
last_byte
;
wpin
(
id
)
->
last_byte
=
EOF
;
last_byte
=
EOF
;
--
bcount
;
--
bcount
;
++
i
;
++
i
;
}
}
...
@@ -361,9 +369,7 @@ wavpack_input_read_bytes(void *id, void *data, int32_t bcount)
...
@@ -361,9 +369,7 @@ wavpack_input_read_bytes(void *id, void *data, int32_t bcount)
/* wavpack fails if we return a partial read, so we just wait
/* wavpack fails if we return a partial read, so we just wait
until the buffer is full */
until the buffer is full */
while
(
bcount
>
0
)
{
while
(
bcount
>
0
)
{
size_t
nbytes
=
decoder_read
(
size_t
nbytes
=
decoder_read
(
&
decoder
,
is
,
buf
,
bcount
);
&
wpin
(
id
)
->
decoder
,
wpin
(
id
)
->
is
,
buf
,
bcount
);
if
(
nbytes
==
0
)
{
if
(
nbytes
==
0
)
{
/* EOF, error or a decoder command */
/* EOF, error or a decoder command */
break
;
break
;
...
...
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