|
arduino-audio-tools
|
AAC Encoder (AAC-LC and HE-AAC v1) using faac: https://github.com/pschatzmann/codec-faac. More...
#include <CodecAACFAAC.h>
Public Member Functions | |
| AACEncoderFAAC ()=default | |
| AACEncoderFAAC (Print &out_stream) | |
| ~AACEncoderFAAC () override | |
| AudioInfo | audioInfo () override |
| provides the actual input AudioInfo | |
| virtual AudioInfo | audioInfoOut () |
| bool | begin () override |
| bool | begin (AudioInfo info) override |
| faac_encoder * | driver () |
| Provides access to the faac encoder handle. | |
| faac_encoder_info & | encoderInfo () |
| Provides the information of the opened encoder. | |
| void | end () override |
| Encodes the remaining data and releases the encoder. | |
| virtual uint32_t | frameDurationUs () |
| Optional rtsp function: provide the frame duration in microseconds. | |
| virtual int | frameSize () |
| bool | getAudioSpecificConfig (const uint8_t *&data, uint32_t &len) |
| const char * | mime () override |
| Provides the mime type of the encoded result. | |
| operator bool () override | |
| virtual uint16_t | samplesPerFrame () |
| Optional rtsp function: provide samples per the frame. | |
| void | setAdts (bool enabled) |
| Defines if ADTS headers are generated (default true) | |
| void | setAudioInfo (AudioInfo from) override |
| Defines the sample rate, number of channels and bits per sample. | |
| void | setBitrate (uint32_t bps) |
| void | setObjectType (faac_object_type type) |
| void | setOutput (Print &out_stream) override |
| Defines the output stream. | |
| void | setQuality (uint32_t quality) |
| void | setRateControl (faac_rate_control rc) |
| size_t | write (const uint8_t *data, size_t len) override |
Protected Member Functions | |
| bool | encode (const int16_t *samples, uint32_t sample_count, uint32_t *p_written=nullptr) |
| void | writeBlocking (Print *out, uint8_t *data, size_t len) |
Static Protected Member Functions | |
| static uint32_t | defaultBitrate (AudioInfo info) |
Protected Attributes | |
| uint32_t | bitrate = (uint32_t)-1 |
| faac_encoder * | enc = nullptr |
| faac_encoder_info | enc_info |
| size_t | frame_samples = 0 |
| AudioInfo | info |
| faac_object_type | object_type = FAAC_OBJ_LOW |
| Vector< uint8_t > | out_buffer {0} |
| Print * | p_print = nullptr |
| Vector< int16_t > | pcm_buffer {0} |
| size_t | pcm_pos = 0 |
| uint32_t | quant_quality = 0 |
| faac_rate_control | rate_control = FAAC_RC_AUTO |
| bool | use_adts = true |
AAC Encoder (AAC-LC and HE-AAC v1) using faac: https://github.com/pschatzmann/codec-faac.
The encoder consumes PCM in frames of 1024 (LC) or 2048 (HE-AAC) samples per channel, so this class buffers arbitrary write sizes and encodes full frames automatically. By default ADTS is generated: if you want raw AAC frames call setAdts(false) and use getAudioSpecificConfig() to get the ASC. Only 16 bit PCM input is supported.
|
default |
|
inline |
|
inlineoverride |
|
inlineoverridevirtualinherited |
provides the actual input AudioInfo
Implements AudioInfoSupport.
Reimplemented in CodecNOP, MP3EncoderShine, BinaryContainerEncoder, and MP3ParserEncoder.
|
inlinevirtualinherited |
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in MP3EncoderShine, PureDataStream, PWMAudioOutput< PWMDriverT >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, ResampleStreamT< TInterpolator >, and SupportedRatesStream.
|
inlineoverridevirtual |
Implements AudioWriter.
|
inlineoverridevirtual |
Reimplemented from AudioWriter.
|
inlinestaticprotected |
Scales FAAC_DEFAULT_BITRATE (defined for stereo @ 44100 Hz) by sample rate and channel count.
|
inline |
Provides access to the faac encoder handle.
|
inlineprotected |
|
inline |
Provides the information of the opened encoder.
|
inlineoverridevirtual |
Encodes the remaining data and releases the encoder.
Implements AudioWriter.
|
inlinevirtualinherited |
Optional rtsp function: provide the frame duration in microseconds.
Reimplemented in ADPCMEncoder, MP3EncoderShine, OpusOggEncoder, MP3ParserEncoder, and MetaDataFilterEncoder.
|
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, EncoderALAC, AMRNBEncoder, AMRWBEncoder, and MP3ParserEncoder.
|
inline |
Provides the AudioSpecificConfig (needed for raw output e.g. in a MP4 container). Returns false if not available.
|
inlineoverridevirtual |
Provides the mime type of the encoded result.
Implements AudioEncoder.
|
inlineoverridevirtual |
Implements AudioWriter.
|
inlinevirtualinherited |
Optional rtsp function: provide samples per the frame.
Reimplemented in OpusAudioEncoder, OpusMultiStreamAudioEncoder, MP3EncoderShine, MP3ParserEncoder, and MetaDataFilterEncoder.
|
inline |
Defines if ADTS headers are generated (default true)
|
inlineoverridevirtualinherited |
Defines the sample rate, number of channels and bits per sample.
Implements AudioWriter.
Reimplemented in MP3EncoderLAME, EncoderBasic, CodecChain, DSFEncoder, FLACEncoder, MP3EncoderShine, OpusAudioEncoder, OpusMultiStreamAudioEncoder, WAVEncoder, CodecNOP, G7xxEncoder, G729Encoder, BinaryContainerEncoder, OggContainerEncoder, OSCContainerEncoder, H264RtpEncoder, JPEGRtpEncoder, and MetaDataFilterEncoder.
|
inline |
Defines the total target bitrate in bps (for all channels). If not called, the bitrate is derived from FAAC_DEFAULT_BITRATE.
|
inline |
Defines the object type: FAAC_OBJ_AUTO, FAAC_OBJ_LOW (default) or FAAC_OBJ_HE_AAC_V1
|
inlineoverridevirtual |
Defines the output stream.
Reimplemented from AudioEncoder.
|
inline |
Defines the quantizer quality (1..5000) for VBR: it is only used if the bitrate is 0
|
inline |
Defines the rate control: FAAC_RC_AUTO (default), FAAC_RC_VBR, FAAC_RC_ABR or FAAC_RC_CBR
|
inlineoverridevirtual |
Implements AudioWriter.
|
inlineprotectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |