Commit graph

14 commits

Author SHA1 Message Date
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
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
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
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
85f2e93c54 Relicense as MIT/X11
Remove some obsolete files
2018-11-05 17:48:52 +01:00
Wim Taymans
a6ad8f747f remove spalib 2018-08-14 15:29:25 +02:00
Wim Taymans
a63523650d hooks: enforce version on hook emission
Pass the minimum required version to the hook emission and only call
events when the handler is recent enough.
Add some macros to make event emission easier to read.
2018-08-01 21:41:25 +02:00
Wim Taymans
1f73143d55 connection: improve some return values 2018-04-19 20:04:25 +02:00
Wim Taymans
101d2af1be connection: signal errors 2017-11-13 11:33:07 +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
600055bd68 Move listeners to spa and rename to hooks
The listeners are generally useful in spa, move it there and rename
to hooks. Implement loop hooks with it.
Fix some cleanup issues in stream and remote
2017-08-08 16:56:29 +02:00
Wim Taymans
1b79419554 cleanups
Remove signals.
Rename callbacks -> events, use listeners to listen for events.
Callbacks are still used in spa for things you can listen to only
once.
2017-08-04 16:49:13 +02:00
Wim Taymans
465f12241e Implement protocol extensions
Add hooks that contain protocol specific interfaces that can be used
to extend the protocol. This makes it possible to add new interfaces
to the protocol and implement the protocol specific data transport.
Move these protocol specific extension to the extensions directory.
2017-07-12 18:04:00 +02:00
Wim Taymans
d1655196c3 move things around 2017-07-11 16:08:22 +02:00
Renamed from pipewire/modules/module-protocol-native/connection.h (Browse further)