diff options
Diffstat (limited to 'decoders')
-rw-r--r-- | decoders/mpg123_decoder.cpp | 8 | ||||
-rw-r--r-- | decoders/mpg123_decoder.h | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/decoders/mpg123_decoder.cpp b/decoders/mpg123_decoder.cpp index 0c2629f..0618320 100644 --- a/decoders/mpg123_decoder.cpp +++ b/decoders/mpg123_decoder.cpp @@ -48,3 +48,11 @@ size_t DecoderMpg123::decode(const uint8_t *input, size_t input_size, uint8_t *o return output_written; } + +size_t DecoderMpg123::decode(ReadFunc read, uint8_t *output, size_t output_size) { + char src_data[0x2000]; + std::streamsize src_read = read(src_data, 0x2000); + if(src_read < 0) + src_read = 0; + return decode((const uint8_t*)src_data, src_read, (uint8_t*)output, output_size); +} diff --git a/decoders/mpg123_decoder.h b/decoders/mpg123_decoder.h index 46f9e4c..5a637af 100644 --- a/decoders/mpg123_decoder.h +++ b/decoders/mpg123_decoder.h @@ -8,11 +8,15 @@ class DecoderMpg123 : public DecoderBase { private: mpg123_handle *handle; - + + size_t decode(const uint8_t *input, size_t input_size, uint8_t *output, size_t output_size); + + protected: + virtual size_t decode(ReadFunc read, uint8_t *output, size_t output_size); + public: DecoderMpg123(); ~DecoderMpg123(); - size_t decode(const uint8_t *input, size_t input_size, uint8_t *output, size_t output_size); }; #endif |