Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members  

MuseDec Class Reference

#include <decoder.h>

Inherited by MuseDecMp3.

Inheritance diagram for MuseDec:

Inheritance graph
[legend]
List of all members.

Detailed Description

decoder parent abstraction class

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


Constructor & Destructor Documentation

MuseDec::MuseDec  ) 
 

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.

MuseDec::~MuseDec  )  [virtual]
 

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.


Member Function Documentation

virtual IN_DATATYPE* MuseDec::get_audio  )  [pure virtual]
 

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.

Returns:
pointer to decoded pcm buffer

Implemented in MuseDecMp3.

virtual int MuseDec::load char *  file  )  [pure virtual]
 

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.

Parameters:
file full pathname for file, or url accepted by the decoder
Returns:
0 on error, otherwise
  • 1 = success, channel is seekable
  • 2 = success, channel is not seekable

Implemented in MuseDecMp3.

virtual bool MuseDec::seek float  pos  )  [pure virtual]
 

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.

Parameters:
pos floating point value from 0.0 to 1.0
Returns:
true on success, false otherwise

Implemented in MuseDecMp3.


Member Data Documentation

int MuseDec::samplerate
 

samplerate of audio decoded

the following variables describe the audio returned by MuseDec::get_audio and must be setted up by the decoder implementation.

Definition at line 133 of file decoder.h.


The documentation for this class was generated from the following files:
Generated on Sat Apr 17 17:38:49 2004 for MuSE by doxygen1.3