Skip to content
Snippets Groups Projects
Commit 9f77b98b authored by Julian Bouzas's avatar Julian Bouzas
Browse files

src: scripts: add static-endpoints.lua script

parent b2c90844
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,28 @@ default_policy.sessions = {
["video"] = { ["media.type"] = "Video" },
}
default_policy.endpoints = {
-- [endpoint name] = { endpoint properties }
["endpoint.music"] = {
["media.class"] = "Audio/Sink",
["role"] = "Music",
["priority"] = 0,
["session.name"] = "audio",
},
["endpoint.notifications"] = {
["media.class"] = "Audio/Sink",
["role"] = "Notifications",
["priority"] = 50,
["session.name"] = "audio",
},
["endpoint.voice"] = {
["media.class"] = "Audio/Source",
["role"] = "Voice",
["priority"] = 90,
["session.name"] = "audio",
},
}
default_policy.policy = {
move = true, -- moves session items when metadata target.node changes
follow = true -- moves session items to the default device when it has changed
......@@ -19,10 +41,14 @@ function default_policy.enable()
load_module("si-node")
load_module("si-audio-adapter")
load_module("si-standard-link")
load_module("si-audio-endpoint")
-- Create sessions statically at startup
load_script("static-sessions.lua", default_policy.sessions)
-- Create endpoints statically at startup
load_script("static-endpoints.lua", default_policy.endpoints)
-- Create items for nodes that appear in the graph
load_script("create-item.lua")
......
-- WirePlumber
--
-- Copyright © 2021 Collabora Ltd.
-- @author Julian Bouzas <julian.bouzas@collabora.com>
--
-- SPDX-License-Identifier: MIT
-- Receive script arguments from config.lua
local endpoints_config = ...
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)
ep:register ()
Log.info(ep, "registered endpoint " .. properties.name)
end)
end
for name, properties in pairs(endpoints_config) do
properties["name"] = name
createEndpoint ("si-audio-endpoint", properties)
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment