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++) {
127 int ret, audio_mux_version =
get_bits(gb, 1);
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",
int ff_aac_decode_init_float(AVCodecContext *avctx)
static int read_audio_mux_element(struct LATMContext *latmctx, GetBitContext *gb)
static av_cold int latm_decode_init(AVCodecContext *avctx)
const FFCodec ff_aac_latm_decoder
static uint32_t latm_get_value(GetBitContext *b)
#define LOAS_SYNC_WORD
11 bits LOAS sync word
static int latm_decode_frame(AVCodecContext *avctx, AVFrame *out, int *got_frame_ptr, AVPacket *avpkt)
static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb)
static int read_stream_mux_config(struct LATMContext *latmctx, GetBitContext *gb)
static int latm_decode_audio_specific_config(struct LATMContext *latmctx, GetBitContext *gb, int asclen)
const AVChannelLayout ff_aac_ch_layout[]
static AVFormatContext * ctx
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define CODEC_SAMPLEFMTS(...)
#define CODEC_CH_LAYOUTS_ARRAY(array)
void(* flush)(AVBSFContext *ctx)
int(* init)(AVBSFContext *ctx)
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int get_bits_left(GetBitContext *gb)
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_SAMPLE_FMT_FLTP
float, planar
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 aac_decode_er_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, 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.
static av_cold int decode_close(AVCodecContext *avctx)
static int push_output_configuration(AACDecContext *ac)
Save current output configuration if and only if it has been locked.
static int aac_decode_frame_int(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, GetBitContext *gb, const AVPacket *avpkt)
static void pop_output_configuration(AACDecContext *ac)
Restore the previous output configuration if and only if the current configuration is unlocked.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AOT_ER_AAC_LD
N Error Resilient Low Delay.
@ AOT_ER_AAC_ELD
N Error Resilient Enhanced Low Delay.
@ AOT_ER_AAC_LC
N Error Resilient Low Complexity.
@ AOT_ER_AAC_LTP
N Error Resilient Long Term Prediction.
const AVProfile ff_aac_profiles[]
main AAC decoding context
struct AVCodecContext * avctx
OutputConfiguration oc[2]
main external API structure.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
int audio_mux_version_A
LATM syntax version.
int frame_length_type
0/1 variable/fixed frame length
int initialized
initialized after a valid extradata was seen
AACDecContext aac_ctx
containing AACContext
int frame_length
frame length for fixed frame length
#define avpriv_request_sample(...)