summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Ekström <jeebjp@gmail.com>2018-10-30 01:36:38 +0200
committerJan Ekström <jeebjp@gmail.com>2018-10-30 02:13:04 +0200
commit25ee18d6e54cd95e8c193023674ce26803e76464 (patch)
tree22860a6c05491c3015b2736e151967a2dd2405c3
parent865627d849ed3262aa662ae35ca6dfd0e3f6955e (diff)
downloadmpv-25ee18d6e54cd95e8c193023674ce26803e76464.tar.bz2
mpv-25ee18d6e54cd95e8c193023674ce26803e76464.tar.xz
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
-rw-r--r--audio/decode/ad_spdif.c12
1 files 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;