From 99c191151a716d8315e938297bd9b50a6a0902d3 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sat, 6 Jul 2019 15:59:06 +0200 Subject: [PATCH] truehd_core: Disable 16-channel presentation 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 --- libavcodec/truehd_core_bsf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;