[FFmpeg-cvslog] libfdk-aac: Allow setting VBR modes via a private option

Martin Storsjö git at videolan.org
Wed Sep 26 13:52:02 CEST 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Tue Sep 25 08:37:21 2012 +0300| [375bff7084fd836a6c60b1f5d28a427ab55b66bc] | committer: Martin Storsjö

libfdk-aac: Allow setting VBR modes via a private option

This avoids using the global_quality field and QSCALE flag for
passing the VBR modes, since the value range of the global_quality
field doesn't really map cleanly to this codec's VBR modes.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavcodec/libfdk-aacenc.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 362a17c..fada1c2 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -36,6 +36,7 @@ typedef struct AACContext {
     int signaling;
     int latm;
     int header_period;
+    int vbr;
 
     AudioFrameQueue afq;
 } AACContext;
@@ -50,6 +51,7 @@ static const AVOption aac_enc_options[] = {
     { "explicit_hierarchical", "Explicit hierarchical signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
     { "latm", "Output LATM/LOAS encapsulated data", offsetof(AACContext, latm), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
     { "header_period", "StreamMuxConfig and PCE repetition period (in frames)", offsetof(AACContext, header_period), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 0xffff, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+    { "vbr", "VBR mode (1-5)", offsetof(AACContext, vbr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 5, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
     { NULL }
 };
 
@@ -173,8 +175,8 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
         goto error;
     }
 
-    if (avctx->flags & CODEC_FLAG_QSCALE) {
-        int mode = avctx->global_quality;
+    if (avctx->flags & CODEC_FLAG_QSCALE || s->vbr) {
+        int mode = s->vbr ? s->vbr : avctx->global_quality;
         if (mode <  1 || mode > 5) {
             av_log(avctx, AV_LOG_WARNING,
                    "VBR quality %d out of range, should be 1-5\n", mode);



More information about the ffmpeg-cvslog mailing list