summaryrefslogtreecommitdiff
path: root/libavcodec/libaacplus.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2013-05-23 19:34:39 +0000
committerPaul B Mahol <onemda@gmail.com>2013-05-23 19:41:38 +0000
commit963c58006f9ef2dc71f5f4b564e6d34892287c5e (patch)
treef72d2ccc293df5e8e32635c705ac7f1ca150a09d /libavcodec/libaacplus.c
parent0fb7fef8794141a6a3bbca039dd39d70be00b9ec (diff)
libaacplus: move profile check above, simplifies code a little
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/libaacplus.c')
-rw-r--r--libavcodec/libaacplus.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavcodec/libaacplus.c b/libavcodec/libaacplus.c
index 68850c5857..abb55a2cf3 100644
--- a/libavcodec/libaacplus.c
+++ b/libavcodec/libaacplus.c
@@ -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);