s-linking: always rescan when the default targets change
The "follow" setting was never really meant to disable reacting to default target changes. It is also not meant to disable moving normal streams to follow the default target. It is only meant to control whether streams with a 'target.object' that matches the default target will move or not to follow the default target changes (PulseAudio compat thing...) Even if we leave this code here, disabling the "follow" option may disable reacting to default target changes, but the streams will be moved anyway when there is some other change in the graph (i.e. in the next rescan)
This commit is contained in:
@@ -11,30 +11,6 @@ log = Log.open_topic ("s-linking")
|
||||
settings = require ("settings-linking")
|
||||
handles = {}
|
||||
|
||||
function handleFollowSetting (enable)
|
||||
if (not handles.follow_hook) and (enable == true) then
|
||||
handles.follow_hook = SimpleEventHook {
|
||||
name = "linking/follow",
|
||||
interests = {
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "metadata-changed" },
|
||||
Constraint { "metadata.name", "=", "default" },
|
||||
Constraint { "event.subject.key", "c", "default.audio.source",
|
||||
"default.audio.sink", "default.video.source" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
local source = event:get_source ()
|
||||
source:call ("schedule-rescan", "linking")
|
||||
end
|
||||
}
|
||||
handles.follow_hook:register ()
|
||||
elseif (handles.follow_hook) and (enable == false) then
|
||||
handles.follow_hook:remove ()
|
||||
handles.follow_hook = nil
|
||||
end
|
||||
end
|
||||
|
||||
function handleMoveSetting (enable)
|
||||
if (not handles.move_hook) and (enable == true) then
|
||||
handles.move_hook = SimpleEventHook {
|
||||
@@ -58,8 +34,5 @@ function handleMoveSetting (enable)
|
||||
end
|
||||
end
|
||||
|
||||
settings:subscribe ("follow", handleFollowSetting)
|
||||
handleFollowSetting (settings.follow)
|
||||
|
||||
settings:subscribe ("move", handleMoveSetting)
|
||||
handleMoveSetting (settings.move)
|
||||
|
@@ -179,6 +179,13 @@ SimpleEventHook {
|
||||
Constraint { "event.type", "=", "device-params-changed" },
|
||||
Constraint { "event.subject.param-id", "=", "Route" },
|
||||
},
|
||||
-- on any "default" target changed
|
||||
EventInterest {
|
||||
Constraint { "event.type", "=", "metadata-changed" },
|
||||
Constraint { "metadata.name", "=", "default" },
|
||||
Constraint { "event.subject.key", "c", "default.audio.source",
|
||||
"default.audio.sink", "default.video.source" },
|
||||
},
|
||||
},
|
||||
execute = function (event)
|
||||
local source = event:get_source ()
|
||||
|
Reference in New Issue
Block a user