diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-01-11 18:03:51 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-01-11 18:03:51 +0100 |
commit | 329d8640f0c6d947d578586c03cb692b50df1d7b (patch) | |
tree | 8d83997ae511edec4c2388d81b6ef9330e9d8e1e /encoders | |
parent | 0649a5c78eeef6eba731ee1c698e18554cad5670 (diff) |
Moved EncoderLame's encode() and flush() into read().
Diffstat (limited to 'encoders')
-rw-r--r-- | encoders/lame_encoder.cpp | 14 | ||||
-rw-r--r-- | encoders/lame_encoder.h | 3 |
2 files changed, 3 insertions, 14 deletions
diff --git a/encoders/lame_encoder.cpp b/encoders/lame_encoder.cpp index 6616b87..f3816bf 100644 --- a/encoders/lame_encoder.cpp +++ b/encoders/lame_encoder.cpp @@ -15,24 +15,16 @@ EncoderLame::~EncoderLame() { lame_close(gfp); } -size_t EncoderLame::encode(const uint8_t *input, size_t input_size, uint8_t *output, size_t output_size) { - return lame_encode_buffer_interleaved(gfp, (short*)input, input_size / 4, output, output_size); -} - -size_t EncoderLame::flush(uint8_t *output, size_t output_size) { - return lame_encode_flush(gfp, output, output_size); -} - std::size_t EncoderLame::read(char* buf, std::size_t buf_size) { char src_data[0x30000]; std::streamsize src_read = source->read(src_data, 0x30000); if(src_read < 0) src_read = 0; - std::streamsize size = encode((const uint8_t*)src_data, src_read, (uint8_t*)buf, buf_size); + std::size_t size = lame_encode_buffer_interleaved(gfp, (short*)src_data, src_read / 4, (unsigned char*)buf, buf_size); // no more data, flush encoder if(src_read == 0 && size == 0) { - size = flush((uint8_t*)buf, buf_size); + size = lame_encode_flush(gfp, (unsigned char*)buf, buf_size); } return size; -}
\ No newline at end of file +} diff --git a/encoders/lame_encoder.h b/encoders/lame_encoder.h index d150f60..79bc944 100644 --- a/encoders/lame_encoder.h +++ b/encoders/lame_encoder.h @@ -11,9 +11,6 @@ class EncoderLame : public Encoder { private: lame_global_flags *gfp; RawAudioSource::p source; - - size_t encode(const uint8_t *input, size_t input_size, uint8_t *output, size_t output_size); - size_t flush(uint8_t *output, size_t output_size); public: EncoderLame(RawAudioSource::p source_); |