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

Fu, Linjie linjie.fu at intel.com
Mon May 18 07:16:14 EEST 2020


> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Marton Balint
> Sent: Tuesday, May 12, 2020 03:35
> To: ffmpeg-devel at ffmpeg.org
> Cc: Marton Balint <cus at passwd.hu>
> Subject: [FFmpeg-devel] [PATCH 6/6] avcodec: move mpeg4 profiles to
> profiles.h
> 
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  doc/codecs.texi            | 17 ++---------------
>  libavcodec/mpeg4videoenc.c |  2 ++
>  libavcodec/options_table.h |  4 ----
>  libavcodec/profiles.h      |  6 ++++++
>  libavcodec/v4l2_m2m_enc.c  | 34 ++++++++++++++++++++++------------
>  5 files changed, 32 insertions(+), 31 deletions(-)
> 
> diff --git a/doc/codecs.texi b/doc/codecs.texi
> index c08229ba7e..ece8d50edd 100644
> --- a/doc/codecs.texi
> +++ b/doc/codecs.texi
> @@ -837,21 +837,8 @@ Set number of macroblock rows at the bottom which
> are skipped.
> 
>  @item profile @var{integer} (@emph{encoding,audio,video})
> 
> -Possible values:
> - at table @samp
> - at item unknown
> -
> - at item mpeg4_sp
> -
> - at item mpeg4_core
> -
> - at item mpeg4_main
> -
> - at item mpeg4_asp
> -
> - at end table
> -
> -Encoder specific profiles are documented in the relevant encoder
> documentation.
> +Set encoder codec profile. Default value is @samp{unknown}. Encoder
> specific
> +profiles are documented in the relevant encoder documentation.
> 
>  @item level @var{integer} (@emph{encoding,audio,video})
> 
> diff --git a/libavcodec/mpeg4videoenc.c b/libavcodec/mpeg4videoenc.c
> index 2cd5a8c015..2e0b119d7f 100644
> --- a/libavcodec/mpeg4videoenc.c
> +++ b/libavcodec/mpeg4videoenc.c
> @@ -27,6 +27,7 @@
>  #include "mpegvideo.h"
>  #include "h263.h"
>  #include "mpeg4video.h"
> +#include "profiles.h"
> 
>  /* The uni_DCtab_* tables below contain unified bits+length tables to
> encode DC
>   * differences in MPEG-4. Unified in the sense that the specification specifies
> @@ -1376,6 +1377,7 @@ static const AVOption options[] = {
>      { "data_partitioning", "Use data partitioning.",
> OFFSET(data_partitioning), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
>      { "alternate_scan",    "Enable alternate scantable.",
> OFFSET(alternate_scan),    AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
>      FF_MPV_COMMON_OPTS
> +    FF_MPEG4_PROFILE_OPTS
>      { NULL },
>  };
> 
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 4c7dca696b..6db8facff6 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -262,10 +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"},
> -{"mpeg4_sp",   NULL, 0, AV_OPT_TYPE_CONST, {.i64 =
> FF_PROFILE_MPEG4_SIMPLE }, INT_MIN, INT_MAX, V|E, "avctx.profile"},
> -{"mpeg4_core", NULL, 0, AV_OPT_TYPE_CONST, {.i64 =
> FF_PROFILE_MPEG4_CORE }, INT_MIN, INT_MAX, V|E, "avctx.profile"},
> -{"mpeg4_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 =
> FF_PROFILE_MPEG4_MAIN }, INT_MIN, INT_MAX, V|E, "avctx.profile"},
> -{"mpeg4_asp",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 =
> FF_PROFILE_MPEG4_ADVANCED_SIMPLE }, INT_MIN, INT_MAX, V|E,
> "avctx.profile"},
>  {"main10",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 =
> FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, "avctx.profile"},
>  {"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 =
> FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},
>  {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN },
> INT_MIN, INT_MAX, V|A|E, "level"},
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index d950971875..e414ea77a7 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -37,6 +37,12 @@
>      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)\
> 
> +#define FF_MPEG4_PROFILE_OPTS \
> +    FF_AVCTX_PROFILE_OPTION("mpeg4_sp",      NULL, VIDEO,
> FF_PROFILE_MPEG4_SIMPLE)\
> +    FF_AVCTX_PROFILE_OPTION("mpeg4_core",    NULL, VIDEO,
> FF_PROFILE_MPEG4_CORE)\
> +    FF_AVCTX_PROFILE_OPTION("mpeg4_main",    NULL, VIDEO,
> FF_PROFILE_MPEG4_MAIN)\
> +    FF_AVCTX_PROFILE_OPTION("mpeg4_asp",     NULL, VIDEO,
> FF_PROFILE_MPEG4_ADVANCED_SIMPLE)\
> +
Since it's now searchable according to the AVClass, we may not need
the prefix anymore. (for now it's necessary for the ABI)

Hence would it be better to add some deprecated flags for them and
remove the prefix in future  when avcodec version increase?
(something like FF_API_NEXT)

- Linjie


More information about the ffmpeg-devel mailing list