FFmpeg
Data Structures | Macros | Functions | Variables
libfdk-aacenc.c File Reference
#include <fdk-aac/aacenc_lib.h>
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "audio_frame_queue.h"
#include "codec_internal.h"
#include "encode.h"
#include "profiles.h"

Go to the source code of this file.

Data Structures

struct  AACContext
 main AAC context More...
 

Macros

#define FDKENC_VER_AT_LEAST(vl0, vl1)   0
 

Functions

static const char * aac_get_error (AACENC_ERROR err)
 
static int aac_encode_close (AVCodecContext *avctx)
 
static void aac_encode_flush (AVCodecContext *avctx)
 
static av_cold int aac_encode_init (AVCodecContext *avctx)
 
static int aac_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 

Variables

static const AVOption aac_enc_options []
 
static const AVClass aac_enc_class
 
static const AVProfile profiles []
 
static const FFCodecDefault aac_encode_defaults []
 
static const AVChannelLayout aac_ch_layouts [16]
 
static const int aac_sample_rates []
 
const FFCodec ff_libfdk_aac_encoder
 

Macro Definition Documentation

◆ FDKENC_VER_AT_LEAST

#define FDKENC_VER_AT_LEAST (   vl0,
  vl1 
)    0

Definition at line 37 of file libfdk-aacenc.c.

Function Documentation

◆ aac_get_error()

static const char* aac_get_error ( AACENC_ERROR  err)
static

Definition at line 94 of file libfdk-aacenc.c.

Referenced by aac_encode_flush(), aac_encode_frame(), and aac_encode_init().

◆ aac_encode_close()

static int aac_encode_close ( AVCodecContext avctx)
static

Definition at line 126 of file libfdk-aacenc.c.

Referenced by aac_encode_init().

◆ aac_encode_flush()

static void aac_encode_flush ( AVCodecContext avctx)
static

Definition at line 137 of file libfdk-aacenc.c.

◆ aac_encode_init()

static av_cold int aac_encode_init ( AVCodecContext avctx)
static

Definition at line 175 of file libfdk-aacenc.c.

◆ aac_encode_frame()

static int aac_encode_frame ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame frame,
int got_packet_ptr 
)
static

Definition at line 446 of file libfdk-aacenc.c.

Variable Documentation

◆ aac_enc_options

const AVOption aac_enc_options[]
static
Initial value:
= {
{ "afterburner", "Afterburner (improved quality)", 0x42, AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "eld_sbr", "Enable SBR for ELD (for SBR in other configurations, use the -profile parameter)", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "signaling", "SBR/PS signaling style", 0x42, AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, .unit = "signaling" },
{ "default", "Choose signaling implicitly (explicit hierarchical by default, implicit if global header is disabled)", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, .unit = "signaling" },
{ "implicit", "Implicit backwards compatible signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, .unit = "signaling" },
{ "explicit_sbr", "Explicit SBR, implicit PS signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, .unit = "signaling" },
{ "explicit_hierarchical", "Explicit hierarchical signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, .unit = "signaling" },
{ "latm", "Output LATM/LOAS encapsulated data", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "header_period", "StreamMuxConfig and PCE repetition period (in frames)", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0xffff, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "vbr", "VBR mode (1-5)", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "drc_profile", "The desired compression profile for AAC DRC", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "drc_target_ref", "Expected target reference level at decoder side in dB (for clipping prevention/limiter)", 0x42, AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "comp_profile", "The desired compression profile for AAC DRC", 0x42, AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 256, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "comp_target_ref", "Expected target reference level at decoder side in dB (for clipping prevention/limiter)", 0x42, AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "prog_ref", "The program reference level or dialog level in dB", 0x42, AV_OPT_TYPE_INT, { .i64 = 0.0 }, -31.75, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ "frame_length", "The desired frame length", 0x42, AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1024, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }
}

Definition at line 63 of file libfdk-aacenc.c.

◆ aac_enc_class

const AVClass aac_enc_class
static
Initial value:
= {
.class_name = "libfdk_aac",
.item_name = av_default_item_name,
.option = aac_enc_options,
}

Definition at line 87 of file libfdk-aacenc.c.

◆ profiles

const AVProfile profiles[]
static
Initial value:
= {
{ AV_PROFILE_AAC_LOW, "LC" },
{ AV_PROFILE_AAC_HE, "HE-AAC" },
{ AV_PROFILE_AAC_HE_V2, "HE-AACv2" },
{ AV_PROFILE_AAC_LD, "LD" },
{ AV_PROFILE_AAC_ELD, "ELD" },
}

Definition at line 546 of file libfdk-aacenc.c.

Referenced by print_profile().

◆ aac_encode_defaults

const FFCodecDefault aac_encode_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ NULL }
}

Definition at line 555 of file libfdk-aacenc.c.

◆ aac_ch_layouts

const AVChannelLayout aac_ch_layouts[16]
static

◆ aac_sample_rates

const int aac_sample_rates[]
static
Initial value:
= {
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000, 0
}

Definition at line 602 of file libfdk-aacenc.c.

◆ ff_libfdk_aac_encoder

const FFCodec ff_libfdk_aac_encoder
Initial value:
= {
.p.name = "libfdk_aac",
CODEC_LONG_NAME("Fraunhofer FDK AAC"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_AAC,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY |
.priv_data_size = sizeof(AACContext),
.flush = aac_encode_flush,
.close = aac_encode_close,
.p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16,
.p.priv_class = &aac_enc_class,
.defaults = aac_encode_defaults,
.p.profiles = profiles,
.p.supported_samplerates = aac_sample_rates,
.p.wrapper_name = "libfdk",
.p.ch_layouts = aac_ch_layouts,
}

Definition at line 607 of file libfdk-aacenc.c.

aac_ch_layouts
static const AVChannelLayout aac_ch_layouts[16]
Definition: libfdk-aacenc.c:582
aac_enc_class
static const AVClass aac_enc_class
Definition: libfdk-aacenc.c:87
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:389
aac_encode_frame
static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: libfdk-aacenc.c:446
aac_encode_init
static av_cold int aac_encode_init(AVCodecContext *avctx)
Definition: libfdk-aacenc.c:175
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
AV_CODEC_CAP_ENCODER_FLUSH
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
Definition: codec.h:166
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:315
AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_SURROUND
Definition: channel_layout.h:392
AV_PROFILE_UNKNOWN
#define AV_PROFILE_UNKNOWN
Definition: defs.h:65
AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_4POINT0
Definition: channel_layout.h:394
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Definition: opt.h:281
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CHANNEL_LAYOUT_5POINT0_BACK
#define AV_CHANNEL_LAYOUT_5POINT0_BACK
Definition: channel_layout.h:400
AV_PROFILE_AAC_ELD
#define AV_PROFILE_AAC_ELD
Definition: defs.h:75
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:283
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
aac_encode_close
static int aac_encode_close(AVCodecContext *avctx)
Definition: libfdk-aacenc.c:126
aac_encode_defaults
static const FFCodecDefault aac_encode_defaults[]
Definition: libfdk-aacenc.c:555
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:445
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AV_PROFILE_AAC_LD
#define AV_PROFILE_AAC_LD
Definition: defs.h:74
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
aac_encode_flush
static void aac_encode_flush(AVCodecContext *avctx)
Definition: libfdk-aacenc.c:137
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
AV_PROFILE_AAC_LOW
#define AV_PROFILE_AAC_LOW
Definition: defs.h:69
AV_PROFILE_AAC_HE_V2
#define AV_PROFILE_AAC_HE_V2
Definition: defs.h:73
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
profiles
static const AVProfile profiles[]
Definition: libfdk-aacenc.c:546
AV_CODEC_CAP_DELAY
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: codec.h:76
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:388
AV_PROFILE_AAC_HE
#define AV_PROFILE_AAC_HE
Definition: defs.h:72
FF_AAC_PROFILE_OPTS
#define FF_AAC_PROFILE_OPTS
Definition: profiles.h:28
aac_sample_rates
static const int aac_sample_rates[]
Definition: libfdk-aacenc.c:602
AACContext
main AAC context
Definition: aac.h:296
AV_CHANNEL_LAYOUT_5POINT1_BACK
#define AV_CHANNEL_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:401
AV_CODEC_CAP_SMALL_LAST_FRAME
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
Definition: codec.h:81
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
aac_enc_options
static const AVOption aac_enc_options[]
Definition: libfdk-aacenc.c:63