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
cb336ff6
Commit
cb336ff6
authored
Dec 14, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DecoderAPI: add function decoder_skip()
Move code from the "mad" plugin.
parent
e2e5433b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
14 deletions
+57
-14
DecoderAPI.cxx
src/DecoderAPI.cxx
+16
-0
DecoderAPI.hxx
src/DecoderAPI.hxx
+8
-0
MadDecoderPlugin.cxx
src/decoder/MadDecoderPlugin.cxx
+1
-14
FakeDecoderAPI.cxx
test/FakeDecoderAPI.cxx
+16
-0
run_decoder.cxx
test/run_decoder.cxx
+16
-0
No files found.
src/DecoderAPI.cxx
View file @
cb336ff6
...
...
@@ -306,6 +306,22 @@ decoder_read(Decoder *decoder,
return
nbytes
;
}
bool
decoder_skip
(
Decoder
*
decoder
,
InputStream
&
is
,
size_t
size
)
{
while
(
size
>
0
)
{
char
buffer
[
1024
];
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
buffer
,
std
::
min
(
sizeof
(
buffer
),
size
));
if
(
nbytes
==
0
)
return
false
;
size
-=
nbytes
;
}
return
true
;
}
void
decoder_timestamp
(
Decoder
&
decoder
,
double
t
)
{
...
...
src/DecoderAPI.hxx
View file @
cb336ff6
...
...
@@ -117,6 +117,14 @@ decoder_read(Decoder &decoder, InputStream &is,
}
/**
* Skip data on the #InputStream.
*
* @return true on success, false on error or command
*/
bool
decoder_skip
(
Decoder
*
decoder
,
InputStream
&
is
,
size_t
size
);
/**
* Sets the time stamp for the next data chunk [seconds]. The MPD
* core automatically counts it up, and a decoder plugin only needs to
* use this function if it thinks that adding to the time stamp based
...
...
src/decoder/MadDecoderPlugin.cxx
View file @
cb336ff6
...
...
@@ -413,20 +413,7 @@ MadDecoder::ParseId3(size_t tagsize, Tag **mpd_tag)
mad_stream_skip
(
&
stream
,
tagsize
);
}
else
{
mad_stream_skip
(
&
stream
,
count
);
while
(
count
<
tagsize
)
{
size_t
len
=
tagsize
-
count
;
char
ignored
[
1024
];
if
(
len
>
sizeof
(
ignored
))
len
=
sizeof
(
ignored
);
len
=
decoder_read
(
decoder
,
input_stream
,
ignored
,
len
);
if
(
len
==
0
)
break
;
else
count
+=
len
;
}
decoder_skip
(
decoder
,
input_stream
,
tagsize
-
count
);
}
#endif
}
...
...
test/FakeDecoderAPI.cxx
View file @
cb336ff6
...
...
@@ -65,6 +65,22 @@ decoder_read(gcc_unused Decoder *decoder,
return
is
.
LockRead
(
buffer
,
length
,
IgnoreError
());
}
bool
decoder_skip
(
Decoder
*
decoder
,
InputStream
&
is
,
size_t
size
)
{
while
(
size
>
0
)
{
char
buffer
[
1024
];
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
buffer
,
std
::
min
(
sizeof
(
buffer
),
size
));
if
(
nbytes
==
0
)
return
false
;
size
-=
nbytes
;
}
return
true
;
}
void
decoder_timestamp
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
double
t
)
...
...
test/run_decoder.cxx
View file @
cb336ff6
...
...
@@ -101,6 +101,22 @@ decoder_read(gcc_unused Decoder *decoder,
return
is
.
LockRead
(
buffer
,
length
,
IgnoreError
());
}
bool
decoder_skip
(
Decoder
*
decoder
,
InputStream
&
is
,
size_t
size
)
{
while
(
size
>
0
)
{
char
buffer
[
1024
];
size_t
nbytes
=
decoder_read
(
decoder
,
is
,
buffer
,
std
::
min
(
sizeof
(
buffer
),
size
));
if
(
nbytes
==
0
)
return
false
;
size
-=
nbytes
;
}
return
true
;
}
void
decoder_timestamp
(
gcc_unused
Decoder
&
decoder
,
gcc_unused
double
t
)
...
...
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