};
static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID],
- uint8_t (*layout_map)[3], int offset, int tags, uint64_t left,
+ uint8_t (*layout_map)[3], int offset, uint64_t left,
uint64_t right, int pos)
{
if (layout_map[offset][0] == TYPE_CPE) {
num_front_channels--;
}
if (num_front_channels >= 4) {
- i += assign_pair(e2c_vec, layout_map, i, tags,
+ i += assign_pair(e2c_vec, layout_map, i,
AV_CH_FRONT_LEFT_OF_CENTER,
AV_CH_FRONT_RIGHT_OF_CENTER,
AAC_CHANNEL_FRONT);
num_front_channels -= 2;
}
if (num_front_channels >= 2) {
- i += assign_pair(e2c_vec, layout_map, i, tags,
+ i += assign_pair(e2c_vec, layout_map, i,
AV_CH_FRONT_LEFT,
AV_CH_FRONT_RIGHT,
AAC_CHANNEL_FRONT);
num_front_channels -= 2;
}
while (num_front_channels >= 2) {
- i += assign_pair(e2c_vec, layout_map, i, tags,
+ i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX,
UINT64_MAX,
AAC_CHANNEL_FRONT);
}
if (num_side_channels >= 2) {
- i += assign_pair(e2c_vec, layout_map, i, tags,
+ i += assign_pair(e2c_vec, layout_map, i,
AV_CH_SIDE_LEFT,
AV_CH_SIDE_RIGHT,
AAC_CHANNEL_FRONT);
num_side_channels -= 2;
}
while (num_side_channels >= 2) {
- i += assign_pair(e2c_vec, layout_map, i, tags,
+ i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX,
UINT64_MAX,
AAC_CHANNEL_SIDE);
}
while (num_back_channels >= 4) {
- i += assign_pair(e2c_vec, layout_map, i, tags,
+ i += assign_pair(e2c_vec, layout_map, i,
UINT64_MAX,
UINT64_MAX,
AAC_CHANNEL_BACK);
num_back_channels -= 2;
}
if (num_back_channels >= 2) {
- i += assign_pair(e2c_vec, layout_map, i, tags,
+ i += assign_pair(e2c_vec, layout_map, i,
AV_CH_BACK_LEFT,
AV_CH_BACK_RIGHT,
AAC_CHANNEL_BACK);
* configuration is unlocked.
*/
static void pop_output_configuration(AACContext *ac) {
- if (ac->oc[1].status != OC_LOCKED) {
+ if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) {
ac->oc[1] = ac->oc[0];
ac->avctx->channels = ac->oc[1].channels;
ac->avctx->channel_layout = ac->oc[1].channel_layout;
*/
static int output_configure(AACContext *ac,
uint8_t layout_map[MAX_ELEM_ID*4][3], int tags,
- int channel_config, enum OCStatus oc_type)
+ enum OCStatus oc_type)
{
AVCodecContext *avctx = ac->avctx;
int i, channels = 0, ret;
2) < 0)
return NULL;
if (output_configure(ac, layout_map, layout_map_tags,
- 2, OC_TRIAL_FRAME) < 0)
+ OC_TRIAL_FRAME) < 0)
return NULL;
ac->oc[1].m4ac.chan_config = 2;
1) < 0)
return NULL;
if (output_configure(ac, layout_map, layout_map_tags,
- 1, OC_TRIAL_FRAME) < 0)
+ OC_TRIAL_FRAME) < 0)
return NULL;
ac->oc[1].m4ac.chan_config = 1;
int tags = 0;
if (get_bits1(gb)) { // frameLengthFlag
- av_log_missing_feature(avctx, "960/120 MDCT window is", 1);
- return -1;
+ av_log_missing_feature(avctx, "960/120 MDCT window", 1);
+ return AVERROR_PATCHWELCOME;
}
if (get_bits1(gb)) // dependsOnCoreCoder
} else if (m4ac->sbr == 1 && m4ac->ps == -1)
m4ac->ps = 1;
- if (ac && (ret = output_configure(ac, layout_map, tags,
- channel_config, OC_GLOBAL_HDR)))
+ if (ac && (ret = output_configure(ac, layout_map, tags, OC_GLOBAL_HDR)))
return ret;
if (extension_flag) {
&layout_map_tags, ac->oc[1].m4ac.chan_config);
if (!ret)
output_configure(ac, layout_map, layout_map_tags,
- ac->oc[1].m4ac.chan_config, OC_GLOBAL_HDR);
+ OC_GLOBAL_HDR);
else if (avctx->err_recognition & AV_EF_EXPLODE)
return AVERROR_INVALIDDATA;
}
/**
* Decode Long Term Prediction data; reference: table 4.xx.
*/
-static void decode_ltp(AACContext *ac, LongTermPrediction *ltp,
+static void decode_ltp(LongTermPrediction *ltp,
GetBitContext *gb, uint8_t max_sfb)
{
int sfb;
return AVERROR_INVALIDDATA;
} else {
if ((ics->ltp.present = get_bits(gb, 1)))
- decode_ltp(ac, &ics->ltp, gb, ics->max_sfb);
+ decode_ltp(&ics->ltp, gb, ics->max_sfb);
}
}
}
t.i = s.i ^ (sign & 1U<<31);
*dst++ = v[idx>>4 & 3] * t.f;
- sign <<= nz & 1; nz >>= 1;
+ sign <<= nz & 1;
t.i = s.i ^ (sign & 1U<<31);
*dst++ = v[idx>>6 & 3] * t.f;
return -1;
if (get_bits1(gb)) {
av_log_missing_feature(ac->avctx, "SSR", 1);
- return -1;
+ return AVERROR_PATCHWELCOME;
}
}
cpe->ch[1].ics.use_kb_window[1] = i;
if (cpe->ch[1].ics.predictor_present && (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN))
if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1)))
- decode_ltp(ac, &cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb);
+ decode_ltp(&cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb);
ms_present = get_bits(gb, 2);
if (ms_present == 3) {
av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n");
/**
* Decode dynamic range information; reference: table 4.52.
*
- * @param cnt length of TYPE_FIL syntactic element in bytes
- *
* @return Returns number of bytes consumed.
*/
static int decode_dynamic_range(DynamicRangeControl *che_drc,
- GetBitContext *gb, int cnt)
+ GetBitContext *gb)
{
int n = 1;
int drc_num_bands = 1;
ac->oc[1].m4ac.sbr = 1;
ac->oc[1].m4ac.ps = 1;
output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags,
- ac->oc[1].m4ac.chan_config, ac->oc[1].status);
+ ac->oc[1].status);
} else {
ac->oc[1].m4ac.sbr = 1;
}
res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type);
break;
case EXT_DYNAMIC_RANGE:
- res = decode_dynamic_range(&ac->che_drc, gb, cnt);
+ res = decode_dynamic_range(&ac->che_drc, gb);
break;
case EXT_FILL:
case EXT_FILL_DATA:
size = avpriv_aac_parse_header(gb, &hdr_info);
if (size > 0) {
if (hdr_info.num_aac_frames != 1) {
- av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame is", 0);
- return -1;
+ av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame", 0);
+ return AVERROR_PATCHWELCOME;
}
push_output_configuration(ac);
if (hdr_info.chan_config) {
&layout_map_tags, hdr_info.chan_config))
return -7;
if (output_configure(ac, layout_map, layout_map_tags,
- hdr_info.chan_config,
FFMAX(ac->oc[1].status, OC_TRIAL_FRAME)))
return -7;
} else {
"Not evaluating a further program_config_element as this construct is dubious at best.\n");
pop_output_configuration(ac);
} else {
- err = output_configure(ac, layout_map, tags, 0, OC_TRIAL_PCE);
+ err = output_configure(ac, layout_map, tags, OC_TRIAL_PCE);
pce_found = 1;
}
break;
asclen = get_bits_left(gb);
if (config_start_bit % 8) {
- av_log_missing_feature(latmctx->aac_ctx.avctx, "audio specific "
- "config not byte aligned.\n", 1);
- return AVERROR_INVALIDDATA;
+ av_log_missing_feature(latmctx->aac_ctx.avctx,
+ "Non-byte-aligned audio-specific config", 1);
+ return AVERROR_PATCHWELCOME;
}
if (asclen <= 0)
return AVERROR_INVALIDDATA;
// numPrograms
if (get_bits(gb, 4)) { // numPrograms
av_log_missing_feature(latmctx->aac_ctx.avctx,
- "multiple programs are not supported\n", 1);
+ "Multiple programs", 1);
return AVERROR_PATCHWELCOME;
}
// for each layer (which there is only on in DVB)
if (get_bits(gb, 3)) { // numLayer
av_log_missing_feature(latmctx->aac_ctx.avctx,
- "multiple layers are not supported\n", 1);
+ "Multiple layers", 1);
return AVERROR_PATCHWELCOME;
}
AVCodec ff_aac_decoder = {
.name = "aac",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AAC,
+ .id = AV_CODEC_ID_AAC,
.priv_data_size = sizeof(AACContext),
.init = aac_decode_init,
.close = aac_decode_close,
.decode = aac_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
+ .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
},
AVCodec ff_aac_latm_decoder = {
.name = "aac_latm",
.type = AVMEDIA_TYPE_AUDIO,
- .id = CODEC_ID_AAC_LATM,
+ .id = AV_CODEC_ID_AAC_LATM,
.priv_data_size = sizeof(struct LATMContext),
.init = latm_decode_init,
.close = aac_decode_close,
.decode = latm_decode_frame,
- .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
+ .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"),
.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
},