FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
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 "internal.h"
#include "libavformat/isom.h"
#include "libavutil/avassert.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,...)
 

Functions

static UInt32 ffat_get_format_id (enum AVCodecID codec, int profile)
 
static void 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, uint64_t in_layout, int count)
 
static int get_aac_tag (uint64_t 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 uint64_t aac_at_channel_layouts []
 

Macro Definition Documentation

#define FF_BUFQUEUE_SIZE   256

Definition at line 25 of file audiotoolboxenc.c.

Definition at line 580 of file audiotoolboxenc.c.

#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, \
};
#define LIBAVUTIL_VERSION_INT
Definition: version.h:70
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
av_default_item_name
static const AVOption options[]
Describe the class of an AVClass context structure.
Definition: log.h:67

Definition at line 594 of file audiotoolboxenc.c.

#define FFAT_ENC (   NAME,
  ID,
  PROFILES,
  ... 
)
Value:
AVCodec ff_##NAME##_at_encoder = { \
.name = #NAME "_at", \
.long_name = NULL_IF_CONFIG_SMALL(#NAME " (AudioToolbox)"), \
.type = AVMEDIA_TYPE_AUDIO, \
.id = ID, \
.priv_data_size = sizeof(ATDecodeContext), \
.close = ffat_close_encoder, \
.encode2 = ffat_encode, \
.priv_class = &ffat_##NAME##_enc_class, \
.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY __VA_ARGS__, \
.sample_fmts = (const enum AVSampleFormat[]) { \
}, \
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, \
.profiles = PROFILES, \
};
#define FFAT_ENC_CLASS(NAME)
static void flush(AVCodecContext *avctx)
static av_cold int ffat_init_encoder(AVCodecContext *avctx)
static av_cold int ffat_close_encoder(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold void ffat_encode_flush(AVCodecContext *avctx)
#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: avcodec.h:981
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
AV_SAMPLE_FMT_U8
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
#define ID(x)
Definition: cast5.c:29
static int ffat_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
signed 16 bits
Definition: samplefmt.h:61
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:956

Definition at line 602 of file audiotoolboxenc.c.

Function Documentation

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

Definition at line 53 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

static void ffat_update_ctx ( AVCodecContext avctx)
static

Definition at line 86 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

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

Definition at line 126 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

static int get_ilbc_mode ( AVCodecContext avctx)
static

Definition at line 140 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

static av_cold int get_channel_label ( int  channel)
static

Definition at line 152 of file audiotoolboxenc.c.

Referenced by remap_layout().

static int remap_layout ( AudioChannelLayout *  layout,
uint64_t  in_layout,
int  count 
)
static

Definition at line 177 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

static int get_aac_tag ( uint64_t  in_layout)
static

Definition at line 198 of file audiotoolboxenc.c.

Referenced by ffat_init_encoder().

static av_cold int ffat_init_encoder ( AVCodecContext avctx)
static

Definition at line 232 of file audiotoolboxenc.c.

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

Definition at line 448 of file audiotoolboxenc.c.

Referenced by ffat_encode().

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

Definition at line 483 of file audiotoolboxenc.c.

static av_cold void ffat_encode_flush ( AVCodecContext avctx)
static

Definition at line 553 of file audiotoolboxenc.c.

static av_cold int ffat_close_encoder ( AVCodecContext avctx)
static

Definition at line 561 of file audiotoolboxenc.c.

Variable Documentation

const AVProfile aac_profiles[]
static
Initial value:
= {
{ FF_PROFILE_AAC_LOW, "LC" },
{ FF_PROFILE_AAC_HE, "HE-AAC" },
{ FF_PROFILE_AAC_HE_V2, "HE-AACv2" },
{ FF_PROFILE_AAC_LD, "LD" },
{ FF_PROFILE_AAC_ELD, "ELD" },
}
#define FF_PROFILE_AAC_HE_V2
Definition: avcodec.h:3162
#define FF_PROFILE_AAC_LD
Definition: avcodec.h:3163
#define FF_PROFILE_AAC_ELD
Definition: avcodec.h:3164
#define FF_PROFILE_AAC_LOW
Definition: avcodec.h:3158
#define FF_PROFILE_UNKNOWN
Definition: avcodec.h:3154
#define FF_PROFILE_AAC_HE
Definition: avcodec.h:3161

Definition at line 571 of file audiotoolboxenc.c.

Referenced by matroska_aac_profile().

const AVOption options[]
static
Initial value:
= {
{"aac_at_mode", "ratecontrol mode", 0x42, AV_OPT_TYPE_INT, {.i64 = -1}, -1, kAudioCodecBitRateControlMode_Variable, AE, "mode"},
{"auto", "VBR if global quality is given; CBR otherwise", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, INT_MIN, INT_MAX, AE, "mode"},
{"cbr", "constant bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_Constant}, INT_MIN, INT_MAX, AE, "mode"},
{"abr", "long-term average bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_LongTermAverage}, INT_MIN, INT_MAX, AE, "mode"},
{"cvbr", "constrained variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_VariableConstrained}, INT_MIN, INT_MAX, AE, "mode"},
{"vbr" , "variable bitrate", 0, AV_OPT_TYPE_CONST, {.i64 = kAudioCodecBitRateControlMode_Variable}, INT_MIN, INT_MAX, AE, "mode"},
{"aac_at_quality", "quality vs speed control", 0x42, AV_OPT_TYPE_INT, {.i64 = 0}, 0, 2, AE},
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define AE

Definition at line 581 of file audiotoolboxenc.c.

const uint64_t aac_at_channel_layouts[]
static
Initial value:
= {
0,
}
#define AV_CH_LAYOUT_6POINT1
#define AV_CH_LAYOUT_6POINT0
#define AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_7POINT0
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK
#define AV_CH_LAYOUT_OCTAGONAL
#define AV_CH_LAYOUT_MONO

Definition at line 624 of file audiotoolboxenc.c.