arduino-audio-tools
Loading...
Searching...
No Matches
G7xxEncoder Class Reference

g723_24, g721, g723_40 Encoder based on https://github.com/pschatzmann/codec-g7xx More...

#include <CodecG7xx.h>

Inheritance diagram for G7xxEncoder:
AudioEncoder AudioWriter MimeSource AudioWriter MimeSource AudioInfoSupport AudioInfoSupport AudioInfoSupport AudioInfoSupport G711Encoder G721Encoder G723_24Encoder G723_40Encoder G711_ALAWEncoder G711_ULAWEncoder

Public Member Functions

 G7xxEncoder (G7xxCODEC_e codec)
AudioInfo audioInfo () override
 provides the actual input AudioInfo
AudioInfo audioInfo () override
 provides the actual input AudioInfo
virtual AudioInfo audioInfoOut ()
virtual AudioInfo audioInfoOut ()
virtual bool begin (AudioInfo info)
bool begin () override
void end () override
virtual uint32_t frameDurationUs ()
 Optional rtsp function: provide the frame duration in microseconds.
virtual uint32_t frameDurationUs ()
 Optional rtsp function: provide the frame duration in microseconds.
virtual int frameSize ()
virtual int frameSize ()
const char * mime () override
 Provides the mime type of the encoded result.
 operator bool ()
virtual uint16_t samplesPerFrame ()
 Optional rtsp function: provide samples per the frame.
virtual uint16_t samplesPerFrame ()
 Optional rtsp function: provide samples per the frame.
void setAudioInfo (AudioInfo from) override
 Defines the sample rate, number of channels and bits per sample.
virtual void setAudioInfo (AudioInfo info)
void setOutput (Print &out_stream) override
 Default output assignment (encoders may override to store Print reference).
size_t write (const uint8_t *data, size_t len) override

Protected Member Functions

void writeBlocking (Print *out, uint8_t *data, size_t len)
void writeBlocking (Print *out, uint8_t *data, size_t len)

Protected Attributes

unsigned char code
int enc_bits
int(* enc_routine )(int sample, int in_coding, struct g72x_state *state_ptr)
AudioInfo info
bool is_active = false
int out_bits = 0
unsigned int out_buffer = 0
const char * p_mime = nullptr
Print * p_print = nullptr
int resid
unsigned char sample_char
int16_t sample_int16
struct g72x_state state

Detailed Description

g723_24, g721, g723_40 Encoder based on https://github.com/pschatzmann/codec-g7xx

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ G7xxEncoder()

G7xxEncoder ( G7xxCODEC_e codec)
inline

Member Function Documentation

◆ audioInfo() [1/2]

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

provides the actual input AudioInfo

Implements AudioInfoSupport.

Reimplemented in CodecNOP, CodecNOP, BinaryContainerEncoder, CodecNOP, MP3EncoderShine, and MP3ParserEncoder.

◆ audioInfo() [2/2]

AudioInfo audioInfo ( )
inlineoverridevirtualinherited

provides the actual input AudioInfo

Implements AudioInfoSupport.

Reimplemented in CodecNOP, CodecNOP, BinaryContainerEncoder, CodecNOP, MP3EncoderShine, and MP3ParserEncoder.

◆ audioInfoOut() [1/2]

◆ audioInfoOut() [2/2]

◆ begin() [1/2]

virtual bool begin ( AudioInfo info)
inlinevirtualinherited

Reimplemented in AudioDecoder, and AudioDecoder.

◆ begin() [2/2]

bool begin ( )
inlineoverridevirtual

Implements AudioWriter.

◆ end()

void end ( )
inlineoverridevirtual

Implements AudioWriter.

◆ frameDurationUs() [1/2]

virtual uint32_t frameDurationUs ( )
inlinevirtualinherited

Optional rtsp function: provide the frame duration in microseconds.

Reimplemented in ADPCMEncoder, MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, and OpusOggEncoder.

◆ frameDurationUs() [2/2]

virtual uint32_t frameDurationUs ( )
inlinevirtualinherited

Optional rtsp function: provide the frame duration in microseconds.

Reimplemented in ADPCMEncoder, MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, and OpusOggEncoder.

◆ frameSize() [1/2]

virtual int frameSize ( )
inlinevirtualinherited

Optional rtsp function: provide the encoded size (in bytes) of one frame, once known (e.g. after the encoder has seen real data). Lets an RTSPFormat size its RTP fragments to match one frame instead of a fixed guess, so throughput actually tracks frameDurationUs() - a fragment size covering several frames' worth of bytes sent at one-frame timing overruns real-time bandwidth and, over UDP (no flow control), causes packet loss. Returns 0 if not yet known/not applicable (fixed-frame-size codecs have no need to override this).

Reimplemented in ADPCMEncoder, AMRNBEncoder, AMRWBEncoder, EncoderALAC, and MP3ParserEncoder.

◆ frameSize() [2/2]

virtual int frameSize ( )
inlinevirtualinherited

Optional rtsp function: provide the encoded size (in bytes) of one frame, once known (e.g. after the encoder has seen real data). Lets an RTSPFormat size its RTP fragments to match one frame instead of a fixed guess, so throughput actually tracks frameDurationUs() - a fragment size covering several frames' worth of bytes sent at one-frame timing overruns real-time bandwidth and, over UDP (no flow control), causes packet loss. Returns 0 if not yet known/not applicable (fixed-frame-size codecs have no need to override this).

Reimplemented in ADPCMEncoder, AMRNBEncoder, AMRWBEncoder, EncoderALAC, and MP3ParserEncoder.

◆ mime()

const char * mime ( )
inlineoverridevirtual

Provides the mime type of the encoded result.

Implements AudioEncoder.

◆ operator bool()

operator bool ( )
inlinevirtual

Implements AudioWriter.

◆ samplesPerFrame() [1/2]

virtual uint16_t samplesPerFrame ( )
inlinevirtualinherited

Optional rtsp function: provide samples per the frame.

Reimplemented in MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, OpusAudioEncoder, and OpusMultiStreamAudioEncoder.

◆ samplesPerFrame() [2/2]

virtual uint16_t samplesPerFrame ( )
inlinevirtualinherited

Optional rtsp function: provide samples per the frame.

Reimplemented in MetaDataFilterEncoder, MP3EncoderShine, MP3ParserEncoder, OpusAudioEncoder, and OpusMultiStreamAudioEncoder.

◆ setAudioInfo() [1/2]

void setAudioInfo ( AudioInfo from)
inlineoverridevirtualinherited

Defines the sample rate, number of channels and bits per sample.

Implements AudioWriter.

Reimplemented in CodecNOP, and CodecNOP.

◆ setAudioInfo() [2/2]

virtual void setAudioInfo ( AudioInfo info)
inlinevirtual

◆ setOutput()

void setOutput ( Print & out_stream)
inlineoverridevirtual

Default output assignment (encoders may override to store Print reference).

Reimplemented from AudioEncoder.

◆ write()

size_t write ( const uint8_t * data,
size_t len )
inlineoverridevirtual

Implements AudioWriter.

◆ writeBlocking() [1/2]

void writeBlocking ( Print * out,
uint8_t * data,
size_t len )
inlineprotectedinherited

◆ writeBlocking() [2/2]

void writeBlocking ( Print * out,
uint8_t * data,
size_t len )
inlineprotectedinherited

Member Data Documentation

◆ code

unsigned char code
protected

◆ enc_bits

int enc_bits
protected

◆ enc_routine

int(* enc_routine) (int sample, int in_coding, struct g72x_state *state_ptr)
protected

◆ info

AudioInfo info
protectedinherited

◆ is_active

bool is_active = false
protected

◆ out_bits

int out_bits = 0
protected

◆ out_buffer

unsigned int out_buffer = 0
protected

◆ p_mime

const char* p_mime = nullptr
protected

◆ p_print

Print* p_print = nullptr
protected

◆ resid

int resid
protected

◆ sample_char

unsigned char sample_char
protected

◆ sample_int16

int16_t sample_int16
protected

◆ state

struct g72x_state state
protected

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