diff mbox

[FFmpeg-devel,1/6] truehd_core: Disable 16-channel presentation

Message ID 20190706135911.11986-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 99c191151a716d8315e938297bd9b50a6a0902d3
Headers show

Commit Message

Andreas Rheinhardt July 6, 2019, 1:59 p.m. UTC
The most serious bit of the substream_info header field (in a mayor sync
packet) indicates whether a 16-channel presentation is present in the
bitstream. If set, the extended_substream_info header field contains
information about the 16-channel presentation. This presentation always
uses substream 3, a substream that is discarded by truehd_core. So
substream_info needs to be changed to no longer indicate the presence
of a 16-channel presentation in order for truehd_core's output to be
consistent. This is implemented in this commit.

This change also makes MediaInfo no longer display the presence of Atmos
in the output of truehd_core.

Also, set the (now irrelevant) extended_substream_info field to zero as
this seems to be the common value for ordinary TrueHD.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
The info this patchset relies on can be found in Dolby's TrueHD (MLP)
high-level bitstream description [1]. See sections 4.2.8 and 4.2.9 for
this commit. Thanks to Hendrik Leppkes for the link.

[1]: https://developer.dolby.com/globalassets/technology/dolby-truehd/dolbytruehdhighlevelbitstreamdescription.pdf

 libavcodec/truehd_core_bsf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Paul B Mahol July 9, 2019, 10:44 a.m. UTC | #1
On 7/6/19, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote:
> The most serious bit of the substream_info header field (in a mayor sync
> packet) indicates whether a 16-channel presentation is present in the
> bitstream. If set, the extended_substream_info header field contains
> information about the 16-channel presentation. This presentation always
> uses substream 3, a substream that is discarded by truehd_core. So
> substream_info needs to be changed to no longer indicate the presence
> of a 16-channel presentation in order for truehd_core's output to be
> consistent. This is implemented in this commit.
>
> This change also makes MediaInfo no longer display the presence of Atmos
> in the output of truehd_core.
>
> Also, set the (now irrelevant) extended_substream_info field to zero as
> this seems to be the common value for ordinary TrueHD.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
> The info this patchset relies on can be found in Dolby's TrueHD (MLP)
> high-level bitstream description [1]. See sections 4.2.8 and 4.2.9 for
> this commit. Thanks to Hendrik Leppkes for the link.
>
> [1]:
> https://developer.dolby.com/globalassets/technology/dolby-truehd/dolbytruehdhighlevelbitstreamdescription.pdf

LGTM
diff mbox

Patch

diff --git a/libavcodec/truehd_core_bsf.c b/libavcodec/truehd_core_bsf.c
index 9e3ee07eed..757d26a10d 100644
--- a/libavcodec/truehd_core_bsf.c
+++ b/libavcodec/truehd_core_bsf.c
@@ -121,7 +121,8 @@  static int truehd_core_filter(AVBSFContext *ctx, AVPacket *out)
             AV_WN64(out->data + out_size - 8, 0);
         if (have_header) {
             memcpy(out->data + 4, in->data + 4, 28);
-            out->data[16 + 4] = (out->data[16 + 4] & 0x0f) | (FFMIN(s->hdr.num_substreams, 3) << 4);
+            out->data[16 + 4] = (out->data[16 + 4] & 0x0c) | (FFMIN(s->hdr.num_substreams, 3) << 4);
+            out->data[17 + 4]&= 0x7f;
             out->data[25 + 4] = out->data[25 + 4] & 0xfe;
             out->data[26 + 4] = 0xff;
             out->data[27 + 4] = 0xff;