Commit graph

2296 commits

Author SHA1 Message Date
Peter Hutterer
4dd886188a alsa: fix scan-build errors for unused variables
All cases of value stored but never read
2021-05-26 07:51:27 +00:00
Peter Hutterer
851a64d8c8 doc: add spa to doxygen output
This requires a helper script: doxygen doesn't differ between static methods
and static inline methods. EXTRACT_STATIC defines whether it parses *any*
static method but we're currently using all C files as input files as well. We
cannot convince doxygen to just parse static inline functions in header files
so for SPA we hack around this: meson passes the spa headers to a shell script
with simply copies those changed to `/* static */ inline void (foo)` and doxygen
then runs on those header files.

The result: we get all spa functions added to your doxygen output at the cost
of a few sed calls.
2021-05-26 07:44:55 +00:00
Peter Hutterer
07533cb708 spa: group the spa headers into doxygen modules
Subdirectories buffer, control, debug, monitor, pod, support and utils, others
are still missing. Headers are grouped either per subdirectory (e.g. buffer/
gets added to group spa_buffer) or per-file (e.g. spa_json is a separate
group), whatever seemed like the most sensible approach.
2021-05-26 07:44:55 +00:00
Peter Hutterer
d0aff793b7 spa: doxygenize the param/video comments 2021-05-26 07:44:55 +00:00
Johannes Wolf
799ba7de16 alsa-profiles: Add NI Komplete Audio 6 profile set 2021-05-26 07:35:25 +00:00
Georges Basile Stavracas Neto
f1cc525d7e Add channel paths to analog-surround-*
Motu M4 has four inputs (two line-in inputs, and two complete ones
with gain and XLR and whatnot), as well as four outputs (two monitor
pairs, and an unnaccounted headphone).

Sadly, like a few other interfaces, it wasn't being given an input
profile, since the matching code goes through default.conf testing
each config, and ends up selecting 'analog-surround-40', which does
not have input mapping. The inputs would fallback to 'multichannel-
input', which also doesn't have input paths.

Add input paths to all analog-surround-* mappings, and remove their
'direction=output' fields since they handle both out and in.
2021-05-25 18:41:22 -03:00
Valentin David
6216de6ca0
alsa: Add support for SteelSeries Arctis 9 Wireless 2021-05-21 14:39:45 +02:00
columbarius
d735d32eb3 spa: respect mandatory properties while filtering 2021-05-21 10:41:34 +00:00
columbarius
da566c2865 spa: add property flag SPA_POD_PROP_FLAG_MANDATORY
This flag is used to announce that the respective key is mandatory and
therefore the object containing this key is not suitable to be merged
with other objects missing it.
2021-05-21 10:41:34 +00:00
Wim Taymans
39a2636c9b alsa: clean up port and node params 2021-05-21 11:08:52 +02:00
Wim Taymans
89c10dad70 spa: Clean up some of the param handling 2021-05-21 10:10:38 +02:00
Peter Hutterer
4cf18c92f8 spa: fix few doxygen errors 2021-05-21 15:04:22 +10:00
Peter Hutterer
71c6a175c4 Drop double semicolons 2021-05-20 07:24:22 +00:00
Peter Hutterer
cdfd50e166 spa: add spa_atob() to convert a string to a boolean
This replaces the manual check for "true" and some (inconsistent) return value
of atoi. All those instances now require either "true" or "1" to parse as
true, any other value (including NULL) is boolean false.
2021-05-18 22:18:56 +10:00
Peter Hutterer
92514d57e4 treewide: replace plain strcmp() calls with spa_streq 2021-05-18 22:10:27 +10: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
Peter Hutterer
d8a9534a9a spa/string: add spa_streq() and spa_strneq() for string equality
Easier to use than strcmp() since their return value matches expectations. And
they do what is expected with NULL strings, two NULL pointers are equal, one
NULL pointer is not equal.
2021-05-18 22:10:27 +10:00
Peter Hutterer
9bbe5c7517 bluez: add a helper function for checking the message signature
strcmp() is easier to get wrong (or lack consistency) so let's abstract all
these calls with a little helper.
2021-05-18 22:10:26 +10:00
Peter Hutterer
65f5f2a6f8 alsa/v4l2: convdert udev's VID/PID from hex to decimal
udev's ID_MODEL_ID and ID_VENDOR_ID are inconsistent: always 4-digit hex but
sound devices are prefixed with 0x, v4l devices are not. Depending on the
actual ID, the value will look like decimal (1234) or hex (a234).

pw-dump will then print those as either decimal integers (i.e. 0x1234 becomes
decimal 1234) or double (i.e. a234 becomes 41524.00).

Make this consistent by converting the string from hex do decimal where we
get it.
2021-05-18 07:35:00 +00:00
Peter Hutterer
5aa15d10e9 spa: add a new string helper with spa_strtol()
Most of the time when we convert a string to an integer we only care about
success. Let's wrap this with a helper function that sets the value to the
result and returns true on success.
2021-05-18 07:35:00 +00:00
Peter Hutterer
0504ebffeb spa: prefix SPA_*_LAST enum values with an underscore
These are not part of the ABI, prefixing them makes this a bit more obvious
that they shouldn't be used.
2021-05-18 10:41:26 +10:00
Peter Hutterer
2ff7a8fba7 spa: fix an indentation issue 2021-05-18 10:38:01 +10:00
Wim Taymans
a21c7f8457 acp: sync with pulseaudio
See #747
2021-05-17 17:26:25 +02:00
Wim Taymans
d8208c5c2d dbus: move connect to dbus in connection_get()
This way we can reset the dbus connection when we got a disconnect
and signal the event. This can then be used by the client to
do a new connection_get().
2021-05-17 13:17:27 +02:00
Wim Taymans
2dcdabd2af dbus: add events to the dbus connection
Add events to the dbus connection and notify about destroy and
disconnect.
2021-05-17 11:54:43 +02:00
Wim Taymans
40fbabd9ed dbus: listen for disconnect signal
And log a warning when our connection is lost.

See #1099
2021-05-17 10:20:28 +02:00
Barnabás Pőcze
c73ef2b9a1 spa: ffmpeg: use av_codec_iterate() when available
av_codec_next() was deprecated on 2018-02-06,
in lavc 58.10.100 (36c85d6e77). It was then later
removed on 2021-04-27 (4b2be3f8d). `av_codec_iterate()`
was added in lavc 58.10.100, so use that when available.

Fixes #1138.
2021-05-16 13:10:59 +00:00
Barnabás Pőcze
3baf3fcfec spa: ffmpeg: remove libavformat dependency
`av_register_all()` is the only thing used from libavformat,
but that doesn't seem to be needed for codec enumeration,
so remove it, and call `avcodec_register_all()` instead
when libavcodec < 58.10.100.
2021-05-16 13:10:59 +00:00
Barnabás Pőcze
3f567eeb56 spa: ffmpeg: fix FFmpeg name
ffmpeg.c had 'Spa V4l2 Support' in it, fix that to say
FFmpeg. Furthermore, change 'FFMpeg' to 'FFmpeg' in
ffmpeg-{enc,dec}.c as that is how it's referred to
in official texts.
2021-05-16 13:10:59 +00:00
Barnabás Pőcze
5a14e3970a spa: ffmpeg: remove hard-coded values
Use `sizeof` to query the size of the array instead of
hard coding it.
2021-05-16 13:10:59 +00:00
Daniel Stone
d08b6fac6b openaptx: Blacklist >= 0.2.1 due to license change
openaptx has recently changed its license to explicitly exclude
'Freedesktop projects' from using it, which would include PipeWire, as
well as shifting to base terms of GPLv3:
    811bc18586

This unilateral license change is legally dubious in many ways.

The original work came from ffmpeg under the LGPL v2.1, to which third
parties may not add additional restrictions (per sections 2 and 7 of the
LGPL v2.1), so LGPLv2.1 + may-not-use restrictions are not permissible
without the explicit consent of the original copyright holder.

The upgrade to LGPL v3.0 without explicit consent from the original
copyright holder is in itself permissible through the upgrade terms of
the LGPL, however the additional restrictions imposed again conflict
with sections 7 and 10 of the GPLv3 (as the base of the LGPLv3, with
those sections not being invalidated by the additional LGPLv3 text).

Though it does not impact the legal validity of the redeclaration of
licensing, the claims that freedesktop.org has violated the terms of the
openaptx license in the past are false; the work was contributed to the
PulseAudio project with an explicit open license, with the original
contributor later attempting to revoke permission for its use, despite
the explicit terms of the license giving no ability to do so as they
lack a change-of-heart provision.

The claims that Collabora violated the license are even more baseless;
they are based on an assertion that when I (acting on behalf of
freedesktop.org rather than Collabora, in my own unpaid time) banned
users from freedesktop.org's GitLab instance due to sustained violations
of the Code of Conduct users agree to when creating an account on that
platform, this somehow constituted a violation of the license. Even if
Collabora were somehow involved in this - which they were not at all -
there is no requirement under open licenses that users be given
unlimited access under all terms to any platform on the internet. Such
terms would mean that open development could only be conducted on
completely unmoderated platforms, which does not stand up to any
scrutiny.

Regardless of the declared license having no legal validity, the LGPL's
explicit provision in both v2.1 and v3.0 for such additional
restrictions to be stripped, and the low likelihood of it ever being
used together with PipeWire as its licensing terms would not be
acceptable to any distribution, enforcing a version check seems like the
safest way to ensure complete legal clarity, not put users or
downstreams in any jeopardy, and comply with the author's stated wishes
for v0.2.1 and above to not be used by PipeWire.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2021-05-11 12:48:24 +00:00
Huang-Huang Bao
03cde9751b
bluez5: guard against device profile
Invalid device profile should not be set.
2021-05-11 19:22:42 +08:00
Wim Taymans
4cde1182d4 spa: add params property
Some properties can be part of a params field in the Props object
and contain the string key and the pod value to be configured. This
is easier to use than using the regular id.

Add the fact that the property is also part of params in the PropInfo.
2021-05-10 11:01:13 +02:00
Wim Taymans
d226a28b30 acp: reset soft_volume
Reset the software volume when initializing the device and when the
hardware volume is updated.

The software volume was set to 0 by default and if the session manager
did not change the volume enough to cause a software volume change,
it would remain 0 and there would be silence.

Also improve the debug a little.

See #1160 #1167 #1164 #1049 #1117
2021-05-10 10:50:42 +02:00
Wim Taymans
02decd9fba alsa: pause/resume when entering/exiting freewheel
When we start freewheeling, pause the device and resume when we
finish freewheel.
In freewheel mode, just discard samples in the sink and produce
silence in the source.
2021-05-07 11:51:22 +02:00
Wim Taymans
a80ec36ad5 node-driver: run as fast as possible in freewheel mode 2021-05-07 11:50:55 +02:00
Wim Taymans
888612dc0f conf: add freewheel driver
Add freewheel driver and enable freewheel mode on it.
2021-05-07 09:03:34 +02:00
Wim Taymans
5c41131d6d node-driver: support node.freewheel property
To activate freewheeling when initializing
2021-05-07 09:03:34 +02:00
Wim Taymans
efc497a38a spa: make a new FREEWHEEL clock flag
When freewheeling, the clock is going faster than real time.
When freewheeling, skip samples in alsa sink/source.
2021-05-07 09:03:34 +02:00
Peter Hutterer
cc4324cd30 spa/logger: only log in colors if we're logging to a tty 2021-05-07 06:57:31 +00:00
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Wim Taymans
1a0ad3d688 v4l2-utils: only allocate MemPtr when requested 2021-05-06 10:16:21 +02:00
Wim Taymans
941620b733 v4l2: don't expose the internal fd
When allocating memory, just export the mmaped memory and mark the
memory as MemPtr, not MemFd. Set the fd to -1.

Otherwise we might send this fd to the client, making the complete
device accessible to the client.
2021-05-06 09:24:27 +02:00
Wim Taymans
44f49a3ea0 v4l2: add some more debug 2021-05-05 11:23:44 +02:00
Davide Beatrici
5f09b9f4d1 pod: fix "missing-field-initializers" warnings
/usr/include/spa-0.2/spa/pod/builder.h:90:13: error: missing field '_padding' initializer [-Werror,-Wmissing-field-initializers]
        *builder = SPA_POD_BUILDER_INIT(data, size);
                   ^

/usr/include/spa-0.2/spa/pod/builder.h:90:13: error: missing field 'state' initializer [-Werror,-Wmissing-field-initializers]
        *builder = SPA_POD_BUILDER_INIT(data, size);
                   ^

/usr/include/spa-0.2/spa/pod/builder.h:90:13: error: missing field 'callbacks' initializer [-Werror,-Wmissing-field-initializers]
        *builder = SPA_POD_BUILDER_INIT(data, size);
                   ^

/usr/include/spa-0.2/spa/pod/builder.h:248:33: error: missing field '_padding' initializer [-Werror,-Wmissing-field-initializers]
        const struct spa_pod_float p = SPA_POD_INIT_Float(val);
                                       ^

/usr/include/spa-0.2/spa/pod/parser.h:56:12: error: missing field '_padding' initializer [-Werror,-Wmissing-field-initializers]
        *parser = SPA_POD_PARSER_INIT(data, size);
                  ^

/usr/include/spa-0.2/spa/pod/parser.h:56:12: error: missing field 'state' initializer [-Werror,-Wmissing-field-initializers]
        *parser = SPA_POD_PARSER_INIT(data, size);
                  ^
2021-05-05 08:03:46 +00:00
George Kiagiadakis
bc1f9d304f audioconvert: handle S8/S8P raw audio formats 2021-05-05 08:56:59 +03:00
Wim Taymans
aabf879bb0 bluez5: avoid asserting when device existed
When a device as added in dbus but we already knew about the
device, don't assert but reuse the device we already have.

Seems to happen when resuming from suspend.

See rhbz#1948776
2021-05-04 15:39:34 +02:00
Wim Taymans
5a6967858e channelmix: improve soft volume state
When we have a soft Mute or Volume, use the soft volume.
When we get a volume update with only a channel Mute/Volume, use
the channel volumes.

See #1140
2021-05-04 13:05:38 +02:00