From 2e36b7522bae549cdad38a6b4bc04dec5629f954 Mon Sep 17 00:00:00 2001 From: fritsch Date: Tue, 20 Feb 2024 21:22:51 +0100 Subject: [PATCH 1/2] AESinkPipewire: Properly identify HDMI devices Without this AE would only allow passthrough on SPDIF devices as it checks for the device not being PCM when allowing Passthrough. Co-authored-by: Lukas Rusak --- .../AudioEngine/Sinks/pipewire/AESinkPipewire.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp b/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp index 0b76c339de24d..062676a16ef3e 100644 --- a/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp +++ b/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp @@ -348,10 +348,17 @@ void CAESinkPipewire::EnumerateDevicesEx(AEDeviceInfoList& list, bool force) streamTypes.end()); } - if (device.m_channels.Count() == 2 && !device.m_streamTypes.empty()) + if (!device.m_streamTypes.empty()) { - device.m_deviceType = AE_DEVTYPE_IEC958; device.m_dataFormats.emplace_back(AE_FMT_RAW); + if (device.m_channels.Count() == 2) + { + device.m_deviceType = AE_DEVTYPE_IEC958; + } + else + { + device.m_deviceType = AE_DEVTYPE_HDMI; + } } list.emplace_back(device); From c5e9708e3d22d58da6843d2f490c1de579e48649 Mon Sep 17 00:00:00 2001 From: fritsch Date: Wed, 21 Feb 2024 06:01:13 +0100 Subject: [PATCH 2/2] AESinkPipewire: Fix Passthrough channel availability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems the Pipewire can easily configure TrueHD as IEC Format while only two channels are available. This is not correct. As later on when AE starts playing 8 channels are opened, already enumerate properly. Co-authored-by: Lukas Rusak Co-authored-by: Markus Härer --- .../AudioEngine/Sinks/pipewire/AESinkPipewire.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp b/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp index 062676a16ef3e..d06b1ec579b8d 100644 --- a/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp +++ b/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp @@ -348,10 +348,18 @@ void CAESinkPipewire::EnumerateDevicesEx(AEDeviceInfoList& list, bool force) streamTypes.end()); } + // If DTS-HD-MA or TrueHD are configured 8 channels are needed + bool hasHBRFormat = std::any_of(device.m_streamTypes.cbegin(), device.m_streamTypes.cend(), + [](const auto& streamType) + { + return streamType == CAEStreamInfo::STREAM_TYPE_TRUEHD || + streamType == CAEStreamInfo::STREAM_TYPE_DTSHD_MA; + }); + if (!device.m_streamTypes.empty()) { device.m_dataFormats.emplace_back(AE_FMT_RAW); - if (device.m_channels.Count() == 2) + if (!hasHBRFormat && device.m_channels.Count() == 2) { device.m_deviceType = AE_DEVTYPE_IEC958; }