Go to the documentation of this file.
32 #ifndef AVCODEC_AAC_AACDEC_LATM_H
33 #define AVCODEC_AAC_AACDEC_LATM_H
35 #define LOAS_SYNC_WORD 0x2b7
63 int sync_extension = 0;
64 int bits_consumed, esize,
i;
71 }
else if (asclen == 0) {
81 &gbc, config_start_bit,
84 if (bits_consumed < config_start_bit)
86 bits_consumed -= config_start_bit;
89 asclen = bits_consumed;
96 av_log(avctx,
AV_LOG_INFO,
"audio config changed (sample_rate=%d, chan_config=%d)\n",
103 esize = (asclen + 7) / 8;
114 for (
i = 0;
i < esize;
i++) {
130 if (audio_mux_version)
135 if (audio_mux_version)
155 if (!audio_mux_version) {
184 if (audio_mux_version) {
208 if (
ctx->frame_length_type == 0) {
209 int mux_slot_length = 0;
214 mux_slot_length +=
tmp;
215 }
while (
tmp == 255);
216 return mux_slot_length;
217 }
else if (
ctx->frame_length_type == 1) {
218 return ctx->frame_length;
219 }
else if (
ctx->frame_length_type == 3 ||
220 ctx->frame_length_type == 5 ||
221 ctx->frame_length_type == 7) {
231 uint8_t use_same_mux =
get_bits(gb, 1);
237 "no decoder config found\n");
242 if (mux_slot_length_bytes < 0 || mux_slot_length_bytes * 8LL >
get_bits_left(gb)) {
245 }
else if (mux_slot_length_bytes * 8 + 256 <
get_bits_left(gb)) {
247 "frame length mismatch %d << %d\n",
257 int *got_frame_ptr,
AVPacket *avpkt)
272 if (muxlength > avpkt->
size)
276 return (err < 0) ? err : avpkt->
size;
296 "ADTS header detected, probably as result of configuration "
334 .
p.
name =
"aac_latm",
@ AV_SAMPLE_FMT_FLTP
float, planar
static av_cold int decode_close(AVCodecContext *avctx)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
int frame_length_type
0/1 variable/fixed frame length
static void pop_output_configuration(AACDecContext *ac)
Restore the previous output configuration if and only if the current configuration is unlocked.
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static int get_bits_left(GetBitContext *gb)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int decode_audio_specific_config(AACDecContext *ac, AVCodecContext *avctx, OutputConfiguration *oc, const uint8_t *data, int64_t bit_size, int sync_extension)
static int get_bits_count(const GetBitContext *s)
This structure describes decoded (raw) audio or video data.
static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, GetBitContext *gb, const AVPacket *avpkt)
@ AOT_ER_AAC_LTP
N Error Resilient Long Term Prediction.
const AVProfile ff_aac_profiles[]
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int ff_aac_decode_init_float(AVCodecContext *avctx)
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
const FFCodec ff_aac_latm_decoder
AVCodec p
The public AVCodec.
#define LOAS_SYNC_WORD
11 bits LOAS sync word
@ AOT_ER_AAC_LC
N Error Resilient Low Complexity.
static int latm_decode_frame(AVCodecContext *avctx, AVFrame *out, int *got_frame_ptr, AVPacket *avpkt)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
@ AOT_ER_AAC_LD
N Error Resilient Low Delay.
#define FF_CODEC_DECODE_CB(func)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int frame_length
frame length for fixed frame length
#define CODEC_LONG_NAME(str)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
const AVChannelLayout ff_aac_ch_layout[]
void(* flush)(AVBSFContext *ctx)
static int latm_decode_audio_specific_config(struct LATMContext *latmctx, GetBitContext *gb, int asclen)
int initialized
initialized after a valid extradata was seen
static int aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, GetBitContext *gb)
static int read_stream_mux_config(struct LATMContext *latmctx, GetBitContext *gb)
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
static av_cold int latm_decode_init(AVCodecContext *avctx)
int(* init)(AVBSFContext *ctx)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_LOG_INFO
Standard information.
static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb)
static int decode_audio_specific_config_gb(AACDecContext *ac, AVCodecContext *avctx, OutputConfiguration *oc, GetBitContext *gb, int get_bit_alignment, int sync_extension)
Decode audio specific configuration; reference: table 1.13.
#define i(width, name, range_min, range_max)
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static int push_output_configuration(AACDecContext *ac)
Save current output configuration if and only if it has been locked.
@ AOT_ER_AAC_ELD
N Error Resilient Enhanced Low Delay.
AVSampleFormat
Audio sample formats.
const char * name
Name of the codec implementation.
OutputConfiguration oc[2]
#define AV_INPUT_BUFFER_PADDING_SIZE
int audio_mux_version_A
LATM syntax version.
main AAC decoding context
main external API structure.
struct AVCodecContext * avctx
static uint32_t latm_get_value(GetBitContext *b)
#define avpriv_request_sample(...)
This structure stores compressed data.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
AACDecContext aac_ctx
containing AACContext
static int read_audio_mux_element(struct LATMContext *latmctx, GetBitContext *gb)