#include <decoder.h>
Inherited by MuseDecMp3.
Inheritance diagram for MuseDec:
This class should be inherited by every decoder implementation: it is the decoder parent class giving some common functionalities to its childs.
Most important thing for making decoders is to implement the pure virtual functions of this class, inheriting all the rest. The pure virtual functions to be carefully implemented in a decoder are:
For example decoder implementations, please refer to:
Definition at line 66 of file decoder.h.
Public Member Functions | |
MuseDec () | |
decoder parent class constructor | |
virtual | ~MuseDec () |
decoder parent class destructor | |
virtual int | load (char *file)=0 |
open file in decoder | |
virtual bool | seek (float pos)=0 |
seek to a position | |
virtual IN_DATATYPE * | get_audio ()=0 |
decode a chunk of channel audio | |
void | lock () |
void | unlock () |
Public Attributes | |
char | name [5] |
decoder short name (3 letters) | |
int | samplerate |
samplerate of audio decoded | |
int | channels |
number of audio channels decoded | |
int | bitrate |
bitrate of the compressed audio being decoded | |
int | frames |
quantity of audio frames (16bit words) decoded | |
int | framepos |
position offset on the frames | |
int | frametot |
total frames in opened audio (if seekable, othwrwise 0) | |
int | fps |
samplerate / frames quantity | |
bool | seekable |
true if the channel audio is seekable | |
bool | eos |
true on end of stream reached | |
bool | err |
true when an error occurred during audio decoding |
|
decoder parent class constructor The decoder implementations inheriting from this class can use their constructor to initialize their variables and to fill up the MuseDec::name buffer with their identification. Definition at line 8 of file decoder.cpp. |
|
decoder parent class destructor A decoder implementation should take care to close all files and free all buffers in the destructor. Definition at line 16 of file decoder.cpp. |
|
decode a chunk of channel audio Decode another chunk of audio for the channel at the current position, this function is implementing the low-level decoder functionalities to obtain the audio pcm to be mixed. The audio will be then resampled at a common rate and mixed by MuSE. This is a pure virtual function: needs to be implemented in decoders.
Implemented in MuseDecMp3. |
|
open file in decoder Open up a filename (full path) and makes it ready for decoding, the filename or url can be formed in different ways, depending on the decoder implementation. This is a pure virtual function: needs to be implemented in decoders.
Implemented in MuseDecMp3. |
|
seek to a position Seek position over the audio data available to an opened channel. This operation is only possible if the channel is seekable (see the flag in this class and the return code of MuseDec::load). This is a pure virtual function: needs to be implemented in decoders.
Implemented in MuseDecMp3. |
|
samplerate of audio decoded the following variables describe the audio returned by MuseDec::get_audio and must be setted up by the decoder implementation. |