[FFmpeg-cvslog] libaacplus: move profile check above, simplifies code a little

Paul B Mahol git at videolan.org
Thu May 23 21:58:59 CEST 2013


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu May 23 19:34:39 2013 +0000| [963c58006f9ef2dc71f5f4b564e6d34892287c5e] | committer: Paul B Mahol

libaacplus: move profile check above, simplifies code a little

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=963c58006f9ef2dc71f5f4b564e6d34892287c5e
---

 libavcodec/libaacplus.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libavcodec/libaacplus.c b/libavcodec/libaacplus.c
index 68850c5..abb55a2 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);



More information about the ffmpeg-cvslog mailing list