summaryrefslogtreecommitdiff
path: root/libavcodec/libfdk-aacenc.c
diff options
context:
space:
mode:
authorKieran Kunhya <kierank@ob-encoder.com>2012-07-23 11:20:04 -0500
committerMartin Storsjö <martin@martin.st>2012-07-25 20:32:33 +0300
commit160a27c5904c48bd83461253e7d58c63ca695de0 (patch)
tree1764a64345da4bab76ec6ed8aa2368e90dad902b /libavcodec/libfdk-aacenc.c
parentecfff0e9929f399119437cd7113bad1cd968e8ea (diff)
libfdk-aacenc: add LATM/LOAS encapsulation support
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/libfdk-aacenc.c')
-rw-r--r--libavcodec/libfdk-aacenc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index f2c3fbdb73..4d7aa7b26a 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -33,6 +33,8 @@ typedef struct AACContext {
int afterburner;
int eld_sbr;
int signaling;
+ int latm;
+ int header_period;
AudioFrameQueue afq;
} AACContext;
@@ -45,6 +47,8 @@ static const AVOption aac_enc_options[] = {
{ "implicit", "Implicit backwards compatible signaling", 0, AV_OPT_TYPE_CONST, { 0 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
{ "explicit_sbr", "Explicit SBR, implicit PS signaling", 0, AV_OPT_TYPE_CONST, { 1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" },
{ "explicit_hierarchical", "Explicit hierarchical signaling", 0, AV_OPT_TYPE_CONST, { 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, { 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, { 0 }, 0, 0xffff, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }
};
@@ -204,12 +208,21 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
/* Choose bitstream format - if global header is requested, use
* raw access units, otherwise use ADTS. */
if ((err = aacEncoder_SetParam(s->handle, AACENC_TRANSMUX,
- avctx->flags & CODEC_FLAG_GLOBAL_HEADER ? 0 : 2)) != AACENC_OK) {
+ avctx->flags & CODEC_FLAG_GLOBAL_HEADER ? 0 : s->latm ? 10 : 2)) != AACENC_OK) {
av_log(avctx, AV_LOG_ERROR, "Unable to set the transmux format: %s\n",
aac_get_error(err));
goto error;
}
+ if (s->latm && s->header_period) {
+ if ((err = aacEncoder_SetParam(s->handle, AACENC_HEADER_PERIOD,
+ s->header_period)) != AACENC_OK) {
+ av_log(avctx, AV_LOG_ERROR, "Unable to set header period: %s\n",
+ aac_get_error(err));
+ goto error;
+ }
+ }
+
/* If no signaling mode is chosen, use explicit hierarchical signaling
* if using mp4 mode (raw access units, with global header) and
* implicit signaling if using ADTS. */