From 25ee18d6e54cd95e8c193023674ce26803e76464 Mon Sep 17 00:00:00 2001 From: Jan Ekström Date: Tue, 30 Oct 2018 01:36:38 +0200 Subject: ad_spdif: fix DTS-HD HRA handling Apparently, for bit streaming DTS-HD MA is specified to be handled as an eight channel (7.1) bit stream, while DTS-HD HRA is specified to be handled as a stereo bit stream. Define a variable for this, and utilize it to set the correct values for both the DTS-HD bit streaming rate, as well as the channel count for the SPDIF encoder. Fixes #6148 --- audio/decode/ad_spdif.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c index 0706b11614..fa2540b263 100644 --- a/audio/decode/ad_spdif.c +++ b/audio/decode/ad_spdif.c @@ -210,11 +210,19 @@ static int init_filter(struct mp_filter *da, AVPacket *pkt) bool is_hd = profile == FF_PROFILE_DTS_HD_HRA || profile == FF_PROFILE_DTS_HD_MA || profile == FF_PROFILE_UNKNOWN; + + // Apparently, DTS-HD over SPDIF is specified to be 7.1 (8 channels) + // for DTS-HD MA, and stereo (2 channels) for DTS-HD HRA. The bit + // streaming rate as well as the signaled channel count are defined + // based on this value. + int dts_hd_spdif_channel_count = profile == FF_PROFILE_DTS_HD_HRA ? + 2 : 8; if (spdif_ctx->use_dts_hd && is_hd) { - av_dict_set(&format_opts, "dtshd_rate", "768000", 0); // 4*192000 + av_dict_set_int(&format_opts, "dtshd_rate", + dts_hd_spdif_channel_count * 96000, 0); sample_format = AF_FORMAT_S_DTSHD; samplerate = 192000; - num_channels = 2*4; + num_channels = dts_hd_spdif_channel_count; } else { sample_format = AF_FORMAT_S_DTS; samplerate = 48000; -- cgit v1.2.3