Skip to content

Commit ee74790

Browse files
committed
alsa: use tdm-b on s5 for hbr passthrough
SoC does not support spdifb for hbr audio passthrough.
1 parent 01ef22e commit ee74790

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -2649,6 +2649,8 @@ void CActiveAE::LoadSettings(AEAudioFormat *format)
26492649

26502650
switch (aml_get_cpufamily_id())
26512651
{
2652+
case AML_S5:
2653+
[[fallthrough]];
26522654
case AML_T7:
26532655
{
26542656
// find on NEWSTREAM the matching passthrough device by device type

xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESettings.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ void CActiveAESettings::SettingOptionsAudioDevicesFillerGeneral(
174174
list.emplace_back("Error - no devices found", "error");
175175
else
176176
{
177+
bool filter_passthrough = (aml_get_cpufamily_id() == AML_S5 || aml_get_cpufamily_id() == AML_T7);
177178
for (AEDeviceList::const_iterator sink = sinkList.begin(); sink != sinkList.end(); ++sink)
178179
{
179-
// filter L-PCM device when passthrough on Amlogic T7
180-
if (passthrough && aml_get_cpufamily_id() == AML_T7 &&
180+
// filter L-PCM device when passthrough on Amlogic S5/T7
181+
if (passthrough && filter_passthrough &&
181182
StringUtils::StartsWith(sink->second, "ALSA:surround71"))
182183
continue;
183184

xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ std::string CActiveAESink::ValidateOuputDevice(const std::string& device, bool p
751751
if (!passthrough && d.m_onlyPassthrough)
752752
continue;
753753

754-
// filter L-PCM device when passthrough on Amlogic T7
754+
// filter L-PCM device when passthrough on Amlogic S5/T7
755755
if (passthrough && (d.m_deviceName.substr(0, d.m_deviceName.find(':')) == "surround71"))
756756
continue;
757757

@@ -777,7 +777,7 @@ std::string CActiveAESink::ValidateOuputDevice(const std::string& device, bool p
777777
if (!passthrough && d.m_onlyPassthrough)
778778
continue;
779779

780-
// filter L-PCM device when passthrough on Amlogic T7
780+
// filter L-PCM device when passthrough on Amlogic S5/T7
781781
if (passthrough && (d.m_deviceName.substr(0, d.m_deviceName.find(':')) == "surround71"))
782782
continue;
783783

@@ -805,7 +805,7 @@ std::string CActiveAESink::ValidateOuputDevice(const std::string& device, bool p
805805
if (!passthrough && d.m_onlyPassthrough)
806806
continue;
807807

808-
// filter L-PCM device when passthrough on Amlogic T7
808+
// filter L-PCM device when passthrough on Amlogic S5/T7
809809
if (passthrough && (d.m_deviceName.substr(0, d.m_deviceName.find(':')) == "surround71"))
810810
continue;
811811

@@ -838,7 +838,7 @@ std::string CActiveAESink::ValidateOuputDevice(const std::string& device, bool p
838838
if (!passthrough && d.m_onlyPassthrough)
839839
continue;
840840

841-
// filter L-PCM device when passthrough on Amlogic T7
841+
// filter L-PCM device when passthrough on Amlogic S5/T7
842842
if (passthrough && (d.m_deviceName.substr(0, d.m_deviceName.find(':')) == "surround71"))
843843
continue;
844844

xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp

+18-3
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ void CAESinkALSA::aml_configure_simple_control(std::string &device, const enum I
576576
"Audio spdif_b format", // set SPDIF-B codec format
577577
"",
578578
"",
579-
"Audio I2S to HDMITX Format" // set TDM-C codec format
579+
"Audio I2S to HDMITX Format" // set TDM codec format
580580
};
581581

582582
int cardNr = 0;
@@ -639,6 +639,17 @@ void CAESinkALSA::aml_configure_simple_control(std::string &device, const enum I
639639
case AE_DEVTYPE_HDMI:
640640
case AE_DEVTYPE_PCM:
641641
switch (soc_id) {
642+
case AML_S5:
643+
switch (codec) {
644+
case TRUEHD:
645+
case _DTS_HD_MA:
646+
spdif_id = HDMITX_SRC_TDM_B;
647+
break;
648+
default:
649+
spdif_id = HDMITX_SRC_SPDIF_B;
650+
break;
651+
}
652+
break;
642653
case AML_T7:
643654
switch (codec) {
644655
case TRUEHD:
@@ -1607,8 +1618,9 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
16071618

16081619
AEDeviceType CAESinkALSA::AEDeviceTypeFromName(const std::string &name)
16091620
{
1621+
bool mark_surround71_as_hdmi = (aml_get_cpufamily_id() == AML_S5 || aml_get_cpufamily_id() == AML_T7);
16101622
if (name.substr(0, name.find(':')) == "hdmi" ||
1611-
(aml_get_cpufamily_id() == AML_T7 && name.substr(0, name.find(':')) == "surround71"))
1623+
(mark_surround71_as_hdmi && name.substr(0, name.find(':')) == "surround71"))
16121624
return AE_DEVTYPE_HDMI;
16131625
else if (name.substr(0, name.find(':')) == "iec958" || name.substr(0, name.find(':')) == "spdif")
16141626
return AE_DEVTYPE_IEC958;
@@ -1867,6 +1879,7 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev
18671879

18681880
if (GetAMLDeviceType(info.m_displayName) != AML_NONE)
18691881
{
1882+
bool use_surround71_as_lpcm = (aml_get_cpufamily_id() == AML_S5 || aml_get_cpufamily_id() == AML_T7);
18701883
if (info.m_deviceType == AE_DEVTYPE_IEC958)
18711884
info.m_displayNameExtra = "S/PDIF";
18721885
else if (info.m_deviceType != AE_DEVTYPE_HDMI)
@@ -1876,7 +1889,7 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev
18761889
else
18771890
info.m_displayNameExtra = "PCM";
18781891
}
1879-
else if (aml_get_cpufamily_id() == AML_T7 && info.m_deviceType == AE_DEVTYPE_HDMI)
1892+
else if (use_surround71_as_lpcm && info.m_deviceType == AE_DEVTYPE_HDMI)
18801893
{
18811894
if (device.substr(0, device.find(':')) == "surround71")
18821895
info.m_displayNameExtra = "HDMI Multi Ch PCM";
@@ -1888,6 +1901,8 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev
18881901
{
18891902
switch (aml_get_cpufamily_id())
18901903
{
1904+
case AML_S5:
1905+
[[fallthrough]];
18911906
case AML_T7:
18921907
{
18931908
if (device.substr(0, device.find(':')) == "surround71")

0 commit comments

Comments
 (0)