* @return Returns error status. 0 - OK, !0 - error
*/
static av_cold int che_configure(AACContext *ac,
- enum ChannelPosition che_pos[4][MAX_ELEM_ID],
- int type, int id,
- int *channels)
+ enum ChannelPosition che_pos[4][MAX_ELEM_ID],
+ int type, int id, int *channels)
{
if (che_pos[type][id]) {
if (!ac->che[type][id] && !(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
* @return Returns error status. 0 - OK, !0 - error
*/
static av_cold int output_configure(AACContext *ac,
- enum ChannelPosition che_pos[4][MAX_ELEM_ID],
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
- int channel_config, enum OCStatus oc_type)
+ enum ChannelPosition che_pos[4][MAX_ELEM_ID],
+ enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
+ int channel_config, enum OCStatus oc_type)
{
AVCodecContext *avctx = ac->avctx;
int i, type, channels = 0, ret;
return ret;
}
- memset(ac->tag_che_map, 0, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
+ memset(ac->tag_che_map, 0, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
avctx->channel_layout = aac_channel_layout[channel_config - 1];
} else {
* @return Returns error status. 0 - OK, !0 - error
*/
static av_cold int set_default_channel_config(AVCodecContext *avctx,
- enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
- int channel_config)
+ enum ChannelPosition new_che_pos[4][MAX_ELEM_ID],
+ int channel_config)
{
if (channel_config < 1 || channel_config > 7) {
av_log(avctx, AV_LOG_ERROR, "invalid default channel configuration (%d)\n",
GetBitContext gb;
int i;
+ av_dlog(avctx, "extradata size %d\n", avctx->extradata_size);
+ for (i = 0; i < avctx->extradata_size; i++)
+ av_dlog(avctx, "%02x ", avctx->extradata[i]);
+ av_dlog(avctx, "\n");
+
init_get_bits(&gb, data, data_size * 8);
if ((i = ff_mpeg4audio_get_config(m4ac, data, data_size)) < 0)
return -1;
}
+ av_dlog(avctx, "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n",
+ m4ac->object_type, m4ac->chan_config, m4ac->sampling_index,
+ m4ac->sample_rate, m4ac->sbr, m4ac->ps);
+
return get_bits_count(&gb);
}
return -1;
}
- /* ffdshow custom code */
-#if CONFIG_AUDIO_FLOAT
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
-#else
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
-#endif
+ avctx->sample_fmt = avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
+ AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
AAC_INIT_VLC_STATIC( 0, 304);
AAC_INIT_VLC_STATIC( 1, 270);
static av_always_inline void predict(PredictorState *ps, float *coef,
float sf_scale, float inv_sf_scale,
- int output_enable)
+ int output_enable)
{
const float a = 0.953125; // 61.0 / 64
const float alpha = 0.90625; // 29.0 / 32
avctx->frame_size = samples;
}
- /* ffdshow custom code */
-#if CONFIG_AUDIO_FLOAT
- data_size_tmp = samples * avctx->channels * sizeof(float);
-#else
- data_size_tmp = samples * avctx->channels * sizeof(int16_t);
-#endif
+ data_size_tmp = samples * avctx->channels;
+ data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(float) : sizeof(int16_t);
if (*data_size < data_size_tmp) {
av_log(avctx, AV_LOG_ERROR,
"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
*data_size = data_size_tmp;
if (samples) {
- /* ffdshow custom code */
-#if CONFIG_AUDIO_FLOAT
- float_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
-#else
- ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
-#endif
+ if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
+ float_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
+ } else
+ ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
}
if (ac->output_configured)
aac_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
.sample_fmts = (const enum AVSampleFormat[]) {
-#if CONFIG_AUDIO_FLOAT
- AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
-#else
- AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
-#endif
+ AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
},
.channel_layouts = aac_channel_layout,
};
.decode = latm_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
.sample_fmts = (const enum AVSampleFormat[]) {
-#if CONFIG_AUDIO_FLOAT
- AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
-#else
- AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE
-#endif
+ AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
},
.channel_layouts = aac_channel_layout,
};