Class containing Opus encoder and decoder.
More...
#include <Opus.hpp>
Class containing Opus encoder and decoder.
◆ Opus()
◆ ~Opus()
◆ decode() [1/2]
int Babel::Opus::decode |
( |
const unsigned char * |
data, |
|
|
float * |
pcm |
|
) |
| |
|
overridevirtual |
◆ decode() [2/2]
int Babel::Opus::decode |
( |
const unsigned char * |
data, |
|
|
std::int16_t * |
pcm, |
|
|
std::int32_t |
dataSize |
|
) |
| |
|
overridevirtual |
Decodes exactly one frame of audio data.
- Parameters
-
data | the frame to decode, can be nullptr in case of packet loss |
pcm | decoded data |
- Returns
- number of samples decoded
Implements Babel::ICodec.
◆ encode() [1/2]
int Babel::Opus::encode |
( |
const float * |
pcm, |
|
|
unsigned char * |
data |
|
) |
| |
|
overridevirtual |
◆ encode() [2/2]
int Babel::Opus::encode |
( |
const std::int16_t * |
pcm, |
|
|
unsigned char * |
data |
|
) |
| |
|
overridevirtual |
dtor
Encodes exactly one frame of audio data
- Parameters
-
pcm | the frame to encode |
data | encoded output |
Implements Babel::ICodec.
◆ getApplication()
int Babel::Opus::getApplication |
( |
| ) |
const |
|
overridevirtual |
◆ getBitrate()
opus_int32 Babel::Opus::getBitrate |
( |
| ) |
const |
|
overridevirtual |
◆ getChannel()
int Babel::Opus::getChannel |
( |
| ) |
const |
|
overridevirtual |
◆ getFrameSize()
int Babel::Opus::getFrameSize |
( |
| ) |
const |
|
overridevirtual |
◆ isDecoderInitialized()
bool Babel::Opus::isDecoderInitialized |
( |
| ) |
const |
false if decoder failed to initialize
◆ isEncoderInitialized()
bool Babel::Opus::isEncoderInitialized |
( |
| ) |
const |
false if encoder failed to initialize
◆ setApplication()
void Babel::Opus::setApplication |
( |
int |
application | ) |
|
|
overridevirtual |
sets the Opus application mode Possible values are OPUS_APPLICATION_AUDIO (default) OPUS_APPLICATION_VOIP OPUS_APPLICATION_RESTRICTED_LOWDELAY
Implements Babel::ICodec.
◆ setBitrate()
void Babel::Opus::setBitrate |
( |
std::int32_t |
bitrate | ) |
|
|
overridevirtual |
◆ setChannel()
void Babel::Opus::setChannel |
( |
int |
channel | ) |
|
|
overridevirtual |
◆ setFrameSize()
void Babel::Opus::setFrameSize |
( |
int |
frameSize | ) |
|
|
overridevirtual |
sets the number of samples per channel Possible values are 120/480/960 (default)/1920/2880
Implements Babel::ICodec.
◆ _application
int Babel::Opus::_application |
|
private |
Encoder application mode (default OPUS_APPLICATION_VOIP)
◆ _bitrate
opus_int32 Babel::Opus::_bitrate |
|
private |
Decoder and encoder bitrate (default 48000)
◆ _channel
int Babel::Opus::_channel |
|
private |
Decoder and encoder audio channels (default 2)
◆ _dataSize
std::int32_t Babel::Opus::_dataSize |
|
private |
Max duration of the frame in samples (per channel) that can fit into the decoded_frame array.
◆ _decoder
OpusDecoder* Babel::Opus::_decoder |
|
private |
Contains the decoder state.
◆ _decoderIsInitialized
bool Babel::Opus::_decoderIsInitialized |
|
private |
True if decoder state is allocated and initialized, false otherwise.
◆ _encoder
OpusEncoder* Babel::Opus::_encoder |
|
private |
Contains the encoder state.
◆ _encoderIsInitialized
bool Babel::Opus::_encoderIsInitialized |
|
private |
True if encoder state is allocated and initialized, false otherwise.
◆ _frameSize
int Babel::Opus::_frameSize |
|
private |
Number of samples per channel in the input signal (default 960)
◆ _mutex
std::mutex Babel::Opus::_mutex |
|
private |
The documentation for this class was generated from the following files: