event:set_data() coerces Lua tables to properties, so that keys and
values become strings. Take into account that profile.index is a string
due to this.
Fixes WP setting the profile, even though it is already the active one.
Currently nothing removes the WpLoopSource from the main context, and we
moreover are creating and attaching unused WpLoopSources when sharing
same pw_context between multiple WpCore.
Fix this by keeping track of the WpLoopSource in the pw_context user
data, only creating them when needed, and finalizing it after the
context is destroyed.
It is intended that the Pipewire loops are "entered" the whole time they
are running, i.e. are going to process further events. Currently we
enter/leave for single iterations, which is not right.
Fix by entering the loop on initial GSource idle callback, and leaving
at finalize.
That the loop has to be left from the same thread it was entered from is
a bit hard to do with GSources, as the finalize callback appears not
guaranteed to be called from any particular thread. I didn't find a
fully general way to do this, so this puts additional constraints on how
WpLoopSource (and WpCore) are to be cleaned up.
If we use the project version as library version,
it is not possible to append something to the
project version to indicate a modified wireplumber version.
Using parseBool is actually more broken if the property is already parsed as a
boolean, and causes the node to remain unhidden even when hide-parent = true.
Revert 2a45842169 to fix this behaviour.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Using the new Conf() constructor, we can load and parse a filter graph
from a file on disk. This is useful when, for example, maintaining a
large database of filter graphs. It also keeps wireplumber.conf.d free
from clutter.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Given that we are allowing Conf() to instantiate a new WpConf,
the methods on the class need to be callable in reference to Self while
maintaining API compatibility with being indexable from the table as a
static method.
Allow this by checking if the first argument passed in is userdata.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
This exposes the ability to load a SPA-JSON representation of a WpConf
object from an arbitrary file on disk to the Lua API
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
A "plain" JSON object may be passed to WpConf constructors. Previously, this
would cause an error as open_and_load_sections expects the first parsed token
to be a string. Use WpProperties to denote that the file being parsed is an
object/container, and specify a section name for it.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Use WpProperties to indicate that searching for and loading
conf.d fragments can/should be skipped.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
WpProperties may be used to control the behaviour of a WpConf
object. This allows those properties to be referenced at any time
during the lifetime of a WpConf.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
The signature of the function is quite misleading. If an absolute
path is passed to it, it will ignore the directory constraint flags
and search outside of the specified directories anyway. Make a note
of this in its caller.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Global class identifiers, such as "Node", "SessionItem", "Conf", etc
are so far defined either as methods, which are constructors for
the GObject class, or as tables, which contain "static" methods, i.e.
methods that can be called without an instance.
In some cases, we may want to mix a class being both instantiatable
with a constructor and also have static methods. To support this,
allow the class identifier be declared as a table with the constructor
being defined as the "__new" method. This change allows calling the
table as a method and execute "__new" underneath.
For instance:
```
json = Conf.get_section_as_json("foobar") -- static method
conf = Conf("/foo/bar") -- constructor, equivalent to Conf.__new("/foo/bar")
```
See also !629
The cam_data structure stores a reference to the "parent" WpSpaDevice
and doesn't allow it to be destroyed when the monitor detects that
the device is no longer present. Clear it right after pushing the event
to make sure there's no dangling reference left around
Fixes: #627
We apparently store things in the <media-class>:<key>:<value>
format, while pipewire-pulse expects <media-class>.<key>:<value>
and this detail was missed in the latest refactoring.
It also seems that I forgot to ensure that restoring this metadata
key worked. The hook was there, but not registered.
Remove the hook and directly populate the metadata object when
it is activated, as it seems simpler.
Fixes: #604
The existence of props["hide-parent"] is truthy. Parse the boolean explicitly
to get the correct logic.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
This component provides the automatic filter graph interface to consumers.
We provide the component by default, however it is not activated unless
explicitly requested in wireplumber.profiles by a consumer.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
This allows DSP rules to be specified in a wireplumber.conf.d file under
the node.software-dsp.rules section. Properties are specified in the
software-dsp action.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
As this DSP "policy" is intended to run on the creation/deletion
of a node, move it into the node subdir.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
Prevously, we were only looking at node["global-properties"] for
properties to match on. Change this to instead run against
node.properties, so that we can use type-specific properties such as alsa.id.
Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
The current code was not updated to use `clients_om`, thus never
found a client, ending up never sending client errors.
Just use the shared helper to avoid such issues in the future.
These errors are propagated to the caller, so it's the caller's
responsibility to print them appropriately, if necessary. Printing
a notice also here is only confusing.
A debug mesage is still be useful for developers to understand the flow.
These were documented in src/scripts/lib initially because the settings-manager
scripts used to be also there and it made sense to keep them close together.
Autoswitch should make sure the saved headset profile always has an
input route. Check this on loading/saving it, otherwise reselect it.
Headset mode profile without mic used to make some sense when it wasn't
using the loopback node (ie. easy way to disable it), but now with the
loopback node this doesn't make sense any more and it's confusing if it
occurs, so we shouldn't allow it.
Profile autoswitch should support also A2DP profiles with input route,
so the loopback should not assume the source node is SCO one.
Also fix handling of AG SCO output stream nodes, which should not be
hidden as internal.
The wp_settings_delete_all() API internally uses wp_metadata_clear() to clear
all the keys in the persistent-sm-settings metadata object. This call emits
the metadata changed signal with both 'key' and 'value' set to NULL. When that
happens, we need to clear all settings from the state file.
It is possible that a node is destroyed while the select-target
event is ongoing. In that case, the next hook to run will likely crash.
Fix this by cancelling events automatically when their subject
is a session-item associated with a node, as soon as the node is destroyed.
See !619
A smart filter should be considered "targetless" (i.e. interpose on
streams going to default target) only if filter.smart.target is not set.
Currently any smart filter with specified target not found is considered
such, which is wrong. This causes misbehavior, such as all recording
streams going to the bluetooth dummy source.
Fix this by doing it correctly.