|
|
@@ -36,6 +36,7 @@ typedef struct AACContext { |
|
|
int signaling; |
|
|
int signaling; |
|
|
int latm; |
|
|
int latm; |
|
|
int header_period; |
|
|
int header_period; |
|
|
|
|
|
int vbr; |
|
|
|
|
|
|
|
|
AudioFrameQueue afq; |
|
|
AudioFrameQueue afq; |
|
|
} AACContext; |
|
|
} 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" }, |
|
|
{ "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 }, |
|
|
{ "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 }, |
|
|
{ "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 } |
|
|
{ NULL } |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@@ -173,13 +175,16 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) |
|
|
goto error; |
|
|
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) { |
|
|
if (mode < 1 || mode > 5) { |
|
|
av_log(avctx, AV_LOG_WARNING, |
|
|
av_log(avctx, AV_LOG_WARNING, |
|
|
"VBR quality %d out of range, should be 1-5\n", mode); |
|
|
"VBR quality %d out of range, should be 1-5\n", mode); |
|
|
mode = av_clip(mode, 1, 5); |
|
|
mode = av_clip(mode, 1, 5); |
|
|
} |
|
|
} |
|
|
|
|
|
av_log(avctx, AV_LOG_WARNING, |
|
|
|
|
|
"Note, the VBR setting is unsupported and only works with " |
|
|
|
|
|
"some parameter combinations\n"); |
|
|
if ((err = aacEncoder_SetParam(s->handle, AACENC_BITRATEMODE, |
|
|
if ((err = aacEncoder_SetParam(s->handle, AACENC_BITRATEMODE, |
|
|
mode)) != AACENC_OK) { |
|
|
mode)) != AACENC_OK) { |
|
|
av_log(avctx, AV_LOG_ERROR, "Unable to set the VBR bitrate mode %d: %s\n", |
|
|
av_log(avctx, AV_LOG_ERROR, "Unable to set the VBR bitrate mode %d: %s\n", |
|
|
|