X-Git-Url: http://git.tdb.fi/?p=libs%2Fal.git;a=blobdiff_plain;f=source%2Fmp3decoder.h;fp=source%2Fmp3decoder.h;h=06060de0671b0fbf872df4a8d2cda1f339ac0e90;hp=0000000000000000000000000000000000000000;hb=0e266d73f9aab89410c736e969eaa51ef914acf1;hpb=d035e638b940f25cb5d46a049a00b34dc60dc5e0 diff --git a/source/mp3decoder.h b/source/mp3decoder.h new file mode 100644 index 0000000..06060de --- /dev/null +++ b/source/mp3decoder.h @@ -0,0 +1,49 @@ +#ifndef MSP_AL_MP3DECODER_H_ +#define MSP_AL_MP3DECODER_H_ + +#include +#include "sounddecoder.h" + +namespace Msp { +namespace AL { + +class mp3_error: public std::runtime_error +{ +public: + mp3_error(const std::string &, int); + virtual ~mp3_error() throw() { } + +private: + static std::string get_message(int); +}; + + +class Mp3Decoder: public SoundDecoder +{ +private: + struct Private; + + Private *priv; + IO::Seekable ∈ + unsigned in_buf_size; + char *in_buffer; + unsigned read_pos; + +public: + Mp3Decoder(IO::Seekable &); + virtual ~Mp3Decoder(); + + static bool detect(const std::string &); + + virtual void rewind(); + virtual unsigned read(char *, unsigned); + +private: + bool fill_input(); + bool decode_frame(); +}; + +} // namespace AL +} // namespace Msp + +#endif