diff options
Diffstat (limited to 'audio/decode')
-rw-r--r-- | audio/decode/ad_spdif.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c index 0706b11614..ef34042990 100644 --- a/audio/decode/ad_spdif.c +++ b/audio/decode/ad_spdif.c @@ -208,13 +208,21 @@ static int init_filter(struct mp_filter *da, AVPacket *pkt) break; case AV_CODEC_ID_DTS: { bool is_hd = profile == FF_PROFILE_DTS_HD_HRA || - profile == FF_PROFILE_DTS_HD_MA || + 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; |