2022-12-21 11:59:58 -05:00
|
|
|
/* WirePlumber
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2022 Collabora Ltd.
|
|
|
|
|
* @author Julian Bouzas <julian.bouzas@collabora.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef __WIREPLUMBER_CONF_H__
|
|
|
|
|
#define __WIREPLUMBER_CONF_H__
|
|
|
|
|
|
|
|
|
|
#include "spa-json.h"
|
|
|
|
|
#include "properties.h"
|
|
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
conf: refactor configuration loading
Changes:
- Configuration files are no longer located by libpipewire,
which allows us to control the paths that are being looked up.
This is a requirement for installations where pipewire and
wireplumber are built using different prefixes, in which case
the configuration files of wireplumber end up being installed in
a place that libpipewire doesn't look into...
- The location of conf files is now again $prefix/share/wireplumber,
/etc/wireplumber and $XDG_CONFIG_HOME/wireplumber, instead of using
the pipewire directories. Also, since the previous commits, we now
also support $XDG_CONFIG_DIRS/wireplumber (typically /etc/xdg/wireplumber)
and $XDG_DATA_DIRS/wireplumber for system-wide configuration.
- Since libpipewire doesn't expose the parser, we now also do the
parsing of sections ourselves. This has the advantage that we can
optimize it a bit for our use case.
- The WpConf API has changed to not be a singleton and it is a
property of WpCore instead. The configuration is now expected
to be opened before the core is created, which allows the caller
to identify configuration errors in advance. By not being a singleton,
we can also reuse the WpConf API to open other SPA-JSON files.
- WpConf also now has a lazy loading mechanism. The configuration
files are mmap'ed and the various sections are located in advance,
but not parsed until they are actually requested. Also, the sections
are not copied in memory, unlike what happens in libpipewire. They
are only copied when merging is needed.
- WpCore now disables loading of a configuration file in pw_context,
if a WpConf is provided. This is to have complete control here.
The 'context.spa-libs' and 'context.modules' sections are still
loaded, but we load them in WpConf and pass them down to pw_context
for parsing. If a WpConf is not provided, pw_context is left to load
the default configuration file (client.conf normally).
2024-02-28 12:11:38 +02:00
|
|
|
struct pw_context;
|
|
|
|
|
|
2022-12-21 11:59:58 -05:00
|
|
|
/*!
|
|
|
|
|
* \brief The WpConf GType
|
|
|
|
|
* \ingroup wpconf
|
|
|
|
|
*/
|
|
|
|
|
#define WP_TYPE_CONF (wp_conf_get_type ())
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
G_DECLARE_FINAL_TYPE (WpConf, wp_conf, WP, CONF, GObject)
|
|
|
|
|
|
|
|
|
|
WP_API
|
conf: refactor configuration loading
Changes:
- Configuration files are no longer located by libpipewire,
which allows us to control the paths that are being looked up.
This is a requirement for installations where pipewire and
wireplumber are built using different prefixes, in which case
the configuration files of wireplumber end up being installed in
a place that libpipewire doesn't look into...
- The location of conf files is now again $prefix/share/wireplumber,
/etc/wireplumber and $XDG_CONFIG_HOME/wireplumber, instead of using
the pipewire directories. Also, since the previous commits, we now
also support $XDG_CONFIG_DIRS/wireplumber (typically /etc/xdg/wireplumber)
and $XDG_DATA_DIRS/wireplumber for system-wide configuration.
- Since libpipewire doesn't expose the parser, we now also do the
parsing of sections ourselves. This has the advantage that we can
optimize it a bit for our use case.
- The WpConf API has changed to not be a singleton and it is a
property of WpCore instead. The configuration is now expected
to be opened before the core is created, which allows the caller
to identify configuration errors in advance. By not being a singleton,
we can also reuse the WpConf API to open other SPA-JSON files.
- WpConf also now has a lazy loading mechanism. The configuration
files are mmap'ed and the various sections are located in advance,
but not parsed until they are actually requested. Also, the sections
are not copied in memory, unlike what happens in libpipewire. They
are only copied when merging is needed.
- WpCore now disables loading of a configuration file in pw_context,
if a WpConf is provided. This is to have complete control here.
The 'context.spa-libs' and 'context.modules' sections are still
loaded, but we load them in WpConf and pass them down to pw_context
for parsing. If a WpConf is not provided, pw_context is left to load
the default configuration file (client.conf normally).
2024-02-28 12:11:38 +02:00
|
|
|
WpConf * wp_conf_new (const gchar * name, WpProperties * properties);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpConf * wp_conf_new_open (const gchar * name, WpProperties * properties,
|
|
|
|
|
GError ** error);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
gboolean wp_conf_open (WpConf * self, GError ** error);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
void wp_conf_close (WpConf * self);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
gboolean wp_conf_is_open (WpConf * self);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
const gchar * wp_conf_get_name (WpConf * self);
|
2022-12-21 11:59:58 -05:00
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpSpaJson * wp_conf_get_section (WpConf *self, const gchar *section,
|
|
|
|
|
WpSpaJson *fallback);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpSpaJson *wp_conf_get_value (WpConf *self,
|
|
|
|
|
const gchar *section, const gchar *key, WpSpaJson *fallback);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
gboolean wp_conf_get_value_boolean (WpConf *self,
|
|
|
|
|
const gchar *section, const gchar *key, gboolean fallback);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
gint wp_conf_get_value_int (WpConf *self,
|
|
|
|
|
const gchar *section, const gchar *key, gint fallback);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
float wp_conf_get_value_float (WpConf *self,
|
|
|
|
|
const gchar *section, const gchar *key, float fallback);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
gchar *wp_conf_get_value_string (WpConf *self,
|
|
|
|
|
const gchar *section, const gchar *key, const gchar *fallback);
|
|
|
|
|
|
conf: refactor configuration loading
Changes:
- Configuration files are no longer located by libpipewire,
which allows us to control the paths that are being looked up.
This is a requirement for installations where pipewire and
wireplumber are built using different prefixes, in which case
the configuration files of wireplumber end up being installed in
a place that libpipewire doesn't look into...
- The location of conf files is now again $prefix/share/wireplumber,
/etc/wireplumber and $XDG_CONFIG_HOME/wireplumber, instead of using
the pipewire directories. Also, since the previous commits, we now
also support $XDG_CONFIG_DIRS/wireplumber (typically /etc/xdg/wireplumber)
and $XDG_DATA_DIRS/wireplumber for system-wide configuration.
- Since libpipewire doesn't expose the parser, we now also do the
parsing of sections ourselves. This has the advantage that we can
optimize it a bit for our use case.
- The WpConf API has changed to not be a singleton and it is a
property of WpCore instead. The configuration is now expected
to be opened before the core is created, which allows the caller
to identify configuration errors in advance. By not being a singleton,
we can also reuse the WpConf API to open other SPA-JSON files.
- WpConf also now has a lazy loading mechanism. The configuration
files are mmap'ed and the various sections are located in advance,
but not parsed until they are actually requested. Also, the sections
are not copied in memory, unlike what happens in libpipewire. They
are only copied when merging is needed.
- WpCore now disables loading of a configuration file in pw_context,
if a WpConf is provided. This is to have complete control here.
The 'context.spa-libs' and 'context.modules' sections are still
loaded, but we load them in WpConf and pass them down to pw_context
for parsing. If a WpConf is not provided, pw_context is left to load
the default configuration file (client.conf normally).
2024-02-28 12:11:38 +02:00
|
|
|
WP_API
|
|
|
|
|
gint wp_conf_section_update_props (WpConf * self, const gchar * section,
|
|
|
|
|
WpProperties * props);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
void wp_conf_parse_pw_context_sections (WpConf * self,
|
|
|
|
|
struct pw_context * context);
|
|
|
|
|
|
2022-12-21 11:59:58 -05:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
#endif
|