Commit Graph

22 Commits

Author SHA1 Message Date
George Kiagiadakis
b100bdda4a event-hook: remove the exec type property & enumeration
With the latest changes, we can implement the "after-events" type
with external code that pushes a very low priority event that is
the "rescan" event.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
bcb4e80723 m-std-event-source: use type-specific event names and multiple object managers
It is better to have type-specific event names to minimize the amount
of constraint string matches we do on hooks, as most hooks (if not all)
are interested on specific types of objects only.

Similarly, use a different object manager for each object type to
minimize the performance impact of iterations and lookups, as all
such actions are interested in only 1 object type every time.

Port all existing hooks to the new event names and the get-object-manager API.
2023-04-17 07:48:18 -04:00
George Kiagiadakis
24db3fe24a event-hook: rewrite the hook priorities enum
Hooks need to have a priority relative to the event they are executed on,
so it does not make much sense to have all kinds of different priorities
based also on the event type and/or the module where they are defined.
Also, it wouldn't be acceptable to have such an enumeration on the public API.
2023-04-17 07:48:18 -04:00
Ashok Sidipotu
8e7611fa9f m-default-nodes{-api}: Correct the critical log msg 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
a060c6a130 m-default-nodes{-api}: optimize for event-stack
- Sharpen the hooks, so that they are called only when needed.
- Make settings live, apply them when they are changed.
- Remove the state saver after events hook, call it directly.
- Remove the settings bookkeeping as the gobject properties.
- Remove the scheduling of default-nodes-changed signal via core.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
d57e387f75 event-hooks: give unique names to event hooks 2023-04-17 07:47:09 -04:00
Ashok Sidipotu
6e31b47c28 event-dispatcher: Add an enumeration of default event hook priorities
This scheme provides for an orderly execution of hooks as the priorities
are controlled from one single place. Enumeration is defined in such a
way that new items can be added easily.

All the event hooks are changed to get the priorities from this
enumeration.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
9337bb25ef m-default-nodes*: Remove suffixes in hooks name
Suffix is redundant for on events as Events names and Event chains are
printed with 847c0.

Update the settings file used.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
ff833b138d event-dispatcher: log event and hook names and chains
- Add a new variable "name" in WpEventHook and use it to log all the
  hooks(by name) picked up in _push_event(). This gives a clear picture
  if hook is registered for a given event.
- Form a name for an event and a chain of events for an event run, log
  both of them. This gives a clear picture of the events executed and
  order in which they are dispatched.
- Similarly build hooks chain and print it in _source_dispatch(), this
  gives a clear picture of the hooks picked and the order in which they
  are dispatched.
- Log only the dispatchable(with hooks) events, this de-clutters
  the log messages.
2023-04-17 07:47:09 -04:00
Ashok Sidipotu
025b0f6e2e m-default-nodes: Port to Event stack 2023-04-17 07:47:09 -04:00
Julian Bouzas
5bef0f240f default-nodes: use WpSpaJson API 2022-01-25 07:40:59 -05:00
Julian Bouzas
95e7c4abe8 m-default-nodes-api: add API to get and set default configured node name 2022-01-25 09:57:33 +00:00
Julian Bouzas
0d008dce75 m-default-nodes-api: don't return stream node if default node name matches
Stream nodes can never be default nodes, so we skip them in case they have the
same name as the actual default node.

Fixes #130
2022-01-06 06:50:32 +00:00
Julian Bouzas
f7dfb90db6 module-default-nodes-api: sync with core before emitting changed signal
This makes sure pipewire is not doing anything while emitting changed signal.
2022-01-05 08:57:33 +00:00
George Kiagiadakis
5e14c69108 m-default-nodes: lift restrictions on media.class for audio nodes
Previously a default source had to be Audio/Source and a default sink
had to be Audio/Sink. This did not account for:
 - monitor sources (Audio/Sink)
 - duplex nodes (Audio/Duplex)
 - virtual sources (Audio/Source/Virtual)

With this change the restriction is now on the number of input/output
ports, so any Audio/* node with output ports is a valid target to select
as a default source, while any Audio/* node with input ports is a valid
target for a default sink.

Fixes #60
2021-10-05 17:28:42 +03:00
George Kiagiadakis
87741e39ec s/metadatas/metadata/g
data is already plural
2021-06-18 10:44:24 +03:00
Julian Bouzas
8ba6439dd4 m-default-nodes-api: free default nodes when disabling plugin 2021-06-07 11:33:21 -04:00
Julian Bouzas
5756d8899d m-default-nodes: check if node is valid before returning bound id 2021-05-20 11:18:19 -04:00
George Kiagiadakis
012363ef55 m-default-nodes-api: remove reduntant call to g_clear_object 2021-04-15 16:59:51 +03:00
George Kiagiadakis
4399512891 m-default-nodes-api: load all information before declaring the plugin as "enabled" 2021-04-09 15:52:17 +03:00
George Kiagiadakis
0ecefcb55d policy-node: use default-nodes-api plugin 2021-03-31 13:10:13 +03:00
George Kiagiadakis
0bc257b6c3 modules: add new module-default-nodes-api
This is to provide easy access to default nodes from the scripts
2021-03-31 13:10:13 +03:00