Commit graph

78 commits

Author SHA1 Message Date
Wim Taymans
8590ac158b node: add flags to port_use_buffer
Remove the CAN_USE_BUFFERS flag, it is redundant. We can know this
because of the IO params and buffer params.

Add flags to the port_use_buffer call. We also want this call to
replace port_alloc_buffer. Together with a new result event we can
ask the node to (a)synchronously fill up the buffer data for us. This
is part of a plan to let remote nodes provide buffer data.
2019-07-25 13:19:39 +02:00
Wim Taymans
e1cbdaed0b remote: add option for extra user data for proxy
When doing an export, make it possible to add extra data to the
resulting proxy for user data.
2019-05-30 16:11:31 +02:00
Wim Taymans
857b2a0cfb spa: add result type
We need this to know the type of result, especially when serializing.
2019-05-28 13:59:48 +02:00
Wim Taymans
3ad73f0532 keys: add keys.h with defines and docs
Add a keys.h file that lists and documents all keys available to
be used in properties.
2019-05-24 15:47:48 +02:00
Wim Taymans
ff946e3d4b interface: add an interface struct
The interface struct has the type,version and methods of the
interface.
Make spa interfaces extend from spa_interface and make a
separate structure for the methods.
Pass a generic void* as the first argument of methods, like
we don in PipeWire.
Bundle the methods + implementation in a versioned inteface
and use that to invoke methods. This way we can do version
checks on the methods.
Make resource and proxy interfaces that we can can call. We
can then make the core interfaces independent on proxy/resource and
hide them in the lower layers.
Add add_listener method to methods of core interfaces, just
like SPA.
2019-05-23 12:59:24 +02:00
Wim Taymans
a564d9f3f1 Move implementation helpers to utils 2019-05-20 10:14:00 +02:00
Wim Taymans
7281a2b2cf export-sink: update port params 2019-03-04 15:17:46 +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
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
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
31dacd9d6f remote: move node export code to client-node module
Make the code to export objects more generic. Make it possible for
modules to register a type to export.
Make the client-node also able to export plain spa_nodes.
Let the remote signal the global of the exported object if any. We can
then remote the (unused) remote_id from the proxy.
2019-01-31 11:02:13 +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
5376832676 builder: control_header -> control 2019-01-17 17:11:58 +01:00
Wim Taymans
80cfda89c1 pod: improve the vararg pod builder and parser
Automatically parse and build key/value when in objects without having
to prefix the key with ":"
Automatically build control/value when in sequence without the "."
prefix.
Remove the builder with key/pod, taking a reference to the stack built
temporary pods is not allowed in c++. We can use the varargs version
with the same convenient syntax.
Remove the parser "*" option, it is unused.
Improve spa_pod_builder_add_* and spa_pod_parser_get_* and make them
look similar.
2019-01-16 11:05:12 +01:00
Wim Taymans
3dc6820e9e Don't use __ in defines or declarations, it's reserved
SPA_TYPE -> SPA_TYPE_INFO for type info strings
improve includes

Fixes #115
2019-01-14 13:00:00 +01:00
Wim Taymans
1a27d7da1d interfaces: remove core permissions
Use the client update_permissions call instead
2019-01-10 11:09:05 +01:00
Wim Taymans
66bab1d9b2 remote: remove some events
Remove some events from the remote that we can find on the core_proxy.
Use the core_proxy to get to the done and info events.
Remove pw_remote_get_core_info(), we don't need this anymore now that
we don't listen for the event and the user can keep track of this
herself.
2019-01-10 10:08:14 +01:00
Wim Taymans
979d155382 core: add user_data to core 2019-01-08 17:32:37 +01:00
Wim Taymans
bf6843743a export-sink: implement set_io 2018-11-06 15:21:53 +01:00
Wim Taymans
85f2e93c54 Relicense as MIT/X11
Remove some obsolete files
2018-11-05 17:48:52 +01:00
Wim Taymans
eb0a561f8c permissions: pass pw_permission struct around
Use a pw_permission struct to express permissions of object.
Improve client permissions, add/remove globals when permissions
are changed.
2018-11-05 15:02:08 +01:00
Wim Taymans
cc842cbdc8 Type changes
Only allow properties inside objects, this makes it easier to
iterate the object, which is needed for efficiently processing
control streams.
Add a choice type to mark variable properties.
SPA_TYPE_Enum -> SPA_TYPE_Id to avoid confusion with choice enum
Make it easier to allocate and initialize properties on the stack
Make more efficient methods to make objects.
2018-09-05 16:41:07 +02:00
Wim Taymans
05d3502c84 control: rework for spa_io_sequence
Put a pw_control object on all ports that support control messages.
Allow linking of control objects (and thus ports).
Make export-sink generate control messages to update the contrast
property.
2018-08-30 09:54:54 +02:00
Wim Taymans
514528f2c7 format: make helper functions to create formats
Use helper functions to create a fully specified format.
2018-08-29 15:53:26 +02:00
Wim Taymans
90c1a95eef More type cleanups
SPA_ID_* -> SPA_TYPE_*. We use 'type' for all registered types.
ID refers to either a registered type or an enum.
Improve introspection of object ids. Make 0 an invalid enum and
use it to look up the object id type.
Move some type-info files together.
Swap type and id of the object, we first specify the type and then
the id because the meaning of the id depends on the object type.
2018-08-27 15:03:11 +02:00
Wim Taymans
d26aecfef2 More type fixes
Param ids and IO ids are now simple enums.
Move some type info in one place, delete some type-info files
Fix type debug
Make audio layout an enum
Mark more enums as enums in types so they show us with their names in
the debug.
2018-08-25 12:08:29 +02:00
Wim Taymans
fca3e1d85d Remove dynamic types
Do not use dynamic types anymore. The reason is that it's difficult:

- to maintain a shared type database over a network.
- the extra overhead when translating between processes and for
  maintaining the translation tables.
- race conditions in translating in RT-threads, this is a problem
  because we want to make event streams.

We now have simple enums with types and extension points for all
types. This is also nicer to use in general.
We don't need the mapper anymore or pass strings around as types.
There is a parallel type info system to get more info about ids and
enums and their hierarchy. It can also be used for debugging.
2018-08-23 17:47:57 +02:00
Wim Taymans
a6ad8f747f remove spalib 2018-08-14 15:29:25 +02:00
Wim Taymans
fdc3d5c0f7 export-sink: be less verbose
Only report region once and only accept 1 region
2018-07-09 12:14:01 +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
710f0f59cf limit buffers to 16 until we can send more fds in one message 2018-07-02 12:04:38 +02:00
Wim Taymans
10fff4b2f8 node: add better node autolink
Add node media, category and role properties and use those to select
the target node.
Tag the DSP node with the right media.class
2018-04-12 09:55:03 +02:00
Wim Taymans
36f7578aa8 export-sink: small cleanup 2018-04-03 16:29:36 +02:00
Wim Taymans
41a3a924ef stream: add pw_stream_new_simple
Make a new method that also makes a remote and connects to it
transparently. This saves some lines of code.
2018-04-03 16:29:36 +02:00
Wim Taymans
9b0a880afb simplify things with just 1 process function
Make just one process function in spa node. With the io area states
we can do more complicated io patterns.
2018-04-03 16:29:36 +02:00
Wim Taymans
d655d9e0bf export-sink: don't block for render
Pass the buffer to the render function in the main thread but don't
block the data thread
2018-03-14 14:54:36 +01:00
Wim Taymans
6f61ac9357 fix some signed vs unsigned comparisons 2018-02-20 18:19:11 +01:00
Wim Taymans
0e5a1b6327 props: use macro for property alternatives 2018-02-20 09:36:05 +01:00
Wim Taymans
f2f94c4f72 examples: handle NULL io areas 2018-02-13 10:16:55 +01:00
Wim Taymans
60177646e9 examples: remove some unused types 2018-02-09 12:03:28 +01:00
Wim Taymans
06ba8c9a7e export-sink: change contrast property 2018-02-07 18:16:01 +01:00
Wim Taymans
ab099d09dd permissions: check permissions more
Pass client to some core functions to make it possible to check
permissions when iterating globals.
Check permissions of factory before using it.
Check permissions in link factory, only allow linking of nodes we can
see.
Check permissions in the autolink module, only try to link to nodes
we can see.
Make client permissions update behave like an atomic update of an
unordered set of permissions, which is perhaps a bit more intuitive.
2018-01-24 10:42:40 +01:00
Wim Taymans
c593d868fb global: add properties
Add properties to global objects to make it easier to select what
nodes and objects to bind too. They can also be used to implement
permissions on the globals based on properties.
Add more error handling in _register.
Make more functions return a result code.
Make a separate pw_module_register, like all other objects.
2018-01-19 11:27:54 +01:00
Wim Taymans
47dd97049c examples: also handle SDL events in main-thread 2018-01-18 15:49:56 +01:00
David Svensson Fors
0b523e4334 SDL examples: all SDL operations in one thread
Fix video in SDL examples by invoking rendering in the same thread
(pw_loop) that created the window, renderer and texture.

At least on some systems, no video is shown without this patch. In
those error cases, SDL_RenderPresent triggers an SDL error "The
specified window has not been made current". That, in turn, has to do
with how SDL uses the current thread for determing the current window.
In general, the page linked to below states that the SDL API is not
designed to be used from multiple threads.

Reference: https://wiki.libsdl.org/CategoryRender
2018-01-18 15:43:46 +01:00
Wim Taymans
a9ece1df91 export-sink: add an example permission call 2017-12-14 18:53:05 +01:00