Implement config/state file handling

Make methods to load_config and load/save state. For now the config
and state directories are the same but it might not be. Implement
the search path for all config/state files as:

  $XDG_CONFIG_HOME/[$prefix]/$name
  $HOME/.config/[$prefix]/$name
  $PIPEWIRE_CONFIG_DIR/pipewire/[$prefix]/$name
  /etc/pipewire/[$prefix]/$name

Make some config files for jack and RT clients. Make pw-cat use the
client-rt config.

Use core state and config management in media-session.
Move all session manager state and config files to the build dir and
set the PIPEWIRE_CONFIG_DIR to this build dir.
This commit is contained in:
Wim Taymans 2021-02-11 17:54:21 +01:00
parent c605672d43
commit fc90a4e48a
13 changed files with 380 additions and 216 deletions

View file

@ -0,0 +1,63 @@
# Daemon config file for PipeWire RT clients version @VERSION@ #
properties = {
## Configure properties in the system.
#mem.warn-mlock = false
#mem.allow-mlock = true
#mem.mlock-all = false
#log.level = 2
}
spa-libs = {
## <factory-name regex> = <library-name>
#
# Used to find spa factory names. It maps an spa factory name
# regular expression to a library name that should contain
# that factory.
#
audio.convert* = audioconvert/libspa-audioconvert
support.* = support/libspa-support
}
modules = {
## <module-name> = { [args = { <key>=<value> ... }]
# [flags = [ [ifexists] [nofail] ]}
#
# Loads a module with the given parameters.
# If ifexists is given, the module is ignored when it is not found.
# If nofail is given, module initialization failures are ignored.
#
# Uses RTKit to boost the data thread priority.
libpipewire-module-rtkit = {
args = {
#nice.level = -11
#rt.prio = 20
#rt.time.soft = 200000
#rt.time.hard = 200000
}
flags = [ ifexists nofail ]
}
# The native communication protocol.
libpipewire-module-protocol-native = null
# Allows creating nodes that run in the context of the
# client. Is used by all clients that want to provide
# data to PipeWire.
libpipewire-module-client-node = null
# Allows creating devices that run in the context of the
# client. Is used by the session manager.
libpipewire-module-client-device = null
# Makes a factory for wrapping nodes in an adapter with a
# converter and resampler.
libpipewire-module-adapter = null
# Allows applications to create metadata objects. It creates
# a factory for Metadata objects.
libpipewire-module-metadata = null
# Provides factories to make session manager objects.
libpipewire-module-session-manager = null
}

52
src/daemon/jack.conf.in Normal file
View file

@ -0,0 +1,52 @@
# Daemon config file for PipeWire JACK clients version @VERSION@ #
properties = {
## Configure properties in the system.
#mem.warn-mlock = false
#mem.allow-mlock = true
#mem.mlock-all = false
#log.level = 2
}
spa-libs = {
## <factory-name regex> = <library-name>
#
# Used to find spa factory names. It maps an spa factory name
# regular expression to a library name that should contain
# that factory.
#
support.* = support/libspa-support
}
modules = {
## <module-name> = { [args = { <key>=<value> ... }]
# [flags = [ [ifexists] [nofail] ]}
#
# Loads a module with the given parameters.
# If ifexists is given, the module is ignored when it is not found.
# If nofail is given, module initialization failures are ignored.
#
#
# Uses RTKit to boost the data thread priority.
libpipewire-module-rtkit = {
args = {
#nice.level = -11
#rt.prio = 20
#rt.time.soft = 200000
#rt.time.hard = 200000
}
flags = [ ifexists nofail ]
}
# The native communication protocol.
libpipewire-module-protocol-native = null
# Allows creating nodes that run in the context of the
# client. Is used by all clients that want to provide
# data to PipeWire.
libpipewire-module-client-node = null
# Allows applications to create metadata objects. It creates
# a factory for Metadata objects.
libpipewire-module-metadata = null
}

View file

@ -0,0 +1,21 @@
conf_files = [
[ 'bluez-monitor.conf', 'bluez-monitor.conf' ],
[ 'v4l2-monitor.conf', 'v4l2-monitor.conf' ],
[ 'media-session.conf', 'media-session.conf' ],
[ 'alsa-monitor.conf', 'alsa-monitor.conf' ],
[ 'with-jack', 'with-jack' ],
[ 'with-pulseaudio', 'with-pulseaudio' ],
]
foreach c : conf_files
configure_file(input : c.get(0),
output : c.get(1),
configuration : conf_config,
install_dir : join_paths(conf_install_dir, 'media-session.d'))
endforeach
install_data(
sources : [
'with-jack',
'with-pulseaudio' ],
install_dir : join_paths(conf_install_dir, 'media-session.d'))

View file

@ -14,36 +14,27 @@ conf_config.set('media_session_path', join_paths(pipewire_bindir, 'pipewire-medi
conf_config.set('pipewire_pulse_path', join_paths(pipewire_bindir, 'pipewire-pulse'))
conf_install_dir = join_paths(get_option('sysconfdir'), 'pipewire')
install_data(
sources : [
'media-session.d/with-jack',
'media-session.d/with-pulseaudio',
'media-session.d/bluez-monitor.conf',
'media-session.d/v4l2-monitor.conf',
'media-session.d/media-session.conf',
'media-session.d/alsa-monitor.conf' ],
install_dir : join_paths(conf_install_dir, 'media-session.d'))
conf_config_uninstalled = conf_config
conf_config_uninstalled.set('media_session_path',
join_paths(meson.build_root(), 'src', 'examples', 'pipewire-media-session'))
conf_config_uninstalled.set('pipewire_pulse_path',
join_paths(meson.build_root(), 'src', 'daemon', 'pipewire-pulse'))
configure_file(input : 'pipewire.conf.in',
output : 'pipewire.conf',
configuration : conf_config,
install_dir : conf_install_dir)
configure_file(input : 'client.conf.in',
output : 'client.conf',
configuration : conf_config,
install_dir : conf_install_dir)
conf_files = [
[ 'pipewire.conf.in', 'pipewire.conf' ],
[ 'client.conf.in', 'client.conf' ],
[ 'client-rt.conf.in', 'client-rt.conf' ],
[ 'jack.conf.in', 'jack.conf' ],
[ 'pipewire-pulse.conf.in', 'pipewire-pulse.conf' ]
]
configure_file(input : 'pipewire-pulse.conf.in',
output : 'pipewire-pulse.conf',
configuration : conf_config,
install_dir : conf_install_dir)
foreach c : conf_files
configure_file(input : c.get(0),
output : c.get(1),
configuration : conf_config,
install_dir : conf_install_dir)
endforeach
configure_file(input : 'pipewire.conf.in',
output : 'pipewire-uninstalled.conf',
@ -81,6 +72,7 @@ executable('pipewire-pulse',
# )
#endif
subdir('media-session.d')
if get_option('systemd') and systemd.found()
subdir('systemd')
endif