summaryrefslogtreecommitdiff
path: root/decoders/mpg123_decoder.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-01-06 02:12:25 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-01-06 02:12:25 +0100
commitb5452bc9bc09e66121aae35adbd5c504a3f90466 (patch)
tree30fe30d724772e94b3f590f2a582d19aba40ed24 /decoders/mpg123_decoder.cpp
parent70f111b184928feab0c94f762954b5ec83a441c6 (diff)
Let decoders read a dynamic amount through a Source object.decoder_api_change
Diffstat (limited to 'decoders/mpg123_decoder.cpp')
-rw-r--r--decoders/mpg123_decoder.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/decoders/mpg123_decoder.cpp b/decoders/mpg123_decoder.cpp
index 0c2629f..a195c58 100644
--- a/decoders/mpg123_decoder.cpp
+++ b/decoders/mpg123_decoder.cpp
@@ -26,8 +26,13 @@ DecoderMpg123::~DecoderMpg123() {
mpg123_delete(handle);
}
-size_t DecoderMpg123::decode(const uint8_t *input, size_t input_size, uint8_t *output, size_t output_size) {
- if(mpg123_feed(handle, input, input_size) != MPG123_OK) {
+size_t DecoderMpg123::decode(Source& input, uint8_t *output, size_t output_size) {
+ char src_data[0x2000];
+ std::streamsize src_read = input.read(src_data, 0x2000);
+ if(src_read < 0)
+ src_read = 0;
+
+ if(mpg123_feed(handle, (uint8_t*)src_data, src_read) != MPG123_OK) {
throw std::runtime_error(mpg123_strerror(handle));
}