Hi!

Attached patch allows detecting s16 truehd streams encoded with
FFmpeg, only tested with FFmpeg's encoder, I did not look into any
specification.

Please comment, Carl Eugen
From 1b98303ab87463037e05e66f3129112fc5c6e484 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffm...@gmail.com>
Date: Fri, 14 Feb 2020 00:25:52 +0100
Subject: [PATCH] lavc/mlp_parse: Read wordlength from 0xba streams.

Fixes detecting 16 bit streams encoded with FFmpeg.
---
 libavcodec/mlp_parse.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mlp_parse.c b/libavcodec/mlp_parse.c
index 45715352c2..74173acba3 100644
--- a/libavcodec/mlp_parse.c
+++ b/libavcodec/mlp_parse.c
@@ -123,7 +123,6 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
         mh->channels_mlp       = mlp_channels[channel_arrangement];
         mh->channel_layout_mlp = mlp_layout[channel_arrangement];
     } else if (mh->stream_type == 0xba) {
-        mh->group1_bits = 24; // TODO: Is this information actually conveyed anywhere?
         mh->group2_bits = 0;
 
         ratebits = get_bits(gb, 4);
@@ -159,7 +158,15 @@ int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
 
     mh->num_substreams = get_bits(gb, 4);
 
-    skip_bits_long(gb, 4 + (header_size - 17) * 8);
+    if (mh->stream_type == 0xba) {
+        skip_bits(gb, 17);
+        mh->group1_bits = get_bits(gb, 5);
+        if (!mh->group1_bits)
+            mh->group1_bits = 24;
+        skip_bits_long(gb, 4 + (header_size - 17) * 8 - 22);
+    } else {
+        skip_bits_long(gb, 4 + (header_size - 17) * 8);
+    }
 
     return 0;
 }
-- 
2.24.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to