Commit 963c5800 authored by Paul B Mahol's avatar Paul B Mahol

libaacplus: move profile check above, simplifies code a little

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent 0fb7fef8
...@@ -46,6 +46,11 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx) ...@@ -46,6 +46,11 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
return -1; 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->aacplus_handle = aacplusEncOpen(avctx->sample_rate, avctx->channels,
&s->samples_input, &s->max_output_bytes); &s->samples_input, &s->max_output_bytes);
if(!s->aacplus_handle) { if(!s->aacplus_handle) {
...@@ -56,13 +61,6 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx) ...@@ -56,13 +61,6 @@ static av_cold int aacPlus_encode_init(AVCodecContext *avctx)
/* check aacplus version */ /* check aacplus version */
aacplus_cfg = aacplusEncGetCurrentConfiguration(s->aacplus_handle); 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->bitRate = avctx->bit_rate;
aacplus_cfg->bandWidth = avctx->cutoff; aacplus_cfg->bandWidth = avctx->cutoff;
aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER); aacplus_cfg->outputFormat = !(avctx->flags & CODEC_FLAG_GLOBAL_HEADER);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment