[FFmpeg-devel] [PATCH 3/6] avcodec: move aacenc profiles to profiles.h

Marton Balint cus at passwd.hu
Mon May 11 22:35:19 EEST 2020


Signed-off-by: Marton Balint <cus at passwd.hu>
---
 doc/codecs.texi            | 20 --------------------
 libavcodec/aacenc.c        |  2 ++
 libavcodec/libfdk-aacenc.c |  2 ++
 libavcodec/options_table.h | 10 ----------
 libavcodec/profiles.h      | 16 ++++++++++++++++
 5 files changed, 20 insertions(+), 30 deletions(-)

diff --git a/doc/codecs.texi b/doc/codecs.texi
index 751d5df050..8f62cfaace 100644
--- a/doc/codecs.texi
+++ b/doc/codecs.texi
@@ -841,26 +841,6 @@ Possible values:
 @table @samp
 @item unknown
 
- at item aac_main
-
- at item aac_low
-
- at item aac_ssr
-
- at item aac_ltp
-
- at item aac_he
-
- at item aac_he_v2
-
- at item aac_ld
-
- at item aac_eld
-
- at item mpeg2_aac_low
-
- at item mpeg2_aac_he
-
 @item mpeg4_sp
 
 @item mpeg4_core
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 4d0abb107f..db11e0ca29 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -39,6 +39,7 @@
 #include "mpeg4audio.h"
 #include "kbdwin.h"
 #include "sinewin.h"
+#include "profiles.h"
 
 #include "aac.h"
 #include "aactab.h"
@@ -1131,6 +1132,7 @@ static const AVOption aacenc_options[] = {
     {"aac_ltp", "Long term prediction", offsetof(AACEncContext, options.ltp), AV_OPT_TYPE_BOOL, {.i64 = 0}, -1, 1, AACENC_FLAGS},
     {"aac_pred", "AAC-Main prediction", offsetof(AACEncContext, options.pred), AV_OPT_TYPE_BOOL, {.i64 = 0}, -1, 1, AACENC_FLAGS},
     {"aac_pce", "Forces the use of PCEs", offsetof(AACEncContext, options.pce), AV_OPT_TYPE_BOOL, {.i64 = 0}, -1, 1, AACENC_FLAGS},
+    FF_AAC_PROFILE_OPTS
     {NULL}
 };
 
diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
index 5620bb5951..6494c11ddc 100644
--- a/libavcodec/libfdk-aacenc.c
+++ b/libavcodec/libfdk-aacenc.c
@@ -25,6 +25,7 @@
 #include "avcodec.h"
 #include "audio_frame_queue.h"
 #include "internal.h"
+#include "profiles.h"
 
 #ifdef AACENCODER_LIB_VL0
 #define FDKENC_VER_AT_LEAST(vl0, vl1) \
@@ -62,6 +63,7 @@ static const AVOption aac_enc_options[] = {
     { "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 },
+    FF_AAC_PROFILE_OPTS
     { NULL }
 };
 
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index e498e8b844..6683a38f2e 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -262,16 +262,6 @@ static const AVOption avcodec_options[] = {
 {"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D},
 {"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E|CC, "avctx.profile"},
 {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "avctx.profile"},
-{"aac_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_MAIN }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LOW }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"aac_ssr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_SSR }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"aac_ltp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LTP }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"aac_he_v2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE_V2 }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"aac_ld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LD }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"aac_eld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_ELD }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"mpeg2_aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_LOW }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
-{"mpeg2_aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_HE }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
 {"dts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
 {"dts_es", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_ES }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
 {"dts_96_24", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_96_24 }, INT_MIN, INT_MAX, A|E, "avctx.profile"},
diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
index a53b67e7f2..d950971875 100644
--- a/libavcodec/profiles.h
+++ b/libavcodec/profiles.h
@@ -20,6 +20,22 @@
 #define AVCODEC_PROFILES_H
 
 #include "avcodec.h"
+#include "libavutil/opt.h"
+
+#define FF_AVCTX_PROFILE_OPTION(name, description, type, value) \
+    {name, description, 0, AV_OPT_TYPE_CONST, {.i64 = value }, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_## type ##_PARAM, "avctx.profile"},
+
+#define FF_AAC_PROFILE_OPTS \
+    FF_AVCTX_PROFILE_OPTION("aac_main",      NULL, AUDIO, FF_PROFILE_AAC_MAIN)\
+    FF_AVCTX_PROFILE_OPTION("aac_low",       NULL, AUDIO, FF_PROFILE_AAC_LOW)\
+    FF_AVCTX_PROFILE_OPTION("aac_ssr",       NULL, AUDIO, FF_PROFILE_AAC_SSR)\
+    FF_AVCTX_PROFILE_OPTION("aac_ltp",       NULL, AUDIO, FF_PROFILE_AAC_LTP)\
+    FF_AVCTX_PROFILE_OPTION("aac_he",        NULL, AUDIO, FF_PROFILE_AAC_HE)\
+    FF_AVCTX_PROFILE_OPTION("aac_he_v2",     NULL, AUDIO, FF_PROFILE_AAC_HE_V2)\
+    FF_AVCTX_PROFILE_OPTION("aac_ld",        NULL, AUDIO, FF_PROFILE_AAC_LD)\
+    FF_AVCTX_PROFILE_OPTION("aac_eld",       NULL, AUDIO, FF_PROFILE_AAC_ELD)\
+    FF_AVCTX_PROFILE_OPTION("mpeg2_aac_low", NULL, AUDIO, FF_PROFILE_MPEG2_AAC_LOW)\
+    FF_AVCTX_PROFILE_OPTION("mpeg2_aac_he",  NULL, AUDIO, FF_PROFILE_MPEG2_AAC_HE)\
 
 extern const AVProfile ff_aac_profiles[];
 extern const AVProfile ff_dca_profiles[];
-- 
2.16.4



More information about the ffmpeg-devel mailing list