mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-02 06:17:59 +02:00
monitors: sanitize node names to match media-session's behavior
This commit is contained in:
parent
e92351b23b
commit
4ae15a14ac
3 changed files with 12 additions and 2 deletions
|
|
@ -114,6 +114,9 @@ function createNode(parent, id, type, factory, properties)
|
|||
.. "." ..
|
||||
profile
|
||||
|
||||
-- sanitize name
|
||||
name = name:gsub("([^%w_%-%.])", "_")
|
||||
|
||||
properties["node.name"] = name
|
||||
|
||||
-- deduplicate nodes with the same name
|
||||
|
|
@ -127,10 +130,12 @@ function createNode(parent, id, type, factory, properties)
|
|||
end
|
||||
|
||||
-- and a nick
|
||||
properties["node.nick"] = properties["node.nick"]
|
||||
local nick = properties["node.nick"]
|
||||
or dev_props["device.nick"]
|
||||
or dev_props["api.alsa.card.name"]
|
||||
or dev_props["alsa.card_name"]
|
||||
-- also sanitize nick, but allow all characters except :
|
||||
properties["node.nick"] = nick:gsub("(:)", "_")
|
||||
|
||||
-- ensure the node has a description
|
||||
if not properties["node.description"] then
|
||||
|
|
|
|||
|
|
@ -56,11 +56,13 @@ function createNode(parent, id, type, factory, properties)
|
|||
or "bluetooth-device"
|
||||
|
||||
-- set the node name
|
||||
properties["node.name"] =
|
||||
local name =
|
||||
((factory:find("sink") and "bluez_output") or
|
||||
(factory:find("source") and "bluez_input" or factory)) .. "." ..
|
||||
(properties["api.bluez5.address"] or dev_props["device.name"]) .. "." ..
|
||||
(properties["api.bluez5.profile"] or "unknown")
|
||||
-- sanitize name
|
||||
properties["node.name"] = name:gsub("([^%w_%-%.])", "_")
|
||||
|
||||
-- set priority
|
||||
if not properties["priority.driver"] then
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ function createNode(parent, id, type, factory, properties)
|
|||
dev_props["device.alias"] or
|
||||
"v4l2-device")
|
||||
|
||||
-- sanitize name
|
||||
name = name:gsub("([^%w_%-%.])", "_")
|
||||
|
||||
properties["node.name"] = name
|
||||
|
||||
-- deduplicate nodes with the same name
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue