[FFmpeg-devel] [PATCH] Add support for MPEG-2 AAC

Anton Khirnov anton at khirnov.net
Sat Jun 22 15:30:05 CEST 2013


On Fri, 21 Jun 2013 21:47:17 -0500, Kieran Kunhya <kierank at ob-encoder.com> wrote:
> ---
>  libavcodec/avcodec.h       |    2 ++
>  libavcodec/libfdk-aacenc.c |    1 +
>  libavcodec/options_table.h |    2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index bb33d4a..f4a10e1 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2530,6 +2530,8 @@ typedef struct AVCodecContext {
>  #define FF_PROFILE_AAC_HE_V2 28
>  #define FF_PROFILE_AAC_LD   22
>  #define FF_PROFILE_AAC_ELD  38
> +#define FF_PROFILE_MPEG2_AAC_LOW 128
> +#define FF_PROFILE_MPEG2_AAC_HE  131
>  
>  #define FF_PROFILE_DTS         20
>  #define FF_PROFILE_DTS_ES      30
> diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c
> index ef154c1..4938262 100644
> --- a/libavcodec/libfdk-aacenc.c
> +++ b/libavcodec/libfdk-aacenc.c
> @@ -197,6 +197,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
>              avctx->bit_rate = (96*sce + 128*cpe) * avctx->sample_rate / 44;
>              if (avctx->profile == FF_PROFILE_AAC_HE ||
>                  avctx->profile == FF_PROFILE_AAC_HE_V2 ||
> +                avctx->profile == FF_PROFILE_MPEG2_AAC_HE ||
>                  s->eld_sbr)
>                  avctx->bit_rate /= 2;
>          }
> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 5595c0e..244d3b9 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -291,6 +291,8 @@ static const AVOption options[]={
>  {"aac_he_v2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE_V2 }, INT_MIN, INT_MAX, A|E, "profile"},
>  {"aac_ld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LD }, INT_MIN, INT_MAX, A|E, "profile"},
>  {"aac_eld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_ELD }, INT_MIN, INT_MAX, A|E, "profile"},
> +{"mpeg2_aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"},
> +{"mpeg2_aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_HE }, INT_MIN, INT_MAX, A|E, "profile"},
>  {"dts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS }, INT_MIN, INT_MAX, A|E, "profile"},
>  {"dts_es", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_ES }, INT_MIN, INT_MAX, A|E, "profile"},
>  {"dts_96_24", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_96_24 }, INT_MIN, INT_MAX, A|E, "profile"},
> -- 
> 1.7.9.5
> 

Joy, yet more format-specific stuff in global headers.

I suppose it's ok for now, since it just extends what's already there, but we
should really move this to private options at some point.

Missing a minor version bump and APIchanges entries, also I'd rephrase the
commit message as something like
lavc: add MPEG-2 AAC profiles

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list