aboutsummaryrefslogtreecommitdiffstats
path: root/test/FakeDecoderAPI.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-14 12:21:23 +0100
committerMax Kellermann <max@duempel.org>2014-07-09 19:03:31 +0200
commitbf7417981f2527348fb261f40f4de15f9b350db5 (patch)
treefc9f5ef2ade165e14189b7218b82637b123080bb /test/FakeDecoderAPI.cxx
parentdba41e2e4afd9cf342a6274cd8103dc45b5b883e (diff)
downloadmpd-bf7417981f2527348fb261f40f4de15f9b350db5.tar.gz
mpd-bf7417981f2527348fb261f40f4de15f9b350db5.tar.xz
mpd-bf7417981f2527348fb261f40f4de15f9b350db5.zip
DecoderAPI: add function decoder_skip()
Move code from the "mad" plugin.
Diffstat (limited to 'test/FakeDecoderAPI.cxx')
-rw-r--r--test/FakeDecoderAPI.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/FakeDecoderAPI.cxx b/test/FakeDecoderAPI.cxx
index e2040b40d..469e37feb 100644
--- a/test/FakeDecoderAPI.cxx
+++ b/test/FakeDecoderAPI.cxx
@@ -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)