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

Rodger Combs rodger.combs at gmail.com
Thu Jan 14 02:32:04 CET 2016


---
 libavcodec/avcodec.h    | 2 ++
 libavcodec/codec_desc.c | 1 +
 libavcodec/mlp_parser.c | 5 +++++
 libavcodec/mlpdec.c     | 2 ++
 libavcodec/profiles.c   | 6 ++++++
 libavcodec/profiles.h   | 1 +
 6 files changed, 17 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/codec_desc.c b/libavcodec/codec_desc.c
index 5fbe624..cdaf0cf 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2411,6 +2411,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
         .name      = "truehd",
         .long_name = NULL_IF_CONFIG_SMALL("TrueHD"),
         .props     = AV_CODEC_PROP_LOSSLESS,
+        .profiles  = NULL_IF_CONFIG_SMALL(ff_truehd_profiles),
     },
     {
         .id        = AV_CODEC_ID_MP4ALS,
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
-- 
2.6.4



More information about the ffmpeg-devel mailing list