si-interfaces: rename WpSiPortInfo to WpSiLinkable
This commit is contained in:
@@ -108,7 +108,7 @@ function getSiLinkAndSiPeer (si_ep, target_media_class)
|
||||
local in_id = tonumber(silink.properties["in.item.id"])
|
||||
if out_id == si_ep.id or in_id == si_ep.id then
|
||||
local is_out = out_id == si_ep.id and true or false
|
||||
for peer in siportinfos_om:iterate() do
|
||||
for peer in silinkables_om:iterate() do
|
||||
if peer.id == (is_out and in_id or out_id) then
|
||||
local peer_node = peer:get_associated_proxy ("node")
|
||||
local peer_media_class = peer_node.properties["media.class"]
|
||||
@@ -133,7 +133,7 @@ function handleSiEndpoint (si_ep)
|
||||
Log.info (si_ep, "handling endpoint " .. si_ep.properties["name"])
|
||||
|
||||
-- find proper target item
|
||||
local si_target = findUndefinedTarget (target_media_class, siportinfos_om)
|
||||
local si_target = findUndefinedTarget (target_media_class, silinkables_om)
|
||||
if not si_target then
|
||||
Log.info (si_ep, "target item not found")
|
||||
return
|
||||
@@ -165,8 +165,8 @@ function reevaluateLinks ()
|
||||
for silink in silinks_om:iterate() do
|
||||
local out_id = tonumber (silink.properties["out.item.id"])
|
||||
local in_id = tonumber (silink.properties["in.item.id"])
|
||||
if (getSessionItemById (out_id, siendpoints_om) and not getSessionItemById (in_id, siportinfos_om)) or
|
||||
(getSessionItemById (in_id, siendpoints_om) and not getSessionItemById (out_id, siportinfos_om)) then
|
||||
if (getSessionItemById (out_id, siendpoints_om) and not getSessionItemById (in_id, silinkables_om)) or
|
||||
(getSessionItemById (in_id, siendpoints_om) and not getSessionItemById (out_id, silinkables_om)) then
|
||||
silink:remove ()
|
||||
Log.info (silink, "link removed")
|
||||
end
|
||||
@@ -175,7 +175,7 @@ end
|
||||
|
||||
default_nodes = Plugin.find("default-nodes-api")
|
||||
siendpoints_om = ObjectManager { Interest { type = "SiEndpoint" }}
|
||||
siportinfos_om = ObjectManager { Interest { type = "SiPortInfo",
|
||||
silinkables_om = ObjectManager { Interest { type = "SiLinkable",
|
||||
-- only handle si-audio-adapter and si-node
|
||||
Constraint {
|
||||
"si.factory.name", "c", "si-audio-adapter", "si-node", type = "pw-global" },
|
||||
@@ -193,10 +193,10 @@ if config.follow then
|
||||
end)
|
||||
end
|
||||
|
||||
siportinfos_om:connect("objects-changed", function (om)
|
||||
silinkables_om:connect("objects-changed", function (om)
|
||||
reevaluateLinks ()
|
||||
end)
|
||||
|
||||
siendpoints_om:activate()
|
||||
siportinfos_om:activate()
|
||||
silinkables_om:activate()
|
||||
silinks_om:activate()
|
||||
|
Reference in New Issue
Block a user