Skip to content

Commit

Permalink
Merge pull request xbmc#25710 from fritsch/sonybar
Browse files Browse the repository at this point in the history
AESinkAudiotrack: Use 192 khz for TrueHD / DTS-HD RAW as well
  • Loading branch information
fritsch authored Sep 7, 2024
2 parents 275dce0 + 45e538a commit e8d15b2
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions xbmc/cores/AudioEngine/Sinks/AESinkAUDIOTRACK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,19 @@ bool CAESinkAUDIOTRACK::Initialize(AEAudioFormat &format, std::string &device)
m_encoding = AEStreamFormatToATFormat(m_format.m_streamInfo.m_type);
m_format.m_channelLayout = AE_CH_LAYOUT_2_0;

if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_DTSHD_MA ||
m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD)
if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_DTSHD_MA)
{
// we keep the 48 khz sample rate, reason: Androids packer only packs DTS Core
// even if we ask for DTS-HD-MA it seems.
m_format.m_channelLayout = AE_CH_LAYOUT_7_1;
}

if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_TRUEHD)
{
m_format.m_channelLayout = AE_CH_LAYOUT_7_1;
m_sink_sampleRate = 192000;
}

// EAC3 needs real samplerate not the modulation
if (m_format.m_streamInfo.m_type == CAEStreamInfo::STREAM_TYPE_EAC3)
m_sink_sampleRate = m_format.m_streamInfo.m_sampleRate;
Expand Down Expand Up @@ -1073,6 +1080,8 @@ void CAESinkAUDIOTRACK::UpdateAvailablePassthroughCapabilities(bool isRaw)
m_info.m_wantsIECPassthrough = false;
m_info.m_dataFormats.push_back(AE_FMT_RAW);
m_info.m_streamTypes.clear();
bool supports_192khz = m_sink_sampleRates.find(192000) != m_sink_sampleRates.end();

if (isRaw)
{
bool canDoAC3 = false;
Expand Down Expand Up @@ -1126,9 +1135,9 @@ void CAESinkAUDIOTRACK::UpdateAvailablePassthroughCapabilities(bool isRaw)
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD_MA);
}
}
if (CJNIAudioFormat::ENCODING_DOLBY_TRUEHD != -1)
if (CJNIAudioFormat::ENCODING_DOLBY_TRUEHD != -1 && supports_192khz)
{
if (VerifySinkConfiguration(48000, AEChannelMapToAUDIOTRACKChannelMask(AE_CH_LAYOUT_7_1),
if (VerifySinkConfiguration(192000, AEChannelMapToAUDIOTRACKChannelMask(AE_CH_LAYOUT_7_1),
CJNIAudioFormat::ENCODING_DOLBY_TRUEHD, true))
{
CLog::Log(LOGDEBUG, "Firmware implements TrueHD RAW");
Expand All @@ -1146,7 +1155,6 @@ void CAESinkAUDIOTRACK::UpdateAvailablePassthroughCapabilities(bool isRaw)
CJNIAudioFormat::ENCODING_IEC61937);
if (supports_iec)
{
bool supports_192khz = m_sink_sampleRates.find(192000) != m_sink_sampleRates.end();
m_info.m_wantsIECPassthrough = true;
m_info.m_streamTypes.clear();
m_info.m_dataFormats.push_back(AE_FMT_RAW);
Expand Down

0 comments on commit e8d15b2

Please sign in to comment.