Commit graph

30 commits

Author SHA1 Message Date
Peter Hutterer
ee5f3f2f19 lib: don't read hidden files from the config directory
Fixes #104
2021-11-21 07:48:07 +00:00
Ashok Sidipotu
e2e3c5a69c wp-factory: enumerate pw_factory objects
pw_factory objects allow permissions to be set on its clients,
wp-factory exposes this funtionality to wireplumber clients.
2021-10-19 05:46:46 +00:00
Pauli Virtanen
24882f37a7 wp: fix pw_log_set usage
pw_log_set resets the log level of the logger to the Pipewire's current
level.  Here, it's instead expected that the level is retained, so call
pw_log_set_level first.

It used to be that pw_init set the log level based on PIPEWIRE_DEBUG
value, but this is now done only when using Pipewire's default logger.
2021-10-04 07:00:28 +00:00
George Kiagiadakis
3cd9384805 wp: make wp_get_xdg_state_dir() private
It's not used elsewhere, so there is no good reason yet to expose it.
Besides, I expect that GLib will likely add a method in the future
to return the XDG_STATE_HOME (which is relatively new in the xdg spec)
2021-08-19 10:06:37 +03:00
George Kiagiadakis
27ed36c2da wp: make the config file lookup methods more generic
* Make the flags public and give them nicer names
* Pass down the flags from the caller, so the caller can now explicitly
  ask for looking into specific directories
* Rename the methods
* Remove and inline the wp_get_xdg_config_dir() method, since it's only
  used internally
* Refactor the lookup dirs ordering to get both WIREPLUMBER_*_DIR env
  variables to replace all the other directories. Previously, we were looking
  for scripts in WIREPLUMBER_DATA_DIR, but we were also looking in /etc at
  the same time (with precedence, even), which could result in unexpected
  behaviour. Now, if a WIREPLUMBER environment variable is specified,
  we only look in there.
2021-08-19 10:06:37 +03:00
George Kiagiadakis
9ebea2976d wp: refactor and rename wp_iter_conf_files() to use WpIterator
This also corrects the logic of loading config files in m-lua-scripting.
Previously, if an error occured within the iteration function,
the error was not properly propagated to the caller because -EINVAL
was being added to nfiles instead of checked.
2021-07-20 14:42:42 +03:00
George Kiagiadakis
edd8ea7297 wp: polish documentation and add annotations for the config-related functions 2021-07-20 14:42:42 +03:00
George Kiagiadakis
0830362807 lib: explicitly ignore the return value of g_strlcpy() to silence coverity 2021-07-20 14:42:42 +03:00
Peter Hutterer
d38c3fb4cc lib: add functions to search in configuration/data directories
The previous approach to loading config files was to ask WP for the
directory and then search those for the config files. This patch changes the
approach - a caller now asks WP to search for a specific config file or
iterate over a config file directory.

This allows us to implement a directory lookup order, i.e.
"wireplumber.conf" may be in XDG_CONFIG_DIR, /etc/,
/usr/share and the first one found is used.

For configuration directories, the new method iterates over all matching
entries (files + directories) and invokes a callback for each entry.

This enables distributions to ship default files in /usr/share/wireplumber
but have admins and users override them on a local basis. For lua scripts in
particular, overriding a distribution-provided file with an empty file
effectively disables it, adding a file adds it in the right sort order.
2021-07-15 15:17:01 +00:00
Peter Hutterer
153e84c8b8 lib: always return the full path from wp_get_config/data_dir
Remove the need for the caller to check if the returned path is absolute or
relative.
2021-07-15 15:17:01 +00:00
Peter Hutterer
2e88a115d1 lib: add a function to return the XDG_CONFIG_DIR 2021-07-15 15:17:01 +00:00
Peter Hutterer
ab62af1748 lib: add a function to get the xdg state dir
Added recently to the XDG spec, XDG_STATE_HOME ($HOME/.local/state/) is for
files that are neither configuration/data files nor runtime/cache files.
2021-07-14 13:18:49 +10:00
Julian Bouzas
5b4b360b1c wp: log warning if PIPEWIRE_DEBUG env variable could not be set 2021-06-25 08:50:08 -04:00
Jason Francis
ed8346e77d docs: Add brief descriptions to all functions
This ensures all of these functions are picked up by g-ir-scanner.
2021-06-02 17:38:34 +00:00
George Kiagiadakis
b812e912d2 docs: fix C API documentation to work nicely with doxygen & sphinx 2021-05-25 14:19:53 +03:00
Raghavendra
d692f06f0d docs: api: Replace hotdoc specific commands with Doxygen specific commands 2021-05-25 14:19:53 +03:00
George Kiagiadakis
ac9e1e89c4 wp: remove WpSession and WpEndpointLink
We have ended up not using them, so let's not carry them
in the ABI of 0.4

We can always revert that, but let's first decide how
these objects should be used
2021-05-21 19:57:31 +03:00
George Kiagiadakis
6939d8900a core: use log.level from the pw_context
And don't override PIPEWIRE_DEBUG, unless WIREPLUMBER_DEBUG is set.
This allows pipewire to use log.level as well to set up its logging.

If WIREPLUMBER_DEBUG is set, though, override PIPEWIRE_DEBUG to prevent
log.level from being used.
2021-04-21 19:03:47 +03:00
George Kiagiadakis
61876a97b9 log: factor out the log level configuration into wp_log_level_set()
Initialize the log level with WIREPLUMBER_DEBUG in wp_init()
2021-04-21 13:49:03 +03:00
Julian Bouzas
12b2c00d0b lib: remove WpEndpointStream API
Add all that goes with it.
2021-03-18 12:10:37 -04:00
George Kiagiadakis
9609a79903 wp_init: set PIPEWIRE_DEBUG
It is inevitable to avoid setting PIPEWIRE_DEBUG, because the
log.level from client.conf will kick in and change the pipewire log
level when the pw_context is created. PIPEWIRE_DEBUG is the only
way to override.
2021-03-16 17:45:30 +02:00
George Kiagiadakis
29559b4065 wp: add wp_get_data_dir() 2021-02-03 17:16:51 +02:00
George Kiagiadakis
cb228637d6 wp: export functions to get the module & config dirs 2021-02-03 17:16:51 +02:00
George Kiagiadakis
3762388831 spa-type: refactor
* Use a more complete API to introspect SPA types
* Avoid the need for the Tables enumeration; the tables
  are now registered with a string
* Avoid the need for initialization, work directly on spa_types
  and other static data
* Allow working with Object pods that are not Params;
  the PARAMS table was previously hardcoded in the pod implementation
* Add a different dynamic type registration system, closer to
  how spa type works. The only regression is that we can no longer
  register additional custom object fields (custom SPA_PROP_* for example),
  but this feature can be re-added later
2021-01-15 16:30:01 +02:00
Julian Bouzas
2ec43ea885 wp: remove initialization of wireplumber types 2021-01-05 08:43:03 -05:00
raghu447
65b4562fa0 Implement PW_TYPE_INTERFACE_Metadata 2020-07-30 21:30:14 +05:30
George Kiagiadakis
c8b11fad42 lib: add a version header 2020-06-02 18:26:40 +03:00
George Kiagiadakis
a2b84e27d1 session: rename the default source/sink controls to have shorter names
+ use a more correct naming scheme to match the one from Spa
+ remove the default video source, since we now use a different
 session for video
2020-05-14 17:31:24 +03:00
George Kiagiadakis
bfe76bf1d1 debug: honor WIREPLUMBER_DEBUG and ignore PIPEWIRE_DEBUG in pw_log
And also provide a way to disable this integration at runtime to
get pipewire's log back, with WIREPLUMBER_NO_PW_LOG=1
2020-05-12 18:16:55 +03:00
George Kiagiadakis
66a0bf6093 lib: implement a wp_init() function 2020-05-11 15:45:09 +03:00