aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2023-02-18 13:07:28 -0800
committerLukas Rusak <lorusak@gmail.com>2023-02-22 22:44:15 -0800
commit5e18bd730419c2851fd7156e26f1c1c0965ebddd (patch)
tree3ebf46bd8d245e567237b647b95c465cb6fc311f
parent91cbf47e065b6b6f24e8b836a72a31c258938f6c (diff)
CAESinkPipewire: use structured bindings with global handling
Signed-off-by: Lukas Rusak <lorusak@gmail.com>
-rw-r--r--xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp b/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp
index ef93c88943..bc5e3d3f96 100644
--- a/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/pipewire/AESinkPipewire.cpp
@@ -303,14 +303,13 @@ void CAESinkPipewire::EnumerateDevicesEx(AEDeviceInfoList& list, bool force)
list.emplace_back(defaultDevice);
auto& registry = pipewire->GetRegistry();
- for (const auto& global : registry.GetGlobals())
+ for (const auto& [id, global] : registry.GetGlobals())
{
CAEDeviceInfo device;
device.m_deviceType = AE_DEVTYPE_PCM;
- device.m_deviceName = global.second->GetName();
- device.m_displayName = global.second->GetDescription();
- device.m_displayNameExtra =
- StringUtils::Format("{} (PIPEWIRE)", global.second->GetDescription());
+ device.m_deviceName = global->GetName();
+ device.m_displayName = global->GetDescription();
+ device.m_displayNameExtra = StringUtils::Format("{} (PIPEWIRE)", global->GetDescription());
device.m_wantsIECPassthrough = true;
std::for_each(formatMap.cbegin(), formatMap.cend(),
@@ -319,7 +318,7 @@ void CAESinkPipewire::EnumerateDevicesEx(AEDeviceInfoList& list, bool force)
std::for_each(defaultSampleRates.cbegin(), defaultSampleRates.cend(),
[&device](const auto& rate) { device.m_sampleRates.emplace_back(rate); });
- auto& node = global.second->GetNode();
+ auto& node = global->GetNode();
node.EnumerateFormats();
int ret = loop.Wait(5s);
@@ -382,7 +381,11 @@ bool CAESinkPipewire::Initialize(AEAudioFormat& format, std::string& device)
else
{
auto target = std::find_if(globals.begin(), globals.end(),
- [&device](const auto& p) { return device == p.second->GetName(); });
+ [&device](const auto& p)
+ {
+ const auto& [globalId, global] = p;
+ return device == global->GetName();
+ });
if (target == globals.end())
return false;