2014-06-20 06:03:13 +00:00
|
|
|
#ifndef MPG123_DECODER_H
|
|
|
|
#define MPG123_DECODER_H
|
|
|
|
|
|
|
|
#include "i_soundinternal.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_MPG123
|
|
|
|
|
2014-09-12 11:26:54 +00:00
|
|
|
#ifdef _MSC_VER
|
2014-09-13 02:36:13 +00:00
|
|
|
typedef int ssize_t;
|
2014-09-12 11:26:54 +00:00
|
|
|
#endif
|
2014-06-20 06:03:13 +00:00
|
|
|
#include "mpg123.h"
|
|
|
|
|
|
|
|
struct MPG123Decoder : public SoundDecoder
|
|
|
|
{
|
|
|
|
virtual void getInfo(int *samplerate, ChannelConfig *chans, SampleType *type);
|
|
|
|
|
|
|
|
virtual size_t read(char *buffer, size_t bytes);
|
|
|
|
virtual bool seek(size_t ms_offset);
|
|
|
|
virtual size_t getSampleOffset();
|
2014-06-26 04:14:35 +00:00
|
|
|
virtual size_t getSampleLength();
|
2014-06-20 06:03:13 +00:00
|
|
|
|
2014-06-25 11:25:36 +00:00
|
|
|
MPG123Decoder() : MPG123(0) { }
|
2014-06-20 06:03:13 +00:00
|
|
|
virtual ~MPG123Decoder();
|
|
|
|
|
|
|
|
protected:
|
2014-06-25 11:25:36 +00:00
|
|
|
virtual bool open(FileReader *reader);
|
2014-06-20 06:03:13 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
mpg123_handle *MPG123;
|
|
|
|
bool Done;
|
|
|
|
|
2014-06-25 11:25:36 +00:00
|
|
|
FileReader *Reader;
|
2014-06-20 06:03:13 +00:00
|
|
|
static off_t file_lseek(void *handle, off_t offset, int whence);
|
|
|
|
static ssize_t file_read(void *handle, void *buffer, size_t bytes);
|
|
|
|
|
|
|
|
// Make non-copyable
|
|
|
|
MPG123Decoder(const MPG123Decoder &rhs);
|
|
|
|
MPG123Decoder& operator=(const MPG123Decoder &rhs);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* MPG123_DECODER_H */
|