mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-05 17:08:01 +02:00
scripts: populate session.services via a script
See pipewire!1409 / wireplumber!441
This commit is contained in:
parent
b697546476
commit
b031d3fcd1
2 changed files with 56 additions and 0 deletions
|
|
@ -129,6 +129,7 @@ wireplumber.profiles = {
|
|||
check.no-media-session = required
|
||||
support.settings = required
|
||||
support.log-settings = required
|
||||
support.session-services = required
|
||||
}
|
||||
|
||||
# Disable features that are meant only for user sessions
|
||||
|
|
@ -339,6 +340,12 @@ wireplumber.components = [
|
|||
provides = metadata.sm-objects
|
||||
}
|
||||
|
||||
## Populates the "session.services" property on the WirePlumber client object
|
||||
{
|
||||
name = session-services.lua, type = script/lua
|
||||
provides = support.session-services
|
||||
}
|
||||
|
||||
## Device monitors' optional features
|
||||
{
|
||||
type = virtual, provides = monitor.alsa.reserve-device,
|
||||
|
|
@ -738,6 +745,17 @@ wireplumber.components.rules = [
|
|||
}
|
||||
}
|
||||
}
|
||||
# session-services.lua must execute at the very end
|
||||
{
|
||||
matches = [
|
||||
{ name = "!session-services.lua" }
|
||||
]
|
||||
actions = {
|
||||
merge = {
|
||||
before = [ support.session-services ]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
wireplumber.settings.schema = {
|
||||
|
|
|
|||
38
src/scripts/session-services.lua
Normal file
38
src/scripts/session-services.lua
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
-- WirePlumber
|
||||
--
|
||||
-- Copyright © 2024 Collabora Ltd.
|
||||
--
|
||||
-- SPDX-License-Identifier: MIT
|
||||
|
||||
local features_to_services = {
|
||||
["monitor.alsa"] = { "audio", "api.alsa" },
|
||||
["monitor.alsa-midi"] = { "midi", "api.alsa-seq" },
|
||||
["monitor.bluez"] = { "bluetooth.audio", "api.bluez" },
|
||||
["monitor.bluez-midi"] = { "bluetooth.midi", "api.bluez" },
|
||||
["monitor.v4l2"] = { "video-capture", "api.v4l2" },
|
||||
["monitor.libcamera"] = { "video-capture", "api.libcamera" },
|
||||
["policy.device.profile"] = { "policy.device.profile" },
|
||||
["policy.device.routes"] = { "policy.device.routes" },
|
||||
["policy.default-nodes"] = { "policy.default-nodes" },
|
||||
["policy.linking.standard"] = { "policy.linking.standard" },
|
||||
["policy.linking.role-based"] = { "policy.linking.role-based" },
|
||||
}
|
||||
|
||||
local services = {}
|
||||
for k, v in pairs (features_to_services) do
|
||||
if Core.test_feature (k) then
|
||||
for _, s in pairs (v) do
|
||||
services[s] = s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- convert to array with numeric indices
|
||||
local services_array = {}
|
||||
for _, s in pairs (services) do
|
||||
table.insert (services_array, s)
|
||||
end
|
||||
|
||||
Core.update_properties {
|
||||
["session.services"] = "[" .. table.concat (services_array, ", ") .. "]"
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue