libaacplus: move profile check above, simplifies code a little

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2013-05-23 19:34:39 +00:00
parent 0fb7fef879
commit 963c58006f
1 changed files with 5 additions and 7 deletions

View File

@ -46,6 +46,11 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
return -1;
}
if (avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC supported\n", avctx->profile);
return -1;
}
s->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,
&s->samples_input, &s->max_output_bytes);
if(!s->aacplus_handle) {
@ -56,13 +61,6 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
/* check aacplus version */
aacplus_cfg = aacplusEncGetCurrentConfiguration(s->aacplus_handle);
/* put the options in the configuration struct */
if(avctx->profile != FF_PROFILE_AAC_LOW && avctx->profile != FF_PROFILE_UNKNOWN) {
av_log(avctx, AV_LOG_ERROR, "invalid AAC profile: %d, only LC supported\n", avctx->profile);
aacplusEncClose(s->aacplus_handle);
return -1;
}
aacplus_cfg->bitRate = avctx->bit_rate;
aacplus_cfg->bandWidth = avctx->cutoff;
aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);