Files
wireplumber/src/scripts/static-endpoints.lua
Julian Bouzas 360e0b3eaf scripts: use WpConf API to get configuration values
This patch also moves nested configuration objects that are not considered
settings from the wireplumber.settings section to its own configuration
section (eg the rules array, the spa plugin properties, etc...). This allows
those objects to be merged with other same sections defined in other files.
2023-04-17 07:48:18 -04:00

43 lines
1.0 KiB
Lua

-- WirePlumber
--
-- Copyright © 2021 Collabora Ltd.
-- @author Julian Bouzas <julian.bouzas@collabora.com>
--
-- SPDX-License-Identifier: MIT
-- Receive script arguments from config.lua
local defaults = {}
defaults.endpoints = Json.Object {}
local config = {}
config.endpoints = Conf.get_section (
"endpoints", defaults.endpoints):parse ()
function createEndpoint (factory_name, properties)
-- create endpoint
local ep = SessionItem ( factory_name )
if not ep then
Log.warning (ep, "could not create endpoint of type " .. factory_name)
return
end
-- configure endpoint
if not ep:configure(properties) then
Log.warning(ep, "failed to configure endpoint " .. properties.name)
return
end
-- activate and register endpoint
ep:activate (Features.ALL, function (item)
item:register ()
Log.info(item, "registered endpoint " .. properties.name)
end)
end
for name, properties in pairs(config.endpoints) do
properties["name"] = name
createEndpoint ("si-audio-endpoint", properties)
end