mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2025-12-28 09:20:05 +01:00
scripts: add static-sessions.lua
Replaces the old create-session wireplumber.conf commands
This commit is contained in:
parent
03b17bcb5f
commit
c00a706998
2 changed files with 35 additions and 2 deletions
|
|
@ -24,9 +24,9 @@ function load_pw_module(m)
|
|||
end
|
||||
end
|
||||
|
||||
function load_script(s)
|
||||
function load_script(s, a)
|
||||
if not components[s] then
|
||||
components[s] = { s, type = "script/lua" }
|
||||
components[s] = { s, type = "script/lua", args = a }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -88,6 +88,10 @@ function enable_bluetooth()
|
|||
end
|
||||
|
||||
function enable_endpoints()
|
||||
load_script("static-sessions.lua", {
|
||||
["audio"] = {},
|
||||
["video"] = {},
|
||||
})
|
||||
load_script("create-endpoint.lua")
|
||||
load_script("policy-endpoint.lua")
|
||||
end
|
||||
|
|
|
|||
29
src/scripts/static-sessions.lua
Normal file
29
src/scripts/static-sessions.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
-- WirePlumber
|
||||
--
|
||||
-- Copyright © 2021 Collabora Ltd.
|
||||
-- @author George Kiagiadakis <george.kiagiadakis@collabora.com>
|
||||
--
|
||||
-- SPDX-License-Identifier: MIT
|
||||
|
||||
-- Receive script arguments from config.lua
|
||||
local sessions_config = ...
|
||||
|
||||
if sessions_config then
|
||||
sessions = {}
|
||||
|
||||
for k, v in pairs(sessions_config) do
|
||||
Log.info("Creating session: " .. k)
|
||||
|
||||
sessions[k] = ImplSession()
|
||||
|
||||
if type(v) == "table" then
|
||||
v["session.name"] = k
|
||||
sessions[k]:update_properties(v)
|
||||
else
|
||||
sessions[k]:update_properties({
|
||||
["session.name"] = k
|
||||
})
|
||||
end
|
||||
sessions[k]:activate()
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue