node/software-dsp: implement loading filter graphs from disk

Using the new Conf() constructor, we can load and parse a filter graph
from a file on disk. This is useful when, for example, maintaining a
large database of filter graphs. It also keeps wireplumber.conf.d free
from clutter.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
This commit is contained in:
James Calligeros
2024-04-06 16:12:57 +10:00
parent d77edf70e9
commit d89293b606

View File

@@ -36,6 +36,19 @@ SimpleEventHook {
if props["filter-graph"] then
log:debug("Loading filter graph for " .. node.properties["node.name"])
filter_nodes[node.properties["object.id"]] = LocalModule("libpipewire-module-filter-chain", props["filter-graph"], {})
elseif props["filter-path"] then
log:debug("Loading filter graph for " .. node.properties["node.name"] .. " from disk")
local conf = Conf(props["filter-path"], {
["as-section"] = "node.software-dsp.graph",
["no-fragments"] = true
})
local err = conf:open()
if not err then
local args = conf:get_section_as_json("node.software-dsp.graph"):to_string()
filter_nodes[node.properties["object.id"]] = LocalModule("libpipewire-module-filter-chain", args, {})
else
log:warning("Unable to load filter graph for " .. node.properties["node.name"])
end
end
if cutils.parseBool (props["hide-parent"]) then