FFmpeg
Loading...
Searching...
No Matches
audiotoolboxenc.c File Reference
#include <AudioToolbox/AudioToolbox.h>
#include "libavfilter/bufferqueue.h"
#include "config.h"
#include "audio_frame_queue.h"
#include "avcodec.h"
#include "bytestream.h"
#include "codec_internal.h"
#include "encode.h"
#include "internal.h"
#include "libavformat/isom.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/log.h"

Go to the source code of this file.

Data Structures

struct  ATDecodeContext
 

Macros

#define FF_BUFQUEUE_SIZE   256
 
#define AE   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 
#define FFAT_ENC_CLASS(NAME)
 
#define FFAT_ENC(NAME, ID, PROFILES, CAPS, CHANNEL_LAYOUTS, CH_LAYOUTS)
 

Functions

static UInt32 ffat_get_format_id (enum AVCodecID codec, int profile)
 
static int ffat_update_ctx (AVCodecContext *avctx)
 
static int read_descr (GetByteContext *gb, int *tag)
 
static int get_ilbc_mode (AVCodecContext *avctx)
 
static av_cold int get_channel_label (int channel)
 
static int remap_layout (AudioChannelLayout *layout, const AVChannelLayout *in_layout)
 
static int get_aac_tag (const AVChannelLayout *in_layout)
 
static av_cold int ffat_init_encoder (AVCodecContext *avctx)
 
static OSStatus ffat_encode_callback (AudioConverterRef converter, UInt32 *nb_packets, AudioBufferList *data, AudioStreamPacketDescription **packets, void *inctx)
 
static int ffat_encode (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 
static av_cold void ffat_encode_flush (AVCodecContext *avctx)
 
static av_cold int ffat_close_encoder (AVCodecContext *avctx)
 

Variables

static const AVProfile aac_profiles []
 
static const AVOption options []
 
static const AVChannelLayout aac_at_ch_layouts []
 

Macro Definition Documentation

◆ FF_BUFQUEUE_SIZE

#define FF_BUFQUEUE_SIZE   256

◆ AE

Definition at line 617 of file audiotoolboxenc.c.

◆ FFAT_ENC_CLASS

#define FFAT_ENC_CLASS ( NAME)
Value:
static const AVClass ffat_##NAME##_enc_class = { \
.class_name = "at_" #NAME "_enc", \
.item_name = av_default_item_name, \
.option = options, \
.version = LIBAVUTIL_VERSION_INT, \
};
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85
Describe the class of an AVClass context structure.
Definition log.h:76

Definition at line 631 of file audiotoolboxenc.c.

◆ FFAT_ENC

#define FFAT_ENC ( NAME,
ID,
PROFILES,
CAPS,
CHANNEL_LAYOUTS,
CH_LAYOUTS )
Value:
const FFCodec ff_##NAME##_at_encoder = { \
.p.name = #NAME "_at", \
CODEC_LONG_NAME(#NAME " (AudioToolbox)"), \
.p.type = AVMEDIA_TYPE_AUDIO, \
.p.id = ID, \
.priv_data_size = sizeof(ATDecodeContext), \
.flush = ffat_encode_flush, \
.p.priv_class = &ffat_##NAME##_enc_class, \
.p.capabilities = AV_CODEC_CAP_DELAY | \
.p.profiles = PROFILES, \
.p.wrapper_name = "at", \
CODEC_CH_LAYOUTS_ARRAY(CH_LAYOUTS), \
CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), \
};
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
static av_cold int ffat_close_encoder(AVCodecContext *avctx)
static av_cold void ffat_encode_flush(AVCodecContext *avctx)
static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static av_cold int ffat_init_encoder(AVCodecContext *avctx)
#define FFAT_ENC_CLASS(NAME)
#define FF_CODEC_ENCODE_CB(func)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
Definition codec.h:154
#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:79
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition samplefmt.h:57
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition samplefmt.h:58
#define ID(_0)
Definition mov_chan.c:124

Definition at line 639 of file audiotoolboxenc.c.

Function Documentation

◆ ffat_get_format_id()

static UInt32 ffat_get_format_id ( enum AVCodecID codec,
int profile )
static

Definition at line 59 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

◆ ffat_update_ctx()

static int ffat_update_ctx ( AVCodecContext * avctx)
static

Definition at line 96 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

◆ read_descr()

static int read_descr ( GetByteContext * gb,
int * tag )
static

Definition at line 151 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

◆ get_ilbc_mode()

static int get_ilbc_mode ( AVCodecContext * avctx)
static

Definition at line 165 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

◆ get_channel_label()

static av_cold int get_channel_label ( int channel)
static

Definition at line 177 of file audiotoolboxenc.c.

Referenced by remap_layout().

◆ remap_layout()

static int remap_layout ( AudioChannelLayout * layout,
const AVChannelLayout * in_layout )
static

Definition at line 202 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

◆ get_aac_tag()

static int get_aac_tag ( const AVChannelLayout * in_layout)
static

Definition at line 222 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

◆ ffat_init_encoder()

static av_cold int ffat_init_encoder ( AVCodecContext * avctx)
static

Definition at line 251 of file audiotoolboxenc.c.

◆ ffat_encode_callback()

static OSStatus ffat_encode_callback ( AudioConverterRef converter,
UInt32 * nb_packets,
AudioBufferList * data,
AudioStreamPacketDescription ** packets,
void * inctx )
static

Definition at line 474 of file audiotoolboxenc.c.

Referenced by ffat_encode().

◆ ffat_encode()

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

Definition at line 516 of file audiotoolboxenc.c.

◆ ffat_encode_flush()

static av_cold void ffat_encode_flush ( AVCodecContext * avctx)
static

Definition at line 589 of file audiotoolboxenc.c.

◆ ffat_close_encoder()

static av_cold int ffat_close_encoder ( AVCodecContext * avctx)
static

Definition at line 597 of file audiotoolboxenc.c.

Variable Documentation

◆ aac_profiles

const AVProfile aac_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" },
}
#define AV_PROFILE_AAC_HE
Definition defs.h:72
#define AV_PROFILE_UNKNOWN
Definition defs.h:65
#define AV_PROFILE_AAC_LOW
Definition defs.h:69
#define AV_PROFILE_AAC_HE_V2
Definition defs.h:73
#define AV_PROFILE_AAC_LD
Definition defs.h:74
#define AV_PROFILE_AAC_ELD
Definition defs.h:75

Definition at line 608 of file audiotoolboxenc.c.

Referenced by matroska_aac_sri().

◆ options

const AVOption options[]
static
Initial value:
= {
{"aac_at_mode", "ratecontrol mode", 0x42 , AV_OPT_TYPE_INT, {.i64 = -1}, -1, kAudioCodecBitRateControlMode_Variable, AE, .unit = "mode"},
{"auto", "VBR if global quality is given; CBR otherwise", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, INT_MIN, INT_MAX, AE, .unit = "mode"},
{"cbr", "constant bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_Constant}, INT_MIN, INT_MAX, AE, .unit = "mode"},
{"abr", "long-term average bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_LongTermAverage}, INT_MIN, INT_MAX, AE, .unit = "mode"},
{"cvbr", "constrained variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_VariableConstrained}, INT_MIN, INT_MAX, AE, .unit = "mode"},
{"vbr" , "variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_Variable}, INT_MIN, INT_MAX, AE, .unit = "mode"},
{"aac_at_quality", "quality vs speed control", 0x42 , AV_OPT_TYPE_INT, {.i64 = 0}, 0, 2, AE},
{ NULL },
}
#define AE
Definition alacenc.c:622
#define NULL
Definition coverity.c:32
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258

Definition at line 618 of file audiotoolboxenc.c.

◆ aac_at_ch_layouts

const AVChannelLayout aac_at_ch_layouts[]
static
Initial value:
= {
{ 0 },
}
#define AV_CHANNEL_LAYOUT_4POINT0
#define AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_6POINT0
#define AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_7POINT0
#define AV_CHANNEL_LAYOUT_SURROUND
#define AV_CHANNEL_LAYOUT_OCTAGONAL
#define AV_CHANNEL_LAYOUT_QUAD
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK
#define AV_CHANNEL_LAYOUT_6POINT1

Definition at line 660 of file audiotoolboxenc.c.