Babel
Epitech's C++ VoIP project
Public Member Functions | List of all members
Babel::ICodec Class Referenceabstract

#include <ICodec.hpp>

Inheritance diagram for Babel::ICodec:
Collaboration diagram for Babel::ICodec:

Public Member Functions

virtual ~ICodec ()=default
 
virtual int encode (const std::int16_t *pcm, unsigned char *data)=0
 Encodes exactly one frame of audio data. More...
 
virtual int encode (const float *pcm, unsigned char *data)=0
 same as Encode() with floats More...
 
virtual int decode (const unsigned char *data, std::int16_t *pcm, std::int32_t dataSize)=0
 Decodes exactly one frame of audio data. More...
 
virtual int decode (const unsigned char *data, float *pcm)=0
 Same as Decode() with floats. More...
 
virtual std::int32_t getBitrate () const =0
 get the bitrate More...
 
virtual void setBitrate (std::int32_t bitrate)=0
 Sets the bitrate. More...
 
virtual int getChannel () const =0
 get the channels More...
 
virtual void setChannel (int channel)=0
 sets the channel More...
 
virtual int getApplication () const =0
 get the application type More...
 
virtual void setApplication (int application)=0
 sets the Opus application mode Possible values are OPUS_APPLICATION_AUDIO (default) OPUS_APPLICATION_VOIP OPUS_APPLICATION_RESTRICTED_LOWDELAY More...
 
virtual int getFrameSize () const =0
 get the frame size More...
 
virtual void setFrameSize (int frameSize)=0
 sets the number of samples per channel Possible values are 120/480/960 (default)/1920/2880 More...
 

Constructor & Destructor Documentation

◆ ~ICodec()

virtual Babel::ICodec::~ICodec ( )
virtualdefault

Member Function Documentation

◆ decode() [1/2]

virtual int Babel::ICodec::decode ( const unsigned char *  data,
float *  pcm 
)
pure virtual

Same as Decode() with floats.

Implemented in Babel::Opus.

◆ decode() [2/2]

virtual int Babel::ICodec::decode ( const unsigned char *  data,
std::int16_t *  pcm,
std::int32_t  dataSize 
)
pure virtual

Decodes exactly one frame of audio data.

Parameters
datathe frame to decode, can be nullptr in case of packet loss
pcmdecoded data
Returns
number of samples decoded

Implemented in Babel::Opus.

◆ encode() [1/2]

virtual int Babel::ICodec::encode ( const float *  pcm,
unsigned char *  data 
)
pure virtual

same as Encode() with floats

Implemented in Babel::Opus.

◆ encode() [2/2]

virtual int Babel::ICodec::encode ( const std::int16_t *  pcm,
unsigned char *  data 
)
pure virtual

Encodes exactly one frame of audio data.

Parameters
pcmthe frame to encode
dataencoded output

Implemented in Babel::Opus.

◆ getApplication()

virtual int Babel::ICodec::getApplication ( ) const
pure virtual

get the application type

Implemented in Babel::Opus.

◆ getBitrate()

virtual std::int32_t Babel::ICodec::getBitrate ( ) const
pure virtual

get the bitrate

Implemented in Babel::Opus.

◆ getChannel()

virtual int Babel::ICodec::getChannel ( ) const
pure virtual

get the channels

Implemented in Babel::Opus.

◆ getFrameSize()

virtual int Babel::ICodec::getFrameSize ( ) const
pure virtual

get the frame size

Implemented in Babel::Opus.

◆ setApplication()

virtual void Babel::ICodec::setApplication ( int  application)
pure virtual

sets the Opus application mode Possible values are OPUS_APPLICATION_AUDIO (default) OPUS_APPLICATION_VOIP OPUS_APPLICATION_RESTRICTED_LOWDELAY

Implemented in Babel::Opus.

◆ setBitrate()

virtual void Babel::ICodec::setBitrate ( std::int32_t  bitrate)
pure virtual

Sets the bitrate.

Implemented in Babel::Opus.

◆ setChannel()

virtual void Babel::ICodec::setChannel ( int  channel)
pure virtual

sets the channel

Implemented in Babel::Opus.

◆ setFrameSize()

virtual void Babel::ICodec::setFrameSize ( int  frameSize)
pure virtual

sets the number of samples per channel Possible values are 120/480/960 (default)/1920/2880

Implemented in Babel::Opus.


The documentation for this class was generated from the following file: