Commit graph

1018 commits

Author SHA1 Message Date
Frédéric Danis
1d39ea004e log: Add spa_log_hexdump 2022-09-07 07:50:23 +02:00
Thomas Weißschuh
2394413ec3 hook: don't remove from unitialized list
A lot of code calls spa_hook_remove() from error paths where the hook
and therefore the list may not have been initialized.
This leads to null-derefences.
2022-08-30 11:52:42 +00:00
Thomas Weißschuh
b23b0e6125 list: add spa_list_is_initialized()
This function can be used to test if a list has been initialized.
2022-08-30 11:52:42 +00:00
Thomas Weißschuh
6531bedcdb spa: add SPA_WARN_UNUSED_RESULT 2022-08-19 07:35:02 +00:00
Barnabás Pőcze
aab15433c8 spa: aec: rename first argument of methods in spa_audio_aec_methods
The first parameter is a pointer to the object implementing the aec
interface, the name `object` is better than `data`.
2022-07-23 08:58:18 +00:00
Wim Taymans
5a8af97a40 audioconvert: use SPA_CLAMPF to clamp floats
It generates better assembler.
2022-07-19 17:59:14 +02:00
Pauli Virtanen
434cc6a90b bluez5: add Opus as a (Pipewire-specific) A2DP vendor codec
Support Opus as A2DP vendor codec.

The specification for vendor A2DP codec is our Pipewire-specific one, so
it is compatible only with devices running Pipewire.
2022-07-19 13:44:56 +00:00
Wim Taymans
cbbc4baa3f json: avoid converting random string to floats
Only allow the json float characters when converting to float.
This avoids NAN, INF, 0xffe4 etc to be seen as a json float.
2022-07-11 11:50:58 +02:00
Wim Taymans
5fbda82cc3 spa: tweak SPA_MIN and SPA_MAX
This generates much better assembler because it can use a cmov in
more cases.
2022-07-09 20:35:47 +02:00
Wim Taymans
20172bfbe6 spa: add comment about prefetch 2022-07-08 17:02:46 +02:00
Wim Taymans
f2dee23085 buffer: add EMPTY chunk flag
Add an EMPTY chunk flag to mark a piece of memory as 'empty'. For audio
this means silence.
Use the empty flag to avoid mixing 0 samples.
Set the empty flag in output buffers on audioconvert.
2022-06-24 11:09:01 +02:00
Lucas Holt
6a15a02ec2 Add support for MidnightBSD
Fix build issue

Fix build issue
2022-06-19 18:22:47 +00:00
Wim Taymans
332e8b7029 vulkan: start of vulkan filters 2022-06-06 12:13:19 +02:00
George Kiagiadakis
cd8ac5c1a6 libcamera: add camera location property on nodes 2022-05-26 10:41:02 +00:00
James Hilliard
4738c934bb Fix build on uclibc without locale support
When uclibc is build with !UCLIBC_HAS_LOCALE the macro
__LOCALE_C_ONLY will be set, use this to disable unsupported and
not required(due to only supporting the C locale) locale functions.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
2022-05-21 16:59:54 +00:00
Pauli Virtanen
9e59a56894 bluez5: add LC3plus A2DP vendor codec
Implement codec plugin for the LC3plus codec, supporting the LC3plus
encoder/decoder from Fraunhofer.
2022-05-01 15:09:00 +03:00
Wim Taymans
92e2b7dd0d json: improve unicode parsing
Make sure don't overread the strings.
Don't use sscanf but use a custom hex read function.

Fixes #2340
2022-04-27 08:37:32 +02:00
Wim Taymans
5137015c33 json: convert utf16 to utf8
We work with utf8 string so convert the unicode escape sequences to
utf8.

Fixes #2337
2022-04-26 15:38:22 +02:00
Wim Taymans
f2cdb15e0c json: fix \uXXXX parsing
We need exactly 4 hex characters, everything else is refused. We
also copy those characters directly to the output string without
assuming any encoding.

See #2337
2022-04-26 11:01:33 +02:00
Wim Taymans
0b96b87331 thread: implement some properties
Make helper method to parse thread properties and add 2 new properties
to control name and stack-size of the thread.
Use properties when creating threads with the default utils.
Use the default thread utils instead of pthread_create so that the
properties are used.
2022-04-18 13:02:27 +02:00
Barnabás Pőcze
61594270f4 spa: utils: defs: parenthesize macro bodies
Parenthesize the body of the `SPA_CONTAINER_OF()`
and `SPA_PTR_ALIGN()` macros.
2022-04-18 07:49:05 +00: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
psykose
d3ea3142e1 spa: fix c90 header include
placing declarations after code is invalid under ISO c90

Fixes !1211
2022-04-14 12:38:11 +02:00
columbarius
f36f673b3b spa: replace locale aware string functions with uselocale
Not all string functions have a POSIX compliant locale aware version
(eg. strtof_l). Instead uselocale [1] should be used, which allows
switching the locale of a thread to a welldefined one and restoring it
afterwards.

[1] https://man7.org/linux/man-pages/man3/uselocale.3.html
2022-04-05 17:13:18 +00:00
Wim Taymans
1bf1497855 spa: mode dll to utils 2022-03-30 17:22:26 +02:00
Wim Taymans
2b16df4e89 spa: add locale independent spa_dtoa
And use this in spa_json_format_float() where we also avoid invalid
json floats.
Use json float format in some places where we serialize json floats.
Add a unit test.

See #2223
2022-03-21 10:41:44 +01:00
Wim Taymans
5f4d031db0 spa: add locale independent spa_strtod/spa_strtod
Use those for spa_atof and spa_atod.
Use those for parsing json float.
2022-03-21 10:38:00 +01:00
Wim Taymans
6b423c3d25 spa: debug double like a float 2022-03-21 09:18:07 +01:00
Wim Taymans
93b5d440bc json: add locale independent parse and format functions
Use them in pw-dump.
Add some unit tests.

See #2223
2022-03-20 21:04:33 +01:00
Wim Taymans
947d15a60a json: empty string should not give a valid number 2022-03-20 20:37:26 +01:00
Barnabás Pőcze
25980f947f spa: utils: hook: add comments and fix code in documentation
Extend the examples with comments and fix issues in the code.
2022-03-11 21:21:24 +01:00
Wim Taymans
0db8d39dd8 spa: fix compilation with c++ 2022-03-01 21:40:30 +01:00
Wim Taymans
d3a1b9fe31 spa: add dynamic builder helper
Resizes the buffer dynamically. Be careful with getting the address
of a pod in the buffer, it might not be valid after building more stuff
with the builder.
2022-03-01 20:32:58 +01:00
Wim Taymans
c5c9ecdd87 spa: improve the AEC interface
Place the methods on the interface so that we can call them.
Rename create to init because that is what it does.
Add support for listener and events so that we can signal property
changes later.
2022-02-16 16:18:18 +01:00
Joakim Olsson
9386c70b3a module-echo-cancel: Move backends to dynamic libaries
Move all backends to dynamic libaries loaded with spa_plugin_loader so
new backends not needs changes in pipewire or pipewire dependency to
external code

Change-Id: I702ce047598d0c318d6dc6ac8248062a5c12f643
2022-02-15 15:45:46 +00:00
Barnabás Pőcze
bf886ba209 support: also protect against recursive invocations
Add an extra private field to the source to store the pollevent of
the current iteration. This changes ABI but it seems an embedded source
is not used outside of our own plugins and the unit test doesn't test
this ABI case.

Whenever a source is removed, we can set the data field of the
pollevent to NULL so that it won't be handled in any iteration anymore.

Avoid dispatching the same event multiple times when doing recursive
iterations.

Add some more unit tests for this.

Fixes #2114
2022-02-08 17:21:10 +01:00
Wim Taymans
a16cd95593 spa: move debug log defines to one place
Use spa_debug to debug formats.
Make debug go to stdout by default.
2022-02-07 17:00:38 +01:00
Wim Taymans
8c10080324 pulse-server: make sure we don't exceed maxlength
Make sure the various buffer attributes don't exceed maxlength.
Add some SPA_ROUND_UP and SPA_ROUND_DOWN macros.

Fixes #2100
2022-02-04 11:59:57 +01:00
Wim Taymans
398b04e145 spa: fix the event and command type info
The object id needs to have the object type as the parent.
2022-01-27 12:34:04 +01:00
Pauli Virtanen
870cd0136a spa: allow spa_dict.items to be NULL for zero items
For dicts with zero items, don't dereference dict->items, or give it to
qsort or bsearch where passing in NULL is not allowed.
2022-01-20 20:04:18 +02:00
Wim Taymans
aa128ed489 spa: make common function to find type from short name 2022-01-20 18:08:30 +01:00
Wim Taymans
5ebbe09371 pw-cli: move json to pod code to SPA 2022-01-18 10:38:11 +01:00
Robbert van der Helm
4419baec45 module-rt: Use magic value for user config prio
Instead of having the context priority hardcoded at 88.
2022-01-16 21:54:32 +01:00
Aleix Pol
8f9bd42d93 Document the unit on spa_meta_header::pts
It's nanoseconds
2022-01-13 18:13:29 +00:00
Wim Taymans
611591d0fc json: add spa_json_parse_stringn()
It also checks the destination size.
2022-01-04 12:37:00 +01:00
Wim Taymans
67dc97fa43 alsa: add audio.allowed-rates param
Add a construct and runtime param to limit the amount of allowed
samplerates used by the node.

Fixes #1932
2022-01-03 16:03:23 +01:00
Barnabás Pőcze
871ba61228 spa: pod: parser: add null terminator
If the supplied buffer has smaller (or equal) size than the
length of the string, then `strncpy()` will not place a null
terminator in the buffer.

Fix that by always setting the last byte of the buffer to zero.
2021-12-21 17:05:25 +01:00
Wim Taymans
d2ec680d3d spa: fix initializer for old GCC
Older gcc versions seem to require the members to appear in the
designated initializer in the order they are in the definition of
the struct when compiling C++.

Fixes #1910
2021-12-16 11:08:07 +01:00
Quantum
8bab9a18ec Add all 32-bit packed little endian 10-bit RGB colour formats
Given that 10-bit colour is now becoming supported on Wayland, PipeWire
should be able to represent all the possible colour formats in order
for screen capture to work.

This commit adds all possible orderings of 10-bit RGB channels and 2
extra bits used for nothing or alpha in little endian to enum
spa_video_format. Note that Wayland only uses little endian for its
10-bit colour formats, and these are not the same as the big endian
formats in reverse order.
2021-12-07 11:22:04 +00:00
Wim Taymans
97cad7284a latency: fix latency combine calculations
0 is a valid min latency so we can't use it as an unset value. Use
some large value instead and when nothing was configured, assume it
is 0.

Fixes #1839
2021-12-02 14:49:48 +01:00