
This removes both the policy-virtual-client.lua and policy-virtual-device.lua scripts, and creates a new linking/find-virtual-target.lua script to link clients with virtual session items if one of them can be found. In addition to this, this patch also ports the policy-virtual-client-links.lua into a new scripts/rescan-virtual-links.lua to use the event stack. The idea is for the scripts/link-target.lua to create all links but only activate non virtual links, and for the scripts/rescan-virtual-links.lua to activate/deactivate virtual links based on role priorities.
43 lines
1.1 KiB
Lua
43 lines
1.1 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.virtual_items = Json.Object {}
|
|
|
|
local config = {}
|
|
config.virtual_items = Conf.get_section (
|
|
"virtual-items", defaults.virtual_items):parse ()
|
|
|
|
function createVirtualItem (factory_name, properties)
|
|
-- create virtual item
|
|
local si_v = SessionItem ( factory_name )
|
|
if not si_v then
|
|
Log.warning (si_v, "could not create virtual item of type " .. factory_name)
|
|
return
|
|
end
|
|
|
|
-- configure virtual item
|
|
if not si_v:configure(properties) then
|
|
Log.warning(si_v, "failed to configure virtual item " .. properties.name)
|
|
return
|
|
end
|
|
|
|
-- activate and register virtual item
|
|
si_v:activate (Features.ALL, function (item)
|
|
item:register ()
|
|
Log.info(item, "registered virtual item " .. properties.name)
|
|
end)
|
|
end
|
|
|
|
|
|
for name, properties in pairs(config.virtual_items) do
|
|
properties["name"] = name
|
|
createVirtualItem ("si-audio-virtual", properties)
|
|
end
|