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
cfd55b29
Commit
cfd55b29
authored
Nov 08, 2008
by
Laszlo Ashin
Committed by
Max Kellermann
Nov 08, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wavpack: wrapper for converting void* to struct wavpack_input*
A new function has been added to do a cast and a little check in the wavpack-mpd input stream wrapper.
parent
2b4a410b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
wavpack_plugin.c
src/decoder/wavpack_plugin.c
+20
-13
No files found.
src/decoder/wavpack_plugin.c
View file @
cfd55b29
...
...
@@ -346,16 +346,25 @@ struct wavpack_input {
int
last_byte
;
};
/**
* Little wrapper for struct wavpack_input to cast from void *.
*/
static
struct
wavpack_input
*
wpin
(
void
*
id
)
{
assert
(
id
);
return
id
;
}
static
int32_t
wavpack_input_read_bytes
(
void
*
id
,
void
*
data
,
int32_t
bcount
)
{
struct
wavpack_input
*
isp
=
(
struct
wavpack_input
*
)
id
;
uint8_t
*
buf
=
(
uint8_t
*
)
data
;
int32_t
i
=
0
;
if
(
isp
->
last_byte
!=
EOF
)
{
*
buf
++
=
isp
->
last_byte
;
isp
->
last_byte
=
EOF
;
if
(
wpin
(
id
)
->
last_byte
!=
EOF
)
{
*
buf
++
=
wpin
(
id
)
->
last_byte
;
wpin
(
id
)
->
last_byte
=
EOF
;
--
bcount
;
++
i
;
}
...
...
@@ -363,7 +372,7 @@ wavpack_input_read_bytes(void *id, void *data, int32_t bcount)
/* wavpack fails if we return a partial read, so we just wait
until the buffer is full */
while
(
bcount
>
0
)
{
size_t
nbytes
=
decoder_read
(
isp
->
decoder
,
isp
->
is
,
size_t
nbytes
=
decoder_read
(
wpin
(
id
)
->
decoder
,
wpin
(
id
)
->
is
,
buf
,
bcount
);
if
(
nbytes
==
0
)
{
/* EOF, error or a decoder command */
...
...
@@ -381,40 +390,38 @@ wavpack_input_read_bytes(void *id, void *data, int32_t bcount)
static
uint32_t
wavpack_input_get_pos
(
void
*
id
)
{
return
((
struct
wavpack_input
*
)
id
)
->
is
->
offset
;
return
wpin
(
id
)
->
is
->
offset
;
}
static
int
wavpack_input_set_pos_abs
(
void
*
id
,
uint32_t
pos
)
{
return
input_stream_seek
(((
struct
wavpack_input
*
)
id
)
->
is
,
pos
,
SEEK_SET
)
?
0
:
-
1
;
return
input_stream_seek
(
wpin
(
id
)
->
is
,
pos
,
SEEK_SET
)
?
0
:
-
1
;
}
static
int
wavpack_input_set_pos_rel
(
void
*
id
,
int32_t
delta
,
int
mode
)
{
return
input_stream_seek
(((
struct
wavpack_input
*
)
id
)
->
is
,
delta
,
mode
)
?
0
:
-
1
;
return
input_stream_seek
(
wpin
(
id
)
->
is
,
delta
,
mode
)
?
0
:
-
1
;
}
static
int
wavpack_input_push_back_byte
(
void
*
id
,
int
c
)
{
((
struct
wavpack_input
*
)
id
)
->
last_byte
=
c
;
wpin
(
id
)
->
last_byte
=
c
;
return
1
;
}
static
uint32_t
wavpack_input_get_length
(
void
*
id
)
{
return
((
struct
wavpack_input
*
)
id
)
->
is
->
size
;
return
wpin
(
id
)
->
is
->
size
;
}
static
int
wavpack_input_can_seek
(
void
*
id
)
{
return
((
struct
wavpack_input
*
)
id
)
->
is
->
seekable
;
return
wpin
(
id
)
->
is
->
seekable
;
}
static
WavpackStreamReader
mpd_is_reader
=
{
...
...
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