Commit graph

46 commits

Author SHA1 Message Date
Wim Taymans
8bbca3b8f3 spa: add spa_audio_parse_position_n
Add a function that accepts the size of the position array when reading
the audio positions. This makes it possible to decouple the position
array size from SPA_AUDIO_MAX_CHANNELS.

Also use SPA_N_ELEMENTS to pass the number of array elements to
functions instead of a fixed constant. This makes it easier to change
the array size later to a different constant without having to patch up
all the places where the size is used.
2025-10-21 09:59:13 +02:00
Wim Taymans
13b8c23767 Don't use SPA_AUDIO_MAX_CHANNELS directly
Make a MAX_CHANNELS define and use that one in code. This makes it
easier to change the constant later.
2025-10-21 09:43:06 +02:00
Wim Taymans
24bcacc619 conf: remove client-rt.conf
We now automatically move non-rt clients into non-rt threads so the
client-rt.conf is obsolete.

Move the module-rt in client.conf and add conditions to disable modules.

Transparently load client.conf in case applications still specify
client-rt.conf.

Custon configuration in the client-rt.conf.d/ should be moved to
client.conf.d/
2025-01-14 12:40:05 +01:00
Wim Taymans
188d920733 pass the right types to the methods
This currently works because we accept void* for these functions but it
will fail when we will use the real types.
2024-11-20 10:17:37 +01:00
Wim Taymans
b5cccdb382 json: add and use spa_json_str_object_find()
Parse a string as a json object and copy the value with key as a string.
2024-09-16 13:12:05 +02:00
Wim Taymans
ce390d5b22 spa: add spa_json_object_next
This gets the next key and value from an object. This function is better
because it will skip key/value pairs that don't fit in the array to hold
the key.

The previous code patter would stop parsing the object as soon as a key
larger than the available space was found.
2024-09-16 09:50:36 +02:00
Wim Taymans
cd81b5f39a spa: add spa_json_begin_array/object and relaxed versions
Add spa_json_begin_array/object to replace
spa_json_init+spa_json_begin_array/object

This function is better because it does not waste a useless spa_json
structure as an iterator. The relaxed versions also error out when the
container is mismatched because parsing a mismatched container is not
going to give any results anyway.
2024-09-16 09:50:33 +02:00
Jonas Holmberg
e78e97cb99 pipewire-alsa: Propagate errors from eventfd().
Propagate the error if spa_system_eventfd_create() fails. Also copy
errno before calling spa_log_debug() in spa_system_eventfd_create() to
make sure it is not overwritten.
2024-02-19 14:16:26 +00:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
c8850f8766 env vars should override everything
Always first use the env var and then check the properties. So that
PIPEWIRE_CORE=pipewire-1 PIPEWIRE_REMOTE=pipewire-1 make run runs
everything on pipewire-1 sockets regardless of the config files.

Also PIPEWIRE_NODE always needs to be taken into account first.
2023-01-24 17:39:54 +01:00
Wim Taymans
ee55df9f9e alsa: add option to change the volume-method
Add option to set linear or cubic volume, cubic is now the default.
2023-01-20 10:11:49 +01:00
Wim Taymans
c7239b1f2a alsa: also use client-rt.conf for the mixer
There is no reason to use the non-rt version. It makes more sense to be
able to put all ALSA properties and rules in the same conf file.
2023-01-20 09:30:37 +01:00
Wim Taymans
eadab2ffe3 alsa: clean up volume min/max values 2023-01-20 09:29:59 +01:00
anteater
057a6c490b alsa: make displayed ALSA volume match PulseAudio volume
This is the same behavior as `apulse`, for example, and is more clear for users.
2023-01-20 08:16:50 +00:00
Wim Taymans
6af85f2371 alsa: fix compilation 2023-01-19 19:18:53 +01:00
Wim Taymans
e0bfd7421b alsa: improve property handling some more
Use properties from the context for matching first, then fill in some
defaults, then override with env variables.
Add property rules in ctl as well.
2023-01-19 18:15:32 +01:00
Thomas Weißschuh
ed46324872 alsa: fix memory leak of properties 2023-01-01 02:00:36 +00:00
Wim Taymans
4593ac4113 alsa: pass bool argument properly 2022-09-01 10:18:55 +02:00
Wim Taymans
3215b58bae alsa: save volumes
Instruct the session manager to save the volumes when set with the
ALSA ctrl API.
2022-09-01 09:43:10 +02:00
Quentin Wenger
22fc9eec35 Cleanup argument names in methods and events interfaces
First method argument is object, first event argument is data.

Closes !963
2022-04-15 10:11:49 +02:00
Wim Taymans
c46113faa3 json: spa_json_get_string() writes up to len chars or fail 2022-01-04 10:42:32 +01:00
Wim Taymans
5ed4977b38 destroy proxies when global is removed
When a global is removed, also remove the proxies. We can have multiple
proxies to a global otherwise when a client has a sequence of events
queued from the server like this:

Global 1 added
Global 1 removed
Global 1 added

The proxy we added in the firt event would not be destroyed because the
server did not know about it when global 1 was removed and then a
second one would be made.
2021-11-08 12:55:41 +01:00
Wim Taymans
cefcc2e874 alsa-plugin: store the right value in last_seq
last_seq needs to contain the last received seq, not the last one that
we requested to sync on.
2021-10-08 09:21:32 +02:00
Wim Taymans
f562b16706 alsa-plugin: use log topics 2021-10-03 08:17:43 +02:00
Wim Taymans
3348fd9885 alsa-plugin: make sure we don't deref NULL
Also fixes a warning.
2021-10-01 15:33:51 +02:00
Wim Taymans
64f83158f4 alsa-plugin: improve error handling and recovery
Ignore -ENOENT errors, they are likely because some device was
removed.
Make sure we clear the poll descriptor when nothing is pollable, even
in the error case.
Clear the error after we reported it instead of reporting it forever.

Fixes #1627
2021-09-20 15:48:04 +02:00
Wim Taymans
d88e8edd11 avoid shadowing arguments 2021-07-06 17:55:16 +02:00
Wim Taymans
91f4e4d3c8 alsa: catch and handle some more errors 2021-07-06 17:54:08 +02:00
George Kiagiadakis
df8bd85277 alsa-ctl: filter for and use only the "default" metadata object
Fixes #1384
2021-07-02 17:44:35 +03:00
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
2021-06-30 14:44:08 +02:00
George Kiagiadakis
59407d2f08 includes: update all references to extensions to point to pipewire/extensions
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
2021-06-18 17:54:18 +03:00
Peter Hutterer
522f87d5ea treewide: replace strcmp() != 0 with !spa_streq
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Wim Taymans
877309bfbe use priority.session to select the default sink/source
priority.session is meant to be used to set routing priorities.

priority.driver is meant to be used by the scheduler to select what
nodes is best for driving the graph. This usually depends on the
hardware quality and the use case (Pro Audio devices are likely
to be used as driving the graph).

See #1028
2021-04-08 17:48:13 +02:00
Wim Taymans
f314119aa9 alsa-plugin: add some checks to avoid using invalid values 2021-03-27 20:44:21 +01:00
Wim Taymans
c8fd34a41d metadata: store default-nodes as JSON
Don't just store the id in the metadata but a JSON object with
the node name. This makes it possible to easily introspect the
metadata and also extend the metadata with more fields later.

Instead of matching the metadata id to the global ids we now
have to match it against the name.
2021-03-05 17:37:12 +01:00
Wim Taymans
7053936ffd don't attempt to connect to empty remote name
Fixes jconvolver startup.

See #744
2021-02-18 10:22:39 +01:00
Wim Taymans
62cf8c6130 alsa-plugin: improve client name 2021-02-04 12:52:23 +01:00
Wim Taymans
5817b66a20 alsa-plugin: only parse props when updated
Check if the properties got update before we try to parse them.
If they are not updated, they might be empty and we would lose
our previously parse values.

Fixes default volume in alsa-mixer.
2021-01-15 10:29:32 +01:00
Wim Taymans
b8300c663b improve some errors
Silence some -ENOENT warnings, they can happen when the object we
are introspecting is destroyed
2020-11-29 16:22:50 +01:00
Elliott Sales de Andrade
0a30eb6329 Fix a possible uninitialized variable.
Also, change the type to more accurately reflect its usage.
2020-11-23 15:36:08 +00:00
Wim Taymans
0c04481ba7 metadata: improve default sink/source
Only check defaults when subject is PW_ID_CORE
Handle NULL keys: remove the defaults
2020-08-18 17:56:05 +02:00
Wim Taymans
e71936f870 Improve naming
master -> driving
priority_master -> priority_driver
segment_master -> segment_owner
2020-08-06 13:49:33 +02:00
Wim Taymans
5bf6acad06 alsa: use PIPEWIRE_REMOTE env variable 2020-08-04 14:13:07 +02:00
Wim Taymans
37f43aba35 alsa: add mixer plugin
Add plugin to manage the volume of default source and sink
2020-07-24 17:13:51 +02:00