mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-09 03:58:05 +02:00
Restrict the policy to session items that are not part of any collection
This will avoid conflics with collection specific policies. The policy scripts have also been moved inside the 'default' sub-directory.
This commit is contained in:
parent
f66d91a842
commit
6634ce8f17
11 changed files with 57 additions and 38 deletions
|
|
@ -709,36 +709,36 @@ wireplumber.components = [
|
|||
requires = [ hooks.linking.rescan ]
|
||||
}
|
||||
{
|
||||
name = linking/find-media-role-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.find-media-role
|
||||
name = linking/default/find-media-role-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.find-media-role
|
||||
}
|
||||
{
|
||||
name = linking/find-defined-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.find-defined
|
||||
name = linking/default/find-defined-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.find-defined
|
||||
}
|
||||
{
|
||||
name = linking/find-audio-group-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.find-audio-group
|
||||
name = linking/default/find-audio-group-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.find-audio-group
|
||||
requires = [ node.audio-group ]
|
||||
}
|
||||
{
|
||||
name = linking/find-filter-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.find-filter
|
||||
name = linking/default/find-filter-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.find-filter
|
||||
requires = [ metadata.filters ]
|
||||
}
|
||||
{
|
||||
name = linking/find-default-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.find-default
|
||||
name = linking/default/find-default-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.find-default
|
||||
requires = [ api.default-nodes ]
|
||||
}
|
||||
{
|
||||
name = linking/find-best-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.find-best
|
||||
name = linking/default/find-best-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.find-best
|
||||
requires = [ metadata.filters ]
|
||||
}
|
||||
{
|
||||
name = linking/get-filter-from-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.get-filter-from
|
||||
name = linking/default/get-filter-from-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.get-filter-from
|
||||
requires = [ metadata.filters ]
|
||||
}
|
||||
{
|
||||
|
|
@ -762,13 +762,13 @@ wireplumber.components = [
|
|||
hooks.linking.target.prepare-link,
|
||||
hooks.linking.target.link ]
|
||||
wants = [ hooks.linking.rescan-on-linkable,
|
||||
hooks.linking.target.find-media-role,
|
||||
hooks.linking.target.find-defined,
|
||||
hooks.linking.target.find-audio-group,
|
||||
hooks.linking.target.find-filter,
|
||||
hooks.linking.target.find-default,
|
||||
hooks.linking.target.find-best,
|
||||
hooks.linking.target.get-filter-from,
|
||||
hooks.linking.default.target.find-media-role,
|
||||
hooks.linking.default.target.find-defined,
|
||||
hooks.linking.default.target.find-audio-group,
|
||||
hooks.linking.default.target.find-filter,
|
||||
hooks.linking.default.target.find-default,
|
||||
hooks.linking.default.target.find-best,
|
||||
hooks.linking.default.target.get-filter-from,
|
||||
hooks.linking.pause-playback ]
|
||||
}
|
||||
|
||||
|
|
@ -784,15 +784,15 @@ wireplumber.components = [
|
|||
requires = [ hooks.linking.role-based.rescan ]
|
||||
}
|
||||
{
|
||||
name = linking/find-media-role-sink-target.lua, type = script/lua
|
||||
provides = hooks.linking.target.find-media-role-sink
|
||||
name = linking/default/find-media-role-sink-target.lua, type = script/lua
|
||||
provides = hooks.linking.default.target.find-media-role-sink
|
||||
}
|
||||
{
|
||||
type = virtual, provides = policy.linking.role-based
|
||||
requires = [ policy.linking.standard,
|
||||
hooks.linking.role-based.rescan,
|
||||
hooks.node.role-based.default-volume,
|
||||
hooks.linking.target.find-media-role-sink ]
|
||||
hooks.linking.default.target.find-media-role-sink ]
|
||||
}
|
||||
|
||||
## Standard policy definition
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -56,6 +57,7 @@ SimpleEventHook {
|
|||
Constraint { "item.node.type", "=", "device" },
|
||||
Constraint { "item.node.direction", "=", target_direction },
|
||||
Constraint { "media.type", "=", si_props ["media.type"] },
|
||||
Constraint { "collection.name", "-" },
|
||||
} do
|
||||
target_node = target:get_associated_proxy ("node")
|
||||
target_node_props = target_node.properties
|
||||
|
|
@ -21,6 +21,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -46,6 +47,7 @@ SimpleEventHook {
|
|||
Constraint { "item.node.type", "=", "device" },
|
||||
Constraint { "item.node.direction", "=", target_direction },
|
||||
Constraint { "media.type", "=", si_props ["media.type"] },
|
||||
Constraint { "collection.name", "-" },
|
||||
} do
|
||||
local target_props = target.properties
|
||||
local target_node_id = target_props ["node.id"]
|
||||
|
|
@ -19,6 +19,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -19,6 +19,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -75,12 +76,16 @@ SimpleEventHook {
|
|||
target = om:lookup {
|
||||
type = "SiLinkable",
|
||||
Constraint { target_key, "=", target_value },
|
||||
Constraint { "collection.name", "-" },
|
||||
}
|
||||
if target and lutils.canLink (si_props, target) then
|
||||
target_picked = true
|
||||
end
|
||||
elseif target_value then
|
||||
for lnkbl in om:iterate { type = "SiLinkable" } do
|
||||
for lnkbl in om:iterate {
|
||||
type = "SiLinkable",
|
||||
Constraint { "collection.name", "-" },
|
||||
} do
|
||||
local target_props = lnkbl.properties
|
||||
if (target_props ["node.name"] == target_value or
|
||||
target_props ["object.path"] == target_value) and
|
||||
|
|
@ -38,6 +38,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -19,6 +19,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -45,6 +46,7 @@ SimpleEventHook {
|
|||
type = "SiLinkable",
|
||||
Constraint { "media.class", "=", "Audio/Sink" },
|
||||
Constraint { "node.link-group", "=", link_group },
|
||||
Constraint { "collection.name", "-" },
|
||||
}
|
||||
|
||||
if input_node == nil then
|
||||
|
|
@ -62,20 +64,22 @@ SimpleEventHook {
|
|||
type = "SiLinkable",
|
||||
Constraint { "item.factory.name", "c", "si-audio-adapter", "si-node" },
|
||||
Constraint { "node.name", "=", target_name },
|
||||
Constraint { "collection.name", "-" },
|
||||
}
|
||||
if si_target == nil then
|
||||
si_target = om:lookup {
|
||||
type = "SiLinkable",
|
||||
Constraint { "item.factory.name", "c", "si-audio-adapter", "si-node" },
|
||||
Constraint { "node.nick", "=", target_name },
|
||||
}
|
||||
si_target = om:lookup {
|
||||
type = "SiLinkable",
|
||||
Constraint { "item.factory.name", "c", "si-audio-adapter", "si-node" },
|
||||
Constraint { "node.nick", "=", target_name },
|
||||
Constraint { "collection.name", "-" },
|
||||
}
|
||||
end
|
||||
if si_target then
|
||||
log:info (si,
|
||||
log:info (si,
|
||||
string.format ("... role based sink target picked: %s (%s)",
|
||||
tostring (si_target.properties ["node.name"]),
|
||||
tostring (si_target.properties ["node.id"])))
|
||||
event:set_data ("target", si_target)
|
||||
event:set_data ("target", si_target)
|
||||
end
|
||||
end
|
||||
}:register ()
|
||||
|
|
@ -18,6 +18,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -41,6 +42,7 @@ SimpleEventHook {
|
|||
Constraint { "item.node.direction", "=", target_direction },
|
||||
Constraint { "device.intended-roles", "+" },
|
||||
Constraint { "media.type", "=", si_props["media.type"] },
|
||||
Constraint { "collection.name", "-" },
|
||||
} do
|
||||
|
||||
local roles_json = si_target.properties["device.intended-roles"]
|
||||
|
|
@ -15,6 +15,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -22,6 +22,7 @@ SimpleEventHook {
|
|||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "select-target" },
|
||||
Constraint { "collection.name", "-" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
|
|
@ -240,12 +240,12 @@ load_components (ScriptRunnerFixture *f, gconstpointer argv)
|
|||
|
||||
load_component (f, "node/create-item.lua", "script/lua");
|
||||
|
||||
load_component (f, "linking/find-best-target.lua", "script/lua");
|
||||
load_component (f, "linking/find-default-target.lua", "script/lua");
|
||||
load_component (f, "linking/find-defined-target.lua", "script/lua");
|
||||
load_component (f, "linking/find-filter-target.lua", "script/lua");
|
||||
load_component (f, "linking/find-media-role-target.lua", "script/lua");
|
||||
load_component (f, "linking/get-filter-from-target.lua", "script/lua");
|
||||
load_component (f, "linking/default/find-best-target.lua", "script/lua");
|
||||
load_component (f, "linking/default/find-default-target.lua", "script/lua");
|
||||
load_component (f, "linking/default/find-defined-target.lua", "script/lua");
|
||||
load_component (f, "linking/default/find-filter-target.lua", "script/lua");
|
||||
load_component (f, "linking/default/find-media-role-target.lua", "script/lua");
|
||||
load_component (f, "linking/default/get-filter-from-target.lua", "script/lua");
|
||||
load_component (f, "linking/link-target.lua", "script/lua");
|
||||
load_component (f, "linking/prepare-link.lua", "script/lua");
|
||||
load_component (f, "linking/rescan.lua", "script/lua");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue