Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AACEncoderFDK Class Reference

Encodes PCM data to the AAC format and writes the result to a stream This is basically just a wrapper using More...

#include <CodecAACFDK.h>

Inheritance diagram for AACEncoderFDK:
AudioEncoder AudioWriter

Public Member Functions

 AACEncoderFDK (Print &out_stream)
void begin ()
virtual void begin (AudioInfo info)
 Opens the encoder
virtual void begin (int input_channels=2, int input_sample_rate=44100, int input_bits_per_sample=16)
 Opens the encoder
aac_fdk::AACEncoderFDK * driver ()
void end ()
UINT getParameter (const AACENC_PARAM param)
const char * mime ()
 Provides the mime type of the encoded result.
 operator bool ()
virtual void setAfterburner (bool afterburner)
virtual void setAudioInfo (AudioInfo from)
 Defines the Audio Info.
virtual void setAudioObjectType (int aot)
virtual void setBitrate (int bitrate)
void setOutput (Print &out_stream)
virtual void setOutputBufferSize (int outbuf_size)
 Set the Output Buffer Size object. More...
int setParameter (AACENC_PARAM param, uint32_t value)
virtual void setSpectralBandReplication (int eld_sbr)
virtual void setVariableBitrateMode (int vbr)
size_t write (const void *in_ptr, size_t in_size)

Protected Member Functions

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

Protected Attributes

aac_fdk::AACEncoderFDK * enc =nullptr

Detailed Description

Encodes PCM data to the AAC format and writes the result to a stream This is basically just a wrapper using

Phil Schatzmann

Member Function Documentation

◆ begin() [1/2]

virtual void begin ( AudioInfo  info)

Opens the encoder


Reimplemented from AudioWriter.

◆ begin() [2/2]

virtual void begin ( int  input_channels = 2,
int  input_sample_rate = 44100,
int  input_bits_per_sample = 16 

Opens the encoder

int 0 => ok; error with negative number

◆ setAfterburner()

virtual void setAfterburner ( bool  afterburner)

Configure SBR independently of the chosen Audio Object Type ::AUDIO_OBJECT_TYPE. This parameter is for ELD audio object type only.

  • -1: Use ELD SBR auto configurator (default).
  • 0: Disable Spectral Band Replication.
  • 1: Enable Spectral Band Replication.

◆ setAudioObjectType()

virtual void setAudioObjectType ( int  aot)

This parameter controls the use of the afterburner feature. The afterburner is a type of analysis by synthesis algorithm which increases the audio quality but also the required processing power. It is recommended to always activate this if additional memory consumption and processing power consumption is not a problem. If increased MHz and memory consumption are an issue then the MHz and memory cost of this optional module need to be evaluated against the improvement in audio quality on a case by case basis.

  • 0: Disable afterburner (default).
  • 1: Enable afterburner.

◆ setBitrate()

virtual void setBitrate ( int  bitrate)

Audio object type. See ::AUDIO_OBJECT_TYPE in FDK_audio.h.

  • 2: MPEG-4 AAC Low Complexity.
  • 5: MPEG-4 AAC Low Complexity with Spectral Band Replication (HE-AAC).
  • 29: MPEG-4 AAC Low Complexity with Spectral Band Replication and Parametric Stereo (HE-AAC v2). This configuration can be used only with stereo input audio data.
  • 23: MPEG-4 AAC Low-Delay.
  • 39: MPEG-4 AAC Enhanced Low-Delay. Since there is no ::AUDIO_OBJECT_TYPE for ELD in combination with SBR defined, enable SBR explicitely by ::AACENC_SBR_MODE parameter. The ELD v2 212 configuration can be configured by ::AACENC_CHANNELMODE parameter.
  • 129: MPEG-2 AAC Low Complexity.
  • 132: MPEG-2 AAC Low Complexity with Spectral Band Replication (HE-AAC).

Please note that the virtual MPEG-2 AOT's basically disables non-existing Perceptual Noise Substitution tool in AAC encoder and controls the MPEG_ID flag in adts header. The virtual MPEG-2 AOT doesn't prohibit specific transport formats.

◆ setOutput()

void setOutput ( Print out_stream)

Total encoder bitrate. This parameter is
mandatory and interacts with ::AACENC_BITRATEMODE.

  • CBR: Bitrate in bits/second.
  • VBR: Variable bitrate. Bitrate argument will be ignored. See suppBitrates for details.

Implements AudioWriter.

◆ setOutputBufferSize()

virtual void setOutputBufferSize ( int  outbuf_size)

Set the Output Buffer Size object.


◆ setSpectralBandReplication()

virtual void setSpectralBandReplication ( int  eld_sbr)

Bitrate mode. Configuration can be different kind of bitrate configurations:

  • 0: Constant bitrate, use bitrate according to ::AACENC_BITRATE. (default) Within none LD/ELD ::AUDIO_OBJECT_TYPE, the CBR mode makes use of full allowed bitreservoir. In contrast, at Low-Delay ::AUDIO_OBJECT_TYPE the bitreservoir is kept very small.
  • 1: Variable bitrate mode, very low bitrate.
  • 2: Variable bitrate mode, low bitrate.
  • 3: Variable bitrate mode, medium bitrate.
  • 4: Variable bitrate mode, high bitrate.
  • 5: Variable bitrate mode, very high bitrate.

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