diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/FakeDecoderAPI.cxx | 16 | ||||
-rw-r--r-- | test/run_decoder.cxx | 16 |
2 files changed, 32 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) diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index 2f7330a1d..cab68c64e 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -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) |