diff options
author | Max Kellermann <max@musicpd.org> | 2016-11-17 22:21:36 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2016-11-21 22:43:09 +0100 |
commit | 114fcee2ae897bd5dd740cb04a3f12b7ae60cb3f (patch) | |
tree | ac1b1a8c32dabd6f62339df66289eb28363bee8e /test/FakeDecoderAPI.cxx | |
parent | b488204093d8fcabcb4a523da17f53276946888b (diff) |
decoder/Client: add virtual method Read()
Diffstat (limited to 'test/FakeDecoderAPI.cxx')
-rw-r--r-- | test/FakeDecoderAPI.cxx | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/test/FakeDecoderAPI.cxx b/test/FakeDecoderAPI.cxx index cd8d52cf2..9204835fe 100644 --- a/test/FakeDecoderAPI.cxx +++ b/test/FakeDecoderAPI.cxx @@ -80,51 +80,15 @@ FakeDecoder::OpenUri(const char *uri) } size_t -decoder_read(gcc_unused DecoderClient *client, - InputStream &is, - void *buffer, size_t length) +FakeDecoder::Read(InputStream &is, void *buffer, size_t length) { try { return is.LockRead(buffer, length); - } catch (const std::runtime_error &) { + } catch (const std::runtime_error &e) { return 0; } } -bool -decoder_read_full(DecoderClient *client, InputStream &is, - void *_buffer, size_t size) -{ - uint8_t *buffer = (uint8_t *)_buffer; - - while (size > 0) { - size_t nbytes = decoder_read(client, is, buffer, size); - if (nbytes == 0) - return false; - - buffer += nbytes; - size -= nbytes; - } - - return true; -} - -bool -decoder_skip(DecoderClient *client, InputStream &is, size_t size) -{ - while (size > 0) { - char buffer[1024]; - size_t nbytes = decoder_read(client, is, buffer, - std::min(sizeof(buffer), size)); - if (nbytes == 0) - return false; - - size -= nbytes; - } - - return true; -} - void FakeDecoder::SubmitTimestamp(gcc_unused double t) { |