libfdk-aac: Allow setting the encoder bandwidth/cutoff frequency
authorMartin Storsjö <martin@martin.st>
Thu, 12 Jul 2012 18:19:08 +0000 (21:19 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 12 Jul 2012 20:37:29 +0000 (23:37 +0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/libfdk-aacenc.c

index 6fda53ca60f53ecaac6db8873b4c9eb7e4ef77ed..b2bfad275e986cfeb256f1f8e270aff17e940890 100644 (file)
@@ -230,6 +230,15 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
         goto error;
     }
 
+    if (avctx->cutoff > 0) {
+        if ((err = aacEncoder_SetParam(s->handle, AACENC_BANDWIDTH,
+                                       avctx->cutoff)) != AACENC_OK) {
+            av_log(avctx, AV_LOG_ERROR, "Unable to set the encoder bandwith to %d: %s\n",
+                   avctx->cutoff, aac_get_error(err));
+            goto error;
+        }
+    }
+
     if ((err = aacEncEncode(s->handle, NULL, NULL, NULL, NULL)) != AACENC_OK) {
         av_log(avctx, AV_LOG_ERROR, "Unable to initialize the encoder: %s\n",
                aac_get_error(err));