[FFmpeg-devel] [PATCH] lavc/mlpdec: report presence of Atmos substreams as a profile

wm4 nfxjfg at googlemail.com
Wed Jan 13 10:17:32 CET 2016


On Tue, 12 Jan 2016 20:51:46 -0600
Rodger Combs <rodger.combs at gmail.com> wrote:

> ---
>  libavcodec/avcodec.h    | 2 ++
>  libavcodec/mlp_parser.c | 5 +++++
>  libavcodec/mlpdec.c     | 2 ++
>  libavcodec/profiles.c   | 6 ++++++
>  libavcodec/profiles.h   | 1 +
>  5 files changed, 16 insertions(+)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index f365775..81f1e9a 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3125,6 +3125,8 @@ typedef struct AVCodecContext {
>  #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE          3
>  #define FF_PROFILE_HEVC_REXT                        4
>  
> +#define FF_PROFILE_TRUEHD                           0
> +#define FF_PROFILE_TRUEHD_ATMOS                     1
>      /**
>       * level
>       * - encoding: Set by user.
> diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
> index 23601c8..5edb27f 100644
> --- a/libavcodec/mlp_parser.c
> +++ b/libavcodec/mlp_parser.c
> @@ -31,6 +31,7 @@
>  #include "libavutil/internal.h"
>  #include "get_bits.h"
>  #include "parser.h"
> +#include "profiles.h"
>  #include "mlp_parser.h"
>  #include "mlp.h"
>  
> @@ -392,6 +393,10 @@ static int mlp_parse(AVCodecParserContext *s,
>              avctx->bit_rate = mh.peak_bitrate;
>  
>          mp->num_substreams = mh.num_substreams;
> +
> +        if (avctx->codec_id == AV_CODEC_ID_TRUEHD)
> +            avctx->profile = (mh.num_substreams > 3) ? FF_PROFILE_TRUEHD_ATMOS :
> +                                                       FF_PROFILE_TRUEHD;
>      }
>  
>      *poutbuf = buf;
> diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> index c93b058..ccb59d2 100644
> --- a/libavcodec/mlpdec.c
> +++ b/libavcodec/mlpdec.c
> @@ -34,6 +34,7 @@
>  #include "internal.h"
>  #include "libavutil/crc.h"
>  #include "parser.h"
> +#include "profiles.h"
>  #include "mlp_parser.h"
>  #include "mlpdsp.h"
>  #include "mlp.h"
> @@ -1314,5 +1315,6 @@ AVCodec ff_truehd_decoder = {
>      .init           = mlp_decode_init,
>      .decode         = read_access_unit,
>      .capabilities   = AV_CODEC_CAP_DR1,
> +    .profiles       = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
>  };
>  #endif /* CONFIG_TRUEHD_DECODER */
> diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
> index 94069fd..ec33248 100644
> --- a/libavcodec/profiles.c
> +++ b/libavcodec/profiles.c
> @@ -129,4 +129,10 @@ const AVProfile ff_vp9_profiles[] = {
>      { FF_PROFILE_UNKNOWN },
>  };
>  
> +const AVProfile ff_truehd_profiles[] = {
> +    { FF_PROFILE_TRUEHD,       "TrueHD" },
> +    { FF_PROFILE_TRUEHD_ATMOS, "Atmos" },
> +    { FF_PROFILE_UNKNOWN },
> +};
> +
>  #endif /* !CONFIG_SMALL */
> diff --git a/libavcodec/profiles.h b/libavcodec/profiles.h
> index 7e1f74d..676a40e 100644
> --- a/libavcodec/profiles.h
> +++ b/libavcodec/profiles.h
> @@ -31,5 +31,6 @@ extern const AVProfile ff_mpeg2_video_profiles[];
>  extern const AVProfile ff_mpeg4_video_profiles[];
>  extern const AVProfile ff_vc1_profiles[];
>  extern const AVProfile ff_vp9_profiles[];
> +extern const AVProfile ff_truehd_profiles[];
>  
>  #endif

No idea about this patch, but it seems like new profiles should be
added to libavcodec/codec_desc.c as well.


More information about the ffmpeg-devel mailing list