Commit graph

744 commits

Author SHA1 Message Date
Pauli Virtanen
d8a345a30c log: rename back to wp_log_set_level 2024-01-13 16:33:05 +00:00
Pauli Virtanen
35c10181d7 log: forward log level patterns also to libpipewire
Use pw_log_set_level_string to set log topic levels also for libpipewire
topics.
2024-01-13 16:33:05 +00:00
Pauli Virtanen
c746e18350 log: support topic patterns also in config file log.level
Handle log topic patterns also in wp_log_set_global_level, so that they
can be specified everywhere.
2024-01-13 16:33:05 +00:00
Pauli Virtanen
7c28c226b8 log: allow dynamic log levels for WpLogTopic
Change design of WpLogTopic so that it allows for changing their log
levels at runtime.

Add wp_log_topic_register/unregister functions to track lifetime of the
topics.

Auto-register statically defined log topics.

Make the topic registration threadsafe, in case it is done from
constructors that run in a different thread than main thread.
2024-01-13 16:33:05 +00:00
George Kiagiadakis
4a3557d8e4 event: add some trace logs to debug sorting hook dependencies 2024-01-08 12:28:21 +02:00
Julian Bouzas
4ac7dc831e event-dispatcher: fix ingroup documentation 2024-01-05 09:34:35 -05:00
George Kiagiadakis
eb2d6efcd4 state: add save_after_timeout() method to replace all custom timeout code
This was a common pattern that we had in many places, so it makes sense
to consolidate it.
2024-01-04 16:38:33 +02:00
Pauli Virtanen
4e17edb1ac wp: make wp_log_set_global_level public API
Applications may want to change WP log level at runtime.

Also change it to return error stataus instead of printing warnings on
error.
2023-12-24 17:58:30 +02:00
George Kiagiadakis
c2d125b0da Merge branch 'master' into next 2023-12-23 18:34:00 +02:00
George Kiagiadakis
0037733545 daemon: add cmdline option to load custom profile and report error if not found 2023-12-18 17:58:09 +02:00
George Kiagiadakis
4cc387d81d object-manager: ref all object managers before exposing tmp globals
It is possible that during this process some object managers emit
their "installed" signal, and it is possible that some object managers
are destroyed within the handler of this signal, ending up with a dangling
object manager pointer (since we do not ref object managers in the registry)
and with a modified object_managers list during iteration...

Related to: #534
2023-12-02 11:32:17 +02:00
George Kiagiadakis
6a88d8aa2c comp-loader: add support for loading pipewire modules as components 2023-11-14 15:34:11 +02:00
George Kiagiadakis
4593245fbb comp-loader: add support for wireplumber.components.rules
This is a new rules section that allows defining rules to modify
component definitions. This is useful to add repetitive dependencies,
for example, as in the case of "type = script/lua" that always requires
the "support.lua-scripting" feature. This can also be useful to modify
other component properties, such as the arguments, in overriding
configuration files, without needing to redefine the whole components
section.
2023-11-14 12:42:32 +02:00
George Kiagiadakis
42b64bfc28 spa-json: rename _from_string() to _wrap_string() and add new "from" variants
The previous naming convention was confusing because it did not make
it explicit that the string is not being copied. We had this wrong already
in the Lua bindings and thanks to some miracle it hasn't backfired so far
(it was using the "wrap" behaviour with a string that doesn't stay alive).

In some places we actually need the "copy" behaviour and in some other
places we need the "wrap" behaviour, so let's have both variants available.
2023-11-14 12:36:10 +02:00
George Kiagiadakis
96eae7d523 json-utils: add wp_json_utils_merge_containers(), factored out of conf.c 2023-11-14 12:02:31 +02:00
George Kiagiadakis
74d3b550d3 metadata: export using the pw_impl_metadata properties 2023-11-10 16:15:34 +02:00
George Kiagiadakis
a6bea40172 core: add wp_core_get_own_bound_id() method
This allows retrieving the bound-id of our own client
2023-11-10 11:27:13 +02:00
George Kiagiadakis
6f3a307e6f spa-pod: don't use assertion macro in code that needs to run always 2023-11-08 20:41:34 +02:00
George Kiagiadakis
9b8987e8c0 spa-pod: fix parser to be able to collect IDs as strings ('K') 2023-11-08 20:40:19 +02:00
George Kiagiadakis
83e47ab7c2 tree-wide: refactor active feature checks to use _test_active_features()
Similar to 5fc7e68d10, it's wrong to test
multiple flags with a simple & operation. In some cases we had this wrong.
2023-11-08 12:23:00 +02:00
George Kiagiadakis
44a157b506 lib: object: add functions to test active and supported features 2023-11-08 12:08:30 +02:00
George Kiagiadakis
6eed30cf77 properties: update doc to mention that it's possible to use JSON in _new_string() 2023-11-07 20:26:16 +02:00
George Kiagiadakis
a6dd60ff83 conf: remove wp_conf_apply_rules() 2023-11-07 16:36:49 +02:00
George Kiagiadakis
89ac416e99 lib: add new json-utils set of functions
The purpose is to wrap some utilities that pipewire provides that use JSON.

Start by wrapping pw_conf_match_rules(), which despite its name, it has nothing
to do with the configuration object. It operates directly on JSON and can be
useful to work with match rules outside the context of configuration files.
2023-11-07 16:36:49 +02:00
Barnabás Pőcze
47ebc33de5 internal-comp-loader: fix WpSpaJson memory leak
Previously, the `deps` variable was reused for parsing
the required and wanted dependencies of a component,
which lead to the old value allocated here:

  if (wp_spa_json_object_get (json, "requires", "J", &deps, NULL)) {

being leaked when a bit later

  if (wp_spa_json_object_get (json, "wants", "J", &deps, NULL)) {

succeeded.

Fix that by using two separate variables.
2023-10-30 19:53:55 +00:00
George Kiagiadakis
dbf8204cf9 Revert "api: module: support loading arguments from file"
This reverts commit 2ae1b3cbd9.

This is not a good API. It was only allowed temporarily in 0.4.15
to get things done. We should approach this properly in 0.5
2023-10-24 11:55:52 +03:00
George Kiagiadakis
22cb31571d Revert "link: add WP_LINK_FEATURE_ESTABLISHED to track when a link is PAUSED/ACTIVE"
This reverts commit 9def3f96d2.

This was never a good idea, as it turns out. It was not used in practice because
it was breaking other things (see 370b692933)
and now it appears to be causing more problems in Lua object managers that don't
install because they are waiting for inactive links to become active.

Fixes: #518
2023-10-24 11:31:45 +03:00
George Kiagiadakis
eb6f569be8 Merge branch 'master' into next 2023-10-24 11:09:52 +03:00
George Kiagiadakis
23ba01970f object-manager: use an idle callback to expose tmp globals instead of pw_core_sync
A core sync is not really necessary here because whatever objects the remote
pipewire daemon has to announce have already been sent to us on a message
and this message is already being processed at this point. This means, we are
not going to be returning to the main loop until all the new objects have been
announced and therefore placed into the tmp globals array. So, we can also use
an idle callback and achieve the same effect of slightly delaying until all
new globals have been announced.

With an idle callback, we can be more agile and add those new objects immediately
after the message has been processed instead of waiting for a pw_core_sync()
reply, which will come in the next message.

This fixes an odd failure of the si-standard-link test after applying the fix
for #517, which was caused by the fact that the test was previously relying on
a delay caused by some unrelated globals being prepared in the object manager
that tries to verify the graph state. After those globals were removed from the
internal preparation queue, the test would fail to detect the link objects
because they were stuck in the tmp_globals array for too long.
2023-10-23 23:14:48 +03:00
George Kiagiadakis
5fc7e68d10 object-manager: reduce the amount of globals that initially match the interest
With the previous check, any global matching either the type or the global
properties of the interest would be considered for inclusion in the object
manager and would be prepared only to fail the same check later.

The correct way to check is (variable & (X|Y) == (X|Y)), which is what
SPA_FLAG_IS_SET() expands to.

Fixes #517
2023-10-23 23:04:02 +03:00
Pauli Virtanen
bf082964d4 client: add wp_client_update_properties
Add Wp interface function for pw_client_update_properties.
2023-10-15 21:27:14 +00:00
George Kiagiadakis
ffd6c0dfb9 docs: fix warnings related to recent policy-dsp changes
- remove dsp.rst, since it's empty and not in the toctree
- fix g-i function param annotation
2023-10-12 19:24:26 +03:00
George Kiagiadakis
493be2fae6 event: annotate key in wp_event_get_data 2023-09-26 10:11:36 +03:00
George Kiagiadakis
6d7232a1fd settings: correct class description 2023-09-26 10:00:43 +03:00
George Kiagiadakis
1e714fe784 session-item: improve class description 2023-09-26 09:57:50 +03:00
George Kiagiadakis
3823ea4b40 event: allow hook before/after strings to be glob patterns 2023-09-24 00:09:55 +03:00
Dmitry Sharshakov
2ae1b3cbd9 api: module: support loading arguments from file 2023-09-22 19:35:10 +03:00
Duncan Overbruck
bebee99fc8 event-dispatcher: sort same priority events by the order they have been received 2023-09-03 17:30:03 +03:00
George Kiagiadakis
67f9f63520 Merge branch '0.4' into next 2023-09-01 19:12:20 +03:00
Tom A. Wagner
6e81dc7a66 docs: Add missing '\since' attributes to types and functions that have been added in versions later than 0.4.0 2023-08-30 11:20:06 +02:00
Ashok Sidipotu
27c1ea869b event*.c: add a few more log msgs 2023-08-15 07:14:59 +00:00
Stefan Ursella
7ee69a9a47 log: set empty string to not set log_fields
not all functions in glib returns a value for the used log fields
in this case a 'g_return_val_if_fail(..) will only set 4 fields an
set the other field to NULL which leads to a segfault

Jul 22 13:41:37 Cynap-Pro-01121508 systemd-coredump[7247]: Process 496 (wireplumber) of user 4242 dumped core.

                                                           Stack trace of thread 496:
                                                           #0  0x00007f6b2ce58e99 __strlen_avx2 (libc.so.6 + 0x150e99)
                                                           #1  0x00007f6b2cf3ebe5 g_log_writer_journald (libglib-2.0.so.0 + 0x5fbe5)
                                                           #2  0x00007f6b2d0a9316 wp_log_fields_write_to_journal (libwireplumber-0.5.so.0 + 0x2b316)
                                                           #3  0x00007f6b2d0a96f5 wp_log_writer_default (libwireplumber-0.5.so.0 + 0x2b6f5)
                                                           #4  0x00007f6b2cf3cf3e g_log_structured_array (libglib-2.0.so.0 + 0x5df3e)
                                                           #5  0x00007f6b2cf3d0ae g_log_structured_array (libglib-2.0.so.0 + 0x5e0ae)
                                                           #6  0x00007f6b2cf3d4b7 g_logv (libglib-2.0.so.0 + 0x5e4b7)
                                                           #7  0x00007f6b2cf3d7ef g_log (libglib-2.0.so.0 + 0x5e7ef)
                                                           #8  0x00007f6b29efafef get_node_by_id (libwireplumber-module-cb-ipc.so + 0x24fef)
                                                           #9  0x00007f6b29efb032 wp_cb_ipc_get_app_properties (libwireplumber-module-cb-ipc.so + 0x25032)
2023-08-01 08:30:05 +00:00
George Kiagiadakis
84d3382292 config: make it possible to have feature profiles
A profile is a list of features set to required/optional/disabled
which governs which components are getting loaded, given a static
components list with well-defined dependencies
2023-06-23 20:15:26 +03:00
George Kiagiadakis
840a2304b4 core: load components internally and refactor main to just activate it
+ move the export-core creation and media-session check to be built-in components
+ add WpCore API to find the export core
2023-06-23 18:01:26 +03:00
George Kiagiadakis
6bab78bf3f object: make wp_object_get_core() return itself if it's the core 2023-06-23 18:01:26 +03:00
George Kiagiadakis
11add27f81 core: refactor to subclass from WpObject 2023-06-23 18:01:26 +03:00
George Kiagiadakis
9970450bfa object.h: don't include core.h 2023-06-23 18:01:26 +03:00
George Kiagiadakis
a0497b4256 Merge branch '0.4' into next 2023-06-21 20:59:04 +03:00
George Kiagiadakis
2840964f37 internal-comp-loader: fix error ownership in parsing step 2023-06-20 17:20:01 +03:00
George Kiagiadakis
19cfd37da6 comp-loader: register the component & feature only if it activates successfully
Fixes #470
See also !503
2023-06-20 17:20:01 +03:00