Commit graph

142 commits

Author SHA1 Message Date
Wim Taymans
6d74eee874 spa: bump channels to 128 again
Remove the SPA_AUDIO_MAX_POSITION define and use the
SPA_AUDIO_MAX_CHANNELS again.

Make a compile time define to override the default max channels of 64.

Make sure we compile the SPA library with the default 64 channels. If
you use the SPA library on a spa_audio_info you will get 64 channel
support, like before. If you want more channels, you will need to make
a padded structure or redefine the MAX_CHANNELS before you use the
spa_audio_info structures. You can use the padded structure with the
new functions that take the structure size.

With the extra checks in the parsing code, we avoid making a
valid spa_audio_info with too many channels that don't fit in the
structure. This means that code that receives a spa_audio_info can
assume there is enough padding for all the channels.
2025-10-24 08:53:21 +02:00
Wim Taymans
e317edcfb9 pod: rework the parser
Make a new body.h file with some functions to deal with pod and their
body. Make the iter.h functions use mostly this.

Rework the parser so that it only uses body.h functions. With the separation
of pod+body, we can read and verify the pod once and then use the
verified copy to handle the rest of the body safely.

We do this because iter.h only works in pods in memory that doesn't change
because it is vulnerable to modifications of the data after verifying it.

The new parser is not vulnerable to this and will not cause invalid
memory access when used on shared memory. There is however no need for
atomic operations to read the headers, whever is read is either valid
and useable of invalid and rejected.

See #4822
2025-07-29 15:15:02 +02:00
Carlos Rafael Giani
5db9bca75c spa: add AC3, EAC3, TrueHD, DTS, MPEG-H formats 2025-05-29 21:41:51 +02:00
Wim Taymans
25e06e5912 spa: remove some old includes 2024-11-26 13:30:58 +01:00
Wim Taymans
d966a36fdd spa: compile all function into libspa.so 2024-11-26 11:58:51 +01:00
Wim Taymans
a6ad8f747f remove spalib 2018-08-14 15:29:25 +02:00
Wim Taymans
3b1c40f17f pod: move compare and filter functions out of the library 2018-08-14 14:52:32 +02:00
Wim Taymans
60d4473e7b make spa-lib versioned
Fixes #60
2018-08-14 14:41:50 +02:00
Wim Taymans
f49ab32874 meta: add video damage region metadata
Add damage region meta
Implement damage region in video-src and export-sink
2018-07-09 12:07:30 +02:00
Wim Taymans
f24ee7fd02 debug: print to stderr 2018-01-11 10:14:26 +01:00
Wim Taymans
ada3698355 pod-iter: remove broken _FOREACH_SAFE 2017-11-29 13:22:25 +01:00
Wim Taymans
140c3959ab meta: remove shared meta data
Make a method to find the memory block for the given ptr. We can
use this to find the memfd of the memory if there is any. We can
then remove the Shared metadata on buffers.
2017-11-28 18:30:29 +01:00
Wim Taymans
4288a634f4 buffer: don't use ringbuffer in chunk
We can't use a ringbuffer on the chunk because it implies the
consumer would write to it to update the read position, which we
can't do because the chunk is read-only and might even be shared.
Go back to offset/size pairs, which can sortof do the same thing
if we want later when we keep a non-shared read pointer in the
consumer.
Keep alsa timestamp around and filled state for future.
mmap the input port meta/data/chunk as read-only.
Only do clock update requests when asked.
2017-11-21 12:42:27 +01:00
Wim Taymans
4d0bab799c link: don't allocate shared meta in shared mem
We can't allocate the shared meta in shared mem because then clients can
damage it for other clients. Place it instead right after the buffer
metadata array. Filter out the shared metadata for a client, we send it
as part of the client_buffer structure.
Remove pointer metadata, it's not so useful.
Document the layout of the allocated buffers and the shared memory.
Work on metadata to define control parameters
2017-11-17 13:34:42 +01:00
Wim Taymans
2923b623b3 Meta: rework ringbuffer meta
ringbuffer: remove size and mask from the ringbuffer, we have that
elsewhere in the user of the ringbuffer.
Remove the buffer data offset and size fields and replace with a
ringbuffer. We then have a ringbuffer in all buffer data, which
simplifies things.
We can now remove the ringbuffer metadata.
2017-11-15 17:25:36 +01:00
Wim Taymans
49d8f6792e pod: first compare, then advance to next item 2017-11-14 16:49:07 +01:00
Wim Taymans
52e1dad93e Improve pod filter
Reset the builder when the filter failed.
Make the plugins create their params in a temporary buffer, we
don't want to do in-place filtering because that is not always
possible. Because the filter now resets on error, we can remove
the reset from the plugins.
2017-11-14 10:17:45 +01:00
Wim Taymans
440f681f4b Improve enum_param
Add an argument to pass the result param to the caller instead of
having the caller have to pick it up from the builder.
Improve docs for node, clock and monitor
Pass spa_pod everywhere instead of spa_pod_object.
Pass result argument to spa_pod_filter to make things a little
nicer.
2017-11-13 17:57:38 +01:00
Wim Taymans
6fb0f580ea Use errno for result errors
Make new enumeration for data transport status and use errno
style error numbers for errors.
2017-11-13 09:41:41 +01:00
Wim Taymans
dda28b1589 cleaup up the result codes 2017-11-10 16:11:53 +01:00
Wim Taymans
caaeaff223 Reorganise SPA tree
Reorganise the SPA includes to make it more extensible later
Simplify the naming of the buffer and meta params
2017-11-10 13:36:14 +01:00
Wim Taymans
58451d626c Implement param filtering
Make a new pod filter function and use it in the plugins to filter
in enum_params.
Small tweaks to the pod_builder
2017-11-09 17:16:54 +01:00
Wim Taymans
cc47fb7e3a clean up pod_builder
Remove the frame argument from the builder, we can use the builder
allocated frames.
Add deref function to builder to make it more flexible later.
Add some more recursion depth checks in the parser.
Improve props filter, also filter other types.
2017-11-08 15:48:31 +01:00
Wim Taymans
f3bca48398 Unify props, params and formats
Make enum_params and set_param to configure properties, format
and other parameters. This allows us to remove some duplicate
code and make the properties and parameters much more extensible.
Use the object id to mark the id of the parameter.
Remove the spa_format and spa_props.
We can now make the client-node easier by merging the various
format methods into the params.
Make the stream API more powerful now that we can pass params
around.
2017-11-07 17:48:40 +01:00
Wim Taymans
24d80e5c00 Add new pod parser and builder
Add a new pod builder and parser that is less verbose and
a little more powerful.
2017-09-28 17:00:51 +02:00
Wim Taymans
3b5a308645 link: improve renegotiation
Only suspend an idle node when we need to configure a different format.
2017-06-20 16:22:25 +02:00
Wim Taymans
b4fdcbd322 Debug: remove logger
Make a default logger and mapper in a .h file to be used by examples
Remove logger and mapper from libs
Make method to set the default mapper for the debug methods
2017-06-06 13:30:34 +02:00
Wim Taymans
1feec309ec logger: add loadable logger 2017-06-05 15:59:11 +02:00
Wim Taymans
5b037661d9 indent 2017-05-26 08:05:01 +02:00
Wim Taymans
11f23a3ffa spa: don't use typedef for struct and enum 2017-05-25 13:28:15 +02:00
Wim Taymans
d1a6d6e03f param: add more generic port params
Remove port properties and replace them with port params. Move the
params from the PortInfo to enum_params.
Use the Param ranges to specify possible sizes etc.
2017-05-22 13:06:18 +02:00
Linus Svensson
e27ec1a203 Only use string literals as format
Fixes -Wformat-security error.
2017-05-16 09:31:50 +02:00
Linus Svensson
a5c9ba1e5b Install all header files 2017-05-16 09:24:21 +02:00
Linus Svensson
04ffc679fc spa: Include version in libspa-lib.so 2017-05-16 09:12:53 +02:00
Wim Taymans
430b749d53 fix trace logging 2017-04-27 18:56:59 +02:00
Wim Taymans
214a0e27d8 Add support for trace logging in lockfree ringbuffer
Fix some crashes when the connection is dead.
Small cleanups in the audio mixer
Only propose alloc_buffer when we are using export_buf in v4l2
2017-04-27 17:17:47 +02:00
Wim Taymans
b51d3e4862 buffer: make data and meta types dynamic
Use dynamic types for the data and meta types.
Move the meta into a separate header.
Remove port state, we can keep track of that ourselves.
Add size to MetaDataEnable params
2017-04-26 18:54:18 +02:00
Wim Taymans
0b508db9fc ringbuffer: simplify the API
Use absolute indexes that we let wrap around. We can then easily detect
how much we under of overflowed by using serial number arithmetic.
Remove the Areas, we can trivially compute this ourselves, move the
logic in read/write_data.
2017-04-20 11:25:24 +02:00
Wim Taymans
39c3650b5f fix media.class 2017-04-04 15:32:11 +02:00
Wim Taymans
032cc69f2f plugins: small cleanups 2017-04-04 09:40:12 +02:00
Wim Taymans
5c32690cc8 Add sync and async support in *testsrc
Make minumum alsa latency configurable.
2017-04-03 16:54:44 +02:00
Wim Taymans
01c13adab5 improve node io
Unify input and output io areas.
Add support for ranges in the io area.
Automatically recycle buffers in the output areas in process_output
Improve the mixer, add use_buffer support, use a queue of input buffers,
fix mixing, add support for ranges.
Fix mixer and v4l2 tests
2017-04-03 14:56:04 +02:00
Wim Taymans
29fbf2e841 props: improve prop flags
Only keep the READONLY prop flag.
Work on test-mixer
2017-03-31 11:48:24 +02:00
Wim Taymans
e90166678c monitor: pass info to factory 2017-03-24 18:31:37 +01:00
Wim Taymans
29cb7bf39a format: improve format parsing 2017-03-24 18:11:11 +01:00
Wim Taymans
25b7ede0bc uri -> type
Clean up some more types.
2017-03-24 13:11:57 +01:00
Wim Taymans
5825c62d6d types: more work on types 2017-03-24 11:40:58 +01:00
Wim Taymans
acedfe71c0 clean up types 2017-03-23 21:15:52 +01:00
Wim Taymans
3dba9f0fd4 pod: handle NULL 2017-03-23 16:08:50 +01:00
Wim Taymans
048a4b81a8 alloc-params: use dynamic types for alloc-params 2017-03-23 10:12:20 +01:00