44 if (
c->sample_rate <= 0) {
93 int sync_extension,
void *logctx)
95 int specific_config_bitindex, ret;
121 c->ext_sample_rate = 0;
136 switch (
c->object_type) {
143 c->frame_length =
c->frame_length_short ? 960 : 1024;
148 c->frame_length =
c->frame_length_short ? 480 : 512;
151 int core_sbr_frame_len_idx, sbr_ratio;
152 int ratio_mult, ratio_dec, frame_length;
156 core_sbr_frame_len_idx =
get_bits(gb, 3);
157 c->frame_length_short = core_sbr_frame_len_idx == 0 ||
158 core_sbr_frame_len_idx == 2;
159 sbr_ratio = core_sbr_frame_len_idx == 2 ? 2 :
160 core_sbr_frame_len_idx == 3 ? 3 :
161 core_sbr_frame_len_idx == 4 ? 1 :
164 if (sbr_ratio == 2) {
167 }
else if (sbr_ratio == 3) {
170 }
else if (sbr_ratio == 4) {
178 frame_length =
c->frame_length_short ? 768 : 1024;
179 c->frame_length = (frame_length * ratio_mult) / ratio_dec;
184 if (
c->ext_object_type !=
AOT_SBR && sync_extension) {
191 if (
c->ext_sample_rate ==
c->sample_rate)
206 if ((
c->ps == -1 &&
c->object_type !=
AOT_AAC_LC) ||
c->channels & ~0x01)
209 return specific_config_bitindex - start_bit_index;
213 int size,
int sync_extension,
void *logctx)
bitstream reader API header.
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 unsigned int get_bits1(GetBitContext *s)
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.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define MKBETAG(a, b, c, d)
static int get_object_type(GetBitContext *gb)
int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, int sync_extension, void *logctx)
Parse MPEG-4 systems extradata from a potentially unaligned GetBitContext to retrieve audio configura...
static int get_sample_rate(GetBitContext *gb, int *index)
int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf, int size, int sync_extension, void *logctx)
Parse MPEG-4 systems extradata from a raw buffer to retrieve audio configuration.
const uint8_t ff_mpeg4audio_channels[15]
static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx)
Parse MPEG-4 audio configuration for ALS object type.
const int ff_mpeg4audio_sample_rates[16]
@ AOT_ALS
Y Audio LosslesS.
@ AOT_AAC_LTP
Y Long Term Prediction.
@ AOT_ESCAPE
Y Escape Value.
@ 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_USAC
Y Unified Speech and Audio Coding.
@ AOT_SBR
Y Spectral Band Replication.
@ AOT_ER_BSAC
N Error Resilient Bit-Sliced Arithmetic Coding.
@ AOT_AAC_SSR
N (code in SoC repo) Scalable Sample Rate.
@ AOT_AAC_LC
Y Low Complexity.
@ AOT_PS
N Parametric Stereo.
#define FF_ARRAY_ELEMS(a)