mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-08 09:18:03 +02:00
config: unify config and config-split
After all, we can just load multiple lua config files/directories from a single .conf file and so have both styles available for the user to choose at runtime
This commit is contained in:
parent
14f4337cdb
commit
28a4229681
31 changed files with 5 additions and 417 deletions
|
|
@ -1,53 +0,0 @@
|
|||
components = {}
|
||||
|
||||
function load_module(m)
|
||||
if not components[m] then
|
||||
components[m] = { "libwireplumber-module-" .. m, type = "module" }
|
||||
end
|
||||
end
|
||||
|
||||
function load_pw_module(m)
|
||||
if not components[m] then
|
||||
components[m] = { "libpipewire-module-" .. m, type = "pw_module" }
|
||||
end
|
||||
end
|
||||
|
||||
function load_script(s, a)
|
||||
if not components[s] then
|
||||
components[s] = { s, type = "script/lua", args = a }
|
||||
end
|
||||
end
|
||||
|
||||
function load_monitor(s, a)
|
||||
load_script("monitors/" .. s .. ".lua", a)
|
||||
end
|
||||
|
||||
function load_access(s, a)
|
||||
load_script("access/access-" .. s .. ".lua", a)
|
||||
end
|
||||
|
||||
-- Additional PipeWire modules can be loaded in WirePlumber like this.
|
||||
-- libpipewire already loads all the modules that we normally need, though.
|
||||
-- module-spa-node-factory may be needed if you want to use a monitor with
|
||||
-- LocalNode and the "spa-node-factory" factory
|
||||
-- ("adapter" is loaded by default, but "spa-node-factory" isn't)
|
||||
--
|
||||
-- load_pw_module ("spa-node-factory")
|
||||
|
||||
-- Automatically suspends idle nodes after 3 seconds
|
||||
load_script("suspend-node.lua")
|
||||
|
||||
-- Automatically sets device profiles to 'On'
|
||||
load_module("device-activation")
|
||||
|
||||
-- Automatically save and restore default routes
|
||||
load_module("default-routes")
|
||||
|
||||
-- Implements storing metadata about objects in RAM
|
||||
load_module("metadata")
|
||||
|
||||
-- Enables saving and restoring default nodes
|
||||
load_module("default-nodes")
|
||||
|
||||
-- API to access default nodes from scripts
|
||||
load_module("default-nodes-api")
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
-- Default policy config file --
|
||||
|
||||
default_policy = {}
|
||||
|
||||
default_policy.sessions = {
|
||||
-- [session name] = { session properties }
|
||||
["audio"] = { ["media.type"] = "Audio" },
|
||||
["video"] = { ["media.type"] = "Video" },
|
||||
}
|
||||
|
||||
default_policy.endpoints = {
|
||||
-- [endpoint name] = { endpoint properties }
|
||||
--[[
|
||||
["endpoint.multimedia"] = {
|
||||
["media.class"] = "Audio/Sink",
|
||||
["role"] = "Multimedia",
|
||||
},
|
||||
["endpoint.notifications"] = {
|
||||
["media.class"] = "Audio/Sink",
|
||||
["role"] = "Notification",
|
||||
},
|
||||
["endpoint.alert"] = {
|
||||
["media.class"] = "Audio/Sink",
|
||||
["role"] = "Alert",
|
||||
},
|
||||
--]]
|
||||
}
|
||||
|
||||
default_policy.policy = {
|
||||
["move"] = true, -- moves session items when metadata target.node changes
|
||||
["follow"] = true, -- moves session items to the default device when it has changed
|
||||
|
||||
--[[
|
||||
["roles"] = {
|
||||
["Multimedia"] = {
|
||||
["alias"] = { "Movie", "Music", "Game" },
|
||||
["priority"] = 10,
|
||||
["action.default"] = "mix",
|
||||
},
|
||||
["Notification"] = {
|
||||
["priority"] = 20,
|
||||
["action.default"] = "duck",
|
||||
["action.Notification"] = "mix",
|
||||
},
|
||||
["Alert"] = {
|
||||
["priority"] = 30,
|
||||
["action.default"] = "cork",
|
||||
["action.Alert"] = "mix",
|
||||
},
|
||||
},
|
||||
--]]
|
||||
}
|
||||
|
||||
function default_policy.enable()
|
||||
-- Session item factories, building blocks for the session management graph
|
||||
-- Do not disable these unless you really know what you are doing
|
||||
load_module("si-node")
|
||||
load_module("si-audio-adapter")
|
||||
load_module("si-standard-link")
|
||||
load_module("si-audio-endpoint")
|
||||
|
||||
-- API to access default nodes from scripts
|
||||
load_module("default-nodes-api")
|
||||
|
||||
-- API to access mixer controls, needed for volume ducking
|
||||
--load_module("mixer-api")
|
||||
|
||||
-- Create sessions statically at startup
|
||||
load_script("static-sessions.lua", default_policy.sessions)
|
||||
|
||||
-- Create endpoints statically at startup
|
||||
load_script("static-endpoints.lua", default_policy.endpoints)
|
||||
|
||||
-- Create items for nodes that appear in the graph
|
||||
load_script("create-item.lua")
|
||||
|
||||
-- Link nodes to each other to make media flow in the graph
|
||||
load_script("policy-node.lua", default_policy.policy)
|
||||
|
||||
-- Link client nodes with endpoints to make media flow in the graph
|
||||
load_script("policy-endpoint-client.lua", default_policy.policy)
|
||||
load_script("policy-endpoint-client-links.lua", default_policy.policy)
|
||||
|
||||
-- Link endpoints with device nodes to make media flow in the graph
|
||||
load_script("policy-endpoint-device.lua", default_policy.policy)
|
||||
end
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
default_access = {}
|
||||
|
||||
default_access.properties = {
|
||||
["enable-flatpak-portal"] = true,
|
||||
}
|
||||
|
||||
default_access.rules = {
|
||||
{
|
||||
matches = {
|
||||
{
|
||||
{ "pipewire.access", "=", "flatpak" },
|
||||
},
|
||||
},
|
||||
default_permissions = "rx",
|
||||
},
|
||||
}
|
||||
|
||||
function default_access.enable()
|
||||
load_access("default", {
|
||||
rules = default_access.rules
|
||||
})
|
||||
|
||||
if default_access.properties["enable-flatpak-portal"] then
|
||||
-- Enables portal permissions via org.freedesktop.impl.portal.PermissionStore
|
||||
load_module("portal-permissionstore")
|
||||
load_access("portal")
|
||||
end
|
||||
end
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
-- ALSA monitor config file --
|
||||
|
||||
alsa_monitor = {}
|
||||
|
||||
alsa_monitor.properties = {
|
||||
-- Create a JACK device. This is not enabled by default because
|
||||
-- it requires that the PipeWire JACK replacement libraries are
|
||||
-- not used by the session manager, in order to be able to
|
||||
-- connect to the real JACK server.
|
||||
--["alsa.jack-device"] = false,
|
||||
|
||||
-- Reserve devices via org.freedesktop.ReserveDevice1 on D-Bus
|
||||
["alsa.reserve"] = true,
|
||||
--["alsa.reserve.priority"] = -20,
|
||||
--["alsa.reserve.application-name"] = "WirePlumber",
|
||||
}
|
||||
|
||||
alsa_monitor.rules = {
|
||||
-- An array of matches/actions to evaluate.
|
||||
{
|
||||
-- Rules for matching a device or node. It is an array of
|
||||
-- properties that all need to match the regexp. If any of the
|
||||
-- matches work, the actions are executed for the object.
|
||||
matches = {
|
||||
{
|
||||
-- This matches all cards.
|
||||
{ "device.name", "matches", "alsa_card.*" },
|
||||
},
|
||||
},
|
||||
-- Apply properties on the matched object.
|
||||
apply_properties = {
|
||||
-- Use ALSA-Card-Profile devices. They use UCM or the profile
|
||||
-- configuration to configure the device and mixer settings.
|
||||
["api.alsa.use-acp"] = true,
|
||||
|
||||
-- Use UCM instead of profile when available. Can be
|
||||
-- disabled to skip trying to use the UCM profile.
|
||||
--["api.alsa.use-ucm"] = true,
|
||||
|
||||
-- Don't use the hardware mixer for volume control. It
|
||||
-- will only use software volume. The mixer is still used
|
||||
-- to mute unused paths based on the selected port.
|
||||
--["api.alsa.soft-mixer"] = false,
|
||||
|
||||
-- Ignore decibel settings of the driver. Can be used to
|
||||
-- work around buggy drivers that report wrong values.
|
||||
--["api.alsa.ignore-dB"] = false,
|
||||
|
||||
-- The profile set to use for the device. Usually this is
|
||||
-- "default.conf" but can be changed with a udev rule or here.
|
||||
--["device.profile-set"] = "profileset-name",
|
||||
|
||||
-- The default active profile. Is by default set to "Off".
|
||||
--["device.profile"] = "default profile name",
|
||||
|
||||
-- Automatically select the best profile. This is the
|
||||
-- highest priority available profile. This is disabled
|
||||
-- here and instead implemented in the session manager
|
||||
-- where it can save and load previous preferences.
|
||||
["api.acp.auto-profile"] = false,
|
||||
|
||||
-- Automatically switch to the highest priority available port.
|
||||
-- This is disabled here and implemented in the session manager instead.
|
||||
["api.acp.auto-port"] = false,
|
||||
|
||||
-- Other properties can be set here.
|
||||
--["device.nick"] = "My Device",
|
||||
},
|
||||
},
|
||||
{
|
||||
matches = {
|
||||
{
|
||||
-- Matches all sources.
|
||||
{ "node.name", "matches", "alsa_input.*" },
|
||||
},
|
||||
{
|
||||
-- Matches all sinks.
|
||||
{ "node.name", "matches", "alsa_output.*" },
|
||||
},
|
||||
},
|
||||
apply_properties = {
|
||||
--["node.nick"] = "My Node",
|
||||
--["priority.driver"] = 100,
|
||||
--["priority.session"] = 100,
|
||||
--["node.pause-on-idle"] = false,
|
||||
--["resample.quality"] = 4,
|
||||
--["channelmix.normalize"] = false,
|
||||
--["channelmix.mix-lfe"] = false,
|
||||
--["audio.channels"] = 2,
|
||||
--["audio.format"] = "S16LE",
|
||||
--["audio.rate"] = 44100,
|
||||
--["audio.position"] = "FL,FR",
|
||||
--["api.alsa.period-size"] = 1024,
|
||||
--["api.alsa.headroom"] = 0,
|
||||
--["api.alsa.disable-mmap"] = false,
|
||||
--["api.alsa.disable-batch"] = false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function alsa_monitor.enable()
|
||||
-- The "reserve-device" module needs to be loaded for reservation to work
|
||||
if alsa_monitor.properties["alsa.reserve"] then
|
||||
load_module("reserve-device")
|
||||
end
|
||||
|
||||
load_monitor("alsa", {
|
||||
properties = alsa_monitor.properties,
|
||||
rules = alsa_monitor.rules,
|
||||
})
|
||||
end
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
-- Bluez monitor config file --
|
||||
|
||||
bluez_monitor = {}
|
||||
|
||||
bluez_monitor.properties = {
|
||||
--["bluez5.sbc-xq-support"] = true,
|
||||
|
||||
-- Enabled headset roles (default: [ hsp_hs hfp_ag ]), this
|
||||
-- property only applies to native backend. Currently some headsets
|
||||
-- (Sony WH-1000XM3) are not working with both hsp_ag and hfp_ag
|
||||
-- enabled, disable either hsp_ag or hfp_ag to work around it.
|
||||
--
|
||||
-- Supported headset roles: hsp_hs (HSP Headset),
|
||||
-- hsp_ag (HSP Audio Gateway),
|
||||
-- hfp_hf (HFP Hands-Free),
|
||||
-- hfp_ag (HFP Audio Gateway)
|
||||
--["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]",
|
||||
|
||||
-- Enabled A2DP codecs (default: all).
|
||||
--["bluez5.codecs"] = "[ sbc aac ldac aptx aptx_hd ]",
|
||||
}
|
||||
|
||||
bluez_monitor.rules = {
|
||||
-- An array of matches/actions to evaluate.
|
||||
{
|
||||
-- Rules for matching a device or node. It is an array of
|
||||
-- properties that all need to match the regexp. If any of the
|
||||
-- matches work, the actions are executed for the object.
|
||||
matches = {
|
||||
{
|
||||
-- This matches all cards.
|
||||
{ "device.name", "matches", "bluez_card.*" },
|
||||
},
|
||||
},
|
||||
-- Apply properties on the matched object.
|
||||
apply_properties = {
|
||||
-- Autoconnect device profiles, disabled by default
|
||||
-- if the property is not specified.
|
||||
["bluez5.reconnect-profiles"] = "[ hfp_hf hsp_hs a2dp_sink ]",
|
||||
|
||||
-- MSBC is not expected to work on all headset + adapter combinations.
|
||||
--["bluez5.msbc-support"] = false,
|
||||
|
||||
-- LDAC encoding quality
|
||||
-- Available values: auto (Adaptive Bitrate, default)
|
||||
-- hq (High Quality, 990/909kbps)
|
||||
-- sq (Standard Quality, 660/606kbps)
|
||||
-- mq (Mobile use Quality, 330/303kbps)
|
||||
--["bluez5.a2dp.ldac.quality"] = "auto",
|
||||
},
|
||||
},
|
||||
{
|
||||
matches = {
|
||||
{
|
||||
-- Matches all sources.
|
||||
{ "node.name", "matches", "bluez_input.*" },
|
||||
},
|
||||
{
|
||||
-- Matches all sinks.
|
||||
{ "node.name", "matches", "bluez_output.*" },
|
||||
},
|
||||
},
|
||||
apply_properties = {
|
||||
--["node.nick"] = "My Node",
|
||||
--["priority.driver"] = 100,
|
||||
--["priority.session"] = 100,
|
||||
--["node.pause-on-idle"] = false,
|
||||
--["resample.quality"] = 4,
|
||||
--["channelmix.normalize"] = false,
|
||||
--["channelmix.mix-lfe"] = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function bluez_monitor.enable()
|
||||
load_monitor("bluez", {
|
||||
properties = bluez_monitor.properties,
|
||||
rules = bluez_monitor.rules,
|
||||
})
|
||||
end
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
-- V4L2 monitor config file --
|
||||
|
||||
v4l2_monitor = {}
|
||||
|
||||
v4l2_monitor.properties = { }
|
||||
|
||||
v4l2_monitor.rules = {
|
||||
-- An array of matches/actions to evaluate.
|
||||
{
|
||||
-- Rules for matching a device or node. It is an array of
|
||||
-- properties that all need to match the regexp. If any of the
|
||||
-- matches work, the actions are executed for the object.
|
||||
matches = {
|
||||
{
|
||||
-- This matches all cards.
|
||||
{ "device.name", "matches", "v4l2_device.*" },
|
||||
},
|
||||
},
|
||||
-- Apply properties on the matched object.
|
||||
apply_properties = {
|
||||
-- ["device.nick"] = "My Device",
|
||||
},
|
||||
},
|
||||
{
|
||||
matches = {
|
||||
{
|
||||
-- Matches all sources.
|
||||
{ "node.name", "matches", "v4l2_input.*" },
|
||||
},
|
||||
{
|
||||
-- Matches all sinks.
|
||||
{ "node.name", "matches", "v4l2_output.*" },
|
||||
},
|
||||
},
|
||||
apply_properties = {
|
||||
--["node.nick"] = "My Node",
|
||||
--["priority.driver"] = 100,
|
||||
--["priority.session"] = 100,
|
||||
--["node.pause-on-idle"] = false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
function v4l2_monitor.enable()
|
||||
load_monitor("v4l2", {
|
||||
properties = v4l2_monitor.properties,
|
||||
rules = v4l2_monitor.rules,
|
||||
})
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
-- Enable local & bluetooth audio devices
|
||||
alsa_monitor.enable()
|
||||
bluez_monitor.enable()
|
||||
|
||||
-- Enables functionality to save and restore default device profiles
|
||||
load_module("default-profile")
|
||||
|
|
@ -1 +0,0 @@
|
|||
default_policy.enable()
|
||||
|
|
@ -1 +0,0 @@
|
|||
v4l2_monitor.enable()
|
||||
|
|
@ -6,6 +6,7 @@ context.properties = {
|
|||
#application.name = WirePlumber
|
||||
log.level = 2
|
||||
wireplumber.script-engine = lua-scripting
|
||||
#wireplumber.export-core = true
|
||||
|
||||
#mem.mlock-all = false
|
||||
#support.dbus = true
|
||||
|
|
@ -70,7 +71,9 @@ wireplumber.components = [
|
|||
# The lua scripting engine
|
||||
{ name = libwireplumber-module-lua-scripting, type = module }
|
||||
|
||||
# The lua configuration file
|
||||
# The lua configuration file(s)
|
||||
# Other components are loaded from there
|
||||
{ name = config.lua, type = config/lua }
|
||||
{ name = main.lua, type = config/lua }
|
||||
{ name = policy.lua, type = config/lua }
|
||||
{ name = bluetooth.lua, type = config/lua }
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue