Commit graph

604 commits

Author SHA1 Message Date
Wim Taymans
036ca89c0e audioconvert: mark ports and buffers as DYNAMIC
Only passthrough buffer data when the buffer and ports are
marked as DYNAMIC.
Use extra buffer for nodes that keep a ref on buffers (resample).
2019-03-21 10:45:24 +01:00
Wim Taymans
0505f2dc98 audioconvert: implement passthrough
Add some const and SPA_RESTRICT to methods
When the input and output is the same, work in passthrough mode
where we simply copy place the input pointer onto the output buffer
without doing a memcpy.
Do memcpy when the resampler is not active.
2019-03-20 19:29:14 +01:00
Wim Taymans
74cf412f47 utils: add debugable spa_memcpy 2019-03-20 19:27:46 +01:00
Wim Taymans
c9bd95ae5b audioconvert: small optimization 2019-03-20 15:57:13 +01:00
Wim Taymans
b265081d6d audioconvert: use macro to transpose 2019-03-20 13:37:20 +01:00
Wim Taymans
e31f54fac5 alsa: list formats in order of preference 2019-03-20 13:05:16 +01:00
Wim Taymans
fa3bcabbca audioconvert: some more optimizations 2019-03-20 13:04:44 +01:00
Wim Taymans
67f26c9caf peaks: small optimization 2019-03-19 17:19:44 +01:00
Wim Taymans
8daff4ce50 v4l2: make custom properties for unknown ones 2019-03-19 16:19:12 +01:00
Wim Taymans
a8e9e17159 audioconvert: enumerate propinfo correctly 2019-03-18 11:18:27 +01:00
Wim Taymans
1ab00fae6d client-stream: make PropInfo visible 2019-03-15 20:25:21 +01:00
Wim Taymans
3fb9fa06a9 client-stream: emit property change events
Emit a property (param) change event when the volume or mute is
changed on a stream.
2019-03-14 16:40:17 +01:00
Wim Taymans
306f0dd964 v4l2: set result param id 2019-03-14 16:38:36 +01:00
Wim Taymans
66ea505f22 alsa: improve debug 2019-03-13 15:02:04 +01:00
Wim Taymans
7a05a35f8e v4l2: don't error when we finish the enumeration 2019-03-11 20:59:43 +01:00
Wim Taymans
3777d9612e v4l2: only emit port info once 2019-03-06 09:43:24 +01:00
Wim Taymans
09c4683ef1 interfaces: make events return void
Events are dispatched with hooks and have no return value.

Make it possible to get the last resource and proxy sender value
for where we need it.
2019-03-01 14:04:05 +01:00
Wim Taymans
0390969228 node: make add_listener method
Make struct spa_node_events for events emited from the main thread
and keep the spa_node_callbacks for the data thread callbacks.

The add_listener method installs the events and it's possible to
install multiple handles. Adding a listener first emits the info
and port_info events when installed, similar to how the PipeWire
proxy bind works.

This removes the need for the spa_pending_queue and makes it easier
to implement the _sync versions.

Add some helpers to make it easier for plugins to emit all the info
to new listeners.

Use the listeners for devices as well.
2019-03-01 12:00:42 +01:00
Wim Taymans
499dd3ff22 node: add port and node params
Add a new struct spa_param_info that lists the available params on
a node/port and if they are readable/writable/updated. We can use
this to replace and improve the PARAM_List and also to notify
property change and updates.

Update elements and code to deal with this new param stuff. Add
port and node info to most elements and signal changes.

Use async enum_params in -inspect and use the param info to know
which ones to enumerate.

Use the port info to know what parameters to update in the
remote-node.
2019-02-27 16:43:01 +01:00
Wim Taymans
aab2b5594f utils: don't remove pending after first callback
Let the caller remove the pending result when finished.
Use non _sync verions to enum_params in node/port/device.
Set result.id in alsa and v4l2 correctly.
2019-02-25 20:19:33 +01:00
Wim Taymans
d2c18c7b1a Improve async handling
Don't use special callback in node to receive the results. Instead,
use a generic result callback to receive the result. This makes things
a bit more symetric and generic again because then you can choose how
to match the result to the request and you have a generic way to handle
both the sync and async case. We can then also remove the wait method.
This also makes the remote interface and spa interface to objects very
similar.

Make a helper object to receive and dispatch results. Use this in the
helper for enum_params.

Make device use the same result callbacks.
2019-02-25 12:29:57 +01:00
Wim Taymans
98463b689b node: improve pending results
Make a special function for pending results to make it clear that it
is different from normal results. Don't pass result code to result
function, it is not useful because since the callback is called, all
must be fine.

The spa_pending is removed from the list right before the callback
and can thus be freed in the callback. Pass the spa_pending in
the pending callback so that extra data can be added that way.

Reuse spa_pending objects in link and nodes instead of allocating. We
always only have one pending operation and we can cancel any pending
previous operation by removing the pending.
2019-02-21 12:14:25 +01:00
Wim Taymans
7b12212eeb node: improve async handling
Remove the done and error callbacks. The error callback is in an
error message. The done callback is replace with spa_pending.

Make enum_params take a callback and data for the results. This allows
us to push the results one after another to the app and avoids ownership
issues of the passed data. We can then extend this to handle the async
case by doing a _wait call with a spa_pending+callback+data that will
be called when the _enum_params returns and async result.
Add a sync method.

All methods can now return SPA_RESULT_IS_ASYNC return values and you
can use spa_node_wait() to register a callback when they complete
with optional extra parameters. This makes it easier to sync and
handle the reply.

Make helper methods to simulate the sync enum_params behaviour for
sync nodes.

Let the transport generate the sequence number for pw_resource_sync()
and pw_proxy_sync(). That way we don't need to keep track of numbers
ourselves and we can match the reply to the request easily.
2019-02-21 09:40:12 +01:00
Wim Taymans
b743518f78 node: add props to add_port 2019-02-18 13:22:46 +01:00
Wim Taymans
eea062ee53 interfaces: improve remote API
Add return values to events and method callbacks. This makes it
possible to pass any error or async return value.
Add sync/done/error in both directions so that both proxy and resource
and perform/reply sync and produce errors.
Return a SPA_ASYNC from remote method calls (and events), keep the
sequence number in the connection.
With the core sync/done we can remove the client-node done method and
it's internal sequence number along with the seq number in method calls.
We can also use the method/event async return value to perform a sync
with as the unique sequence number for this method.
Add sync method and done/error event to proxy and resource.
2019-02-18 12:31:36 +01:00
Wim Taymans
e9bedae5fa node: add max_ports to node info 2019-02-14 17:40:01 +01:00
Wim Taymans
21957e9e8d node: Add port_info event
Add a port_info event. With this, we get updates to ports pushed to
us, which is more convenient and also allows for better dynamic
add/remove of ports.
We don't need to the PortChanged event anymore
We can remove the get_port_ids/get_n_ports/port_get_info methods.
Update plugins
2019-02-14 17:08:46 +01:00
Wim Taymans
3c78036a97 node: process -> ready
Change the process callback to ready to avoid confusion with the
process method and it also describes better what happened.
2019-02-14 17:04:59 +01:00
Wim Taymans
7a1bd163f7 node: remove port_send_command
We don't want to do this, we use a sequence to change things
at runtime.
2019-02-13 12:43:15 +01:00
Wim Taymans
04f1046113 node: pass struct to info callback to make it more extensible 2019-02-13 11:44:58 +01:00
George Kiagiadakis
4be52f16bd spa/support: implement ARM CPU detection
Code is based on PulseAudio's implementation, originally written by Wim
2019-02-13 11:22:57 +01:00
George Kiagiadakis
d9c2f77cfe spa/audioconvert: don't include xmmintrin.h in the non-sse fmt-ops
Fixes compilation for arm
2019-02-13 11:22:57 +01:00
George Kiagiadakis
99e1bb1068 meson: spa/plugins: don't check if the plugin dependencies have been found
If these optional plugins are enabled in meson options,
then the dependencies should be required to proceed.
It is not cool to compile with let's say bluez5 explicitly
enabled and after compilation discover that bluez was not
found and meson silently skipped that plugin.
2019-02-13 11:22:22 +01:00
George Kiagiadakis
d08ec09dde meson: spa/plugins: use pthread_lib instead of threads_dep
no need to refer to the same dependency with 2 different names
in the same codebase
2019-02-13 11:22:22 +01:00
Wim Taymans
ac5ec9bbe2 device: improve callbacks
Pass info structures to device callbacks to make it more extensible.
Also notify about the supported params on the device because we
can.
2019-02-13 11:13:46 +01:00
Wim Taymans
5de7898808 node: implement activation
Make an eventfd for each node and listen for events when the node
is activated.
Reorganize some graphs links to make it possible to activiate nodes
by signaling the eventfd
Pass the peer node to each remote node and let the remote node
directly activate the peer when needed.
Let each node signal the driver node when finished.
With this we don't need to go through the daemon to schedule the
graph, nodes will simply activate eachother. We only go to the
server when there is a server node to schedule.
Keep stats about the state of each node and the time it was
triggered, running and finished.
2019-02-12 17:42:33 +01:00
Wim Taymans
f45e0b8966 reorganize some struct members to remove holes 2019-02-08 12:01:50 +01:00
Wim Taymans
416bb2466d log: move field around to plug hole in structure 2019-02-07 12:28:16 +01:00
Wim Taymans
569cbb48a9 use SPA_EXPORT to export symbols 2019-02-06 13:24:41 +01:00
Wim Taymans
a563050797 spa: don't use constructor attribute to register factories 2019-02-06 12:14:25 +01:00
Wim Taymans
1baef2625c alsa: fix chmaps leak 2019-01-29 12:10:15 +01:00
Wim Taymans
e04560955d audioconvert: clean up nodes 2019-01-29 11:46:26 +01:00
Wim Taymans
30ecf66561 fmtconvert: check bounds on chunk offset/size 2019-01-25 13:32:35 +01:00
Wim Taymans
58f3146b60 v4l2: pass pointers to the fraction and rectangle 2019-01-25 13:32:35 +01:00
Wim Taymans
577852863c fmt: remove debug assert 2019-01-25 09:40:14 +01:00
Wim Taymans
13bf70a8dd mem: align memory to requested alignment
Improve the allocators to always align the buffer memory to the
requested alignment
Use aligned read and writes for sse functions and check alignment,
optionally falling back to unaligned path.
Add more tests and benchmark cases
Check and warn for misaligned memory in plugins.
2019-01-24 18:28:52 +01:00
Wim Taymans
dd66469570 audioconvert: add format conversion benchmark 2019-01-24 09:49:19 +01:00
Wim Taymans
6f586602af audioconvert: add unit test for format conversion
Add unit test for fmt conversion and fix some bugs
Add empty fmt-ops benchmark
2019-01-23 15:59:54 +01:00
Wim Taymans
351fb9ce29 pod: improve parser and builder
Remove the spa_pod_iter helpers
Remove builder/parser vararg recurse option, you have to
manually recurse into structures when needed. This simplifies
things a lot.
Pass spa_pod_frames to builder and parser explicitly, we don't
have to keep an internal stack anymore.
The parser is now almost a mirror image of the builder.
Make the parser safer when iterating over objects, add functions
to check and get pod contents in a safe way.
Make the builder return errno style results on errors
Improve performance of object properties when they are stored and
retrieved in the same order.
Add many more tests for the builder and parser
Add some benchmarks
2019-01-22 17:38:23 +01:00
Wim Taymans
b2bf69cc42 param: add some docs
Rename profile id to index because it better describes the property
2019-01-18 13:37:41 +01:00