scripts/default-nodes: Restrict to nodes that are not part of any collection

Nodes that are part of a collection are handled separately.
This commit is contained in:
Julian Bouzas 2025-12-16 14:34:08 -05:00
parent 86a86208e9
commit e1ec552b09
4 changed files with 15 additions and 3 deletions

View file

@ -23,7 +23,10 @@ SimpleEventHook {
local selected_node = event:get_data ("selected-node")
local om = source:call ("get-object-manager", "metadata")
local metadata = om:lookup { Constraint { "metadata.name", "=", "default" } }
local metadata = om:lookup {
Constraint { "metadata.name", "=", "default" },
Constraint { "wireplumber.collection", "-" },
}
if metadata == nil then
return
end

View file

@ -37,7 +37,10 @@ SimpleEventHook {
local props = event:get_properties ()
local def_node_type = props ["default-node.type"]
local metadata_om = source:call ("get-object-manager", "metadata")
local metadata = metadata_om:lookup { Constraint { "metadata.name", "=", "default" } }
local metadata = metadata_om:lookup {
Constraint { "metadata.name", "=", "default" },
Constraint { "wireplumber.collection", "-" },
}
local obj = metadata:find (0, "default.configured." .. def_node_type)
if not obj then

View file

@ -20,11 +20,13 @@ SimpleEventHook {
Constraint { "event.type", "c", "session-item-added", "session-item-removed" },
Constraint { "event.session-item.interface", "=", "linkable" },
Constraint { "media.class", "#", "Audio/*" },
Constraint { "collection.name", "-" },
},
EventInterest {
Constraint { "event.type", "c", "session-item-added", "session-item-removed" },
Constraint { "event.session-item.interface", "=", "linkable" },
Constraint { "media.class", "#", "Video/*" },
Constraint { "collection.name", "-" },
},
EventInterest {
Constraint { "event.type", "=", "metadata-changed" },
@ -32,6 +34,7 @@ SimpleEventHook {
Constraint { "event.subject.key", "c", "default.configured.audio.sink",
"default.configured.audio.source", "default.configured.video.source"
},
Constraint { "wireplumber.collection", "-" },
},
EventInterest {
Constraint { "event.type", "=", "device-params-changed"},
@ -96,13 +99,14 @@ function collectAvailableNodes (si_om, devices_om, port_direction, media_classes
for linkable in si_om:iterate {
type = "SiLinkable",
Constraint { "media.class", "c", table.unpack (media_classes) },
Constraint { "collection.name", "-" },
} do
local node = linkable:get_associated_proxy ("node")
local node_props = node.properties
-- check that the node has ports in the requested direction
if not node:lookup_port {
Constraint { "port.direction", "=", port_direction }
Constraint { "port.direction", "=", port_direction },
} then
goto next_linkable
end

View file

@ -73,6 +73,7 @@ store_configured_default_nodes_hook = SimpleEventHook {
Constraint { "event.subject.key", "c", "default.configured.audio.sink",
"default.configured.audio.source", "default.configured.video.source"
},
Constraint { "wireplumber.collection", "-" },
},
},
execute = function (event)
@ -119,6 +120,7 @@ metadata_added_hook = SimpleEventHook {
EventInterest {
Constraint { "event.type", "=", "metadata-added" },
Constraint { "metadata.name", "=", "default" },
Constraint { "wireplumber.collection", "-" },
},
},
execute = function (event)