From: Hendrik Leppkes Date: Tue, 8 Dec 2015 08:59:45 +0000 (+0100) Subject: Merge commit 'b805482b1fba1d82fbe47023a24c9261f18979b6' X-Git-Tag: n3.1-dev~1149 X-Git-Url: http://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff_plain/92186f2d1006c1a2cfcac79a656477f1ddeb34d9 Merge commit 'b805482b1fba1d82fbe47023a24c9261f18979b6' * commit 'b805482b1fba1d82fbe47023a24c9261f18979b6': aac: Provide more information on the failure message Merged-by: Hendrik Leppkes --- 92186f2d1006c1a2cfcac79a656477f1ddeb34d9 diff --cc libavcodec/aacenc.c index 2156fc0,00261c0..200f8c4 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@@ -917,63 -734,23 +917,65 @@@ static av_cold int aac_encode_init(AVCo for (i = 0; i < 16; i++) if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i]) break; + s->samplerate_index = i; - s->channels = avctx->channels; - - ERROR_IF(i == 16, + ERROR_IF(s->samplerate_index == 16 || + s->samplerate_index >= ff_aac_swb_size_1024_len || + s->samplerate_index >= ff_aac_swb_size_128_len, "Unsupported sample rate %d\n", avctx->sample_rate); - ERROR_IF(s->channels > AAC_MAX_CHANNELS, + ERROR_IF(s->channels > AAC_MAX_CHANNELS || s->channels == 7, "Unsupported number of channels: %d\n", s->channels); - ERROR_IF(avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW, - "Unsupported profile %d\n", avctx->profile); - ERROR_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels, - "Too many bits %f > %d per frame requested\n", + WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels, - "Too many bits per frame requested, clamping to max\n"); ++ "Too many bits %f > %d per frame requested, clamping to max\n", + 1024.0 * avctx->bit_rate / avctx->sample_rate, + 6144 * s->channels); - s->samplerate_index = i; - - s->chan_map = aac_chan_configs[s->channels-1]; + for (i = 0; i < FF_ARRAY_ELEMS(aacenc_profiles); i++) + if (avctx->profile == aacenc_profiles[i]) + break; + ERROR_IF(i == FF_ARRAY_ELEMS(aacenc_profiles), + "Unsupported encoding profile: %d\n", avctx->profile); + if (avctx->profile == FF_PROFILE_MPEG2_AAC_LOW) { + avctx->profile = FF_PROFILE_AAC_LOW; + ERROR_IF(s->options.pred, + "Main prediction unavailable in the \"mpeg2_aac_low\" profile\n"); + ERROR_IF(s->options.ltp, + "LTP prediction unavailable in the \"mpeg2_aac_low\" profile\n"); + WARN_IF(s->options.pns, + "PNS unavailable in the \"mpeg2_aac_low\" profile, turning off\n"); + s->options.pns = 0; + } else if (avctx->profile == FF_PROFILE_AAC_LTP) { + s->options.ltp = 1; + ERROR_IF(s->options.pred, + "Main prediction unavailable in the \"aac_ltp\" profile\n"); + } else if (avctx->profile == FF_PROFILE_AAC_MAIN) { + s->options.pred = 1; + ERROR_IF(s->options.ltp, + "LTP prediction unavailable in the \"aac_main\" profile\n"); + } else if (s->options.ltp) { + avctx->profile = FF_PROFILE_AAC_LTP; + WARN_IF(1, + "Chainging profile to \"aac_ltp\"\n"); + ERROR_IF(s->options.pred, + "Main prediction unavailable in the \"aac_ltp\" profile\n"); + } else if (s->options.pred) { + avctx->profile = FF_PROFILE_AAC_MAIN; + WARN_IF(1, + "Chainging profile to \"aac_main\"\n"); + ERROR_IF(s->options.ltp, + "LTP prediction unavailable in the \"aac_main\" profile\n"); + } + s->profile = avctx->profile; + s->coder = &ff_aac_coders[s->options.coder]; + + if (s->options.coder != AAC_CODER_TWOLOOP) { + ERROR_IF(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL, + "Coders other than twoloop require -strict -2 and some may be removed in the future\n"); + WARN_IF(s->options.coder == AAC_CODER_FAAC, + "The FAAC-like coder will be removed in the near future, please use twoloop!\n"); + s->options.intensity_stereo = 0; + s->options.pns = 0; + } if ((ret = dsp_init(avctx, s)) < 0) goto fail;