Commit graph

45 commits

Author SHA1 Message Date
Pauli Virtanen bbc2136e89 meson: ensure all examples are included in doc
Move declaration of examples to use same file lists for build and docs.
2021-11-02 09:46:14 +00:00
Pauli Virtanen 98a0e54d5f doc: link examples to Doxygen docs
Include examples to the documentation, using Doxygen's example system.
2021-10-10 00:35:46 +03:00
Peter Hutterer 0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Peter Hutterer 92514d57e4 treewide: replace plain strcmp() calls with spa_streq 2021-05-18 22:10:27 +10:00
Peter Hutterer 2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Peter Hutterer 223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Thibault Saunier 485bae5eb0 meson: Use feature options everywhere it makes sense 2021-03-10 20:18:34 +00:00
Wim Taymans 5295caf0f3 examples: dlclose on some errors 2020-07-02 16:07:54 +02:00
Wim Taymans f08c35259c avoid uninitialized variables 2020-06-23 15:25:27 +02:00
Simon McVittie b852b58f82 Optionally install examples and tests
This makes it easier to test PipeWire in its "as-installed" state,
for example in an OS distribution.

The .test metadata files in ${datadir}/installed-tests/${package} are
a convention taken from GNOME's installed-tests initiative, allowing a
generic test-runner like gnome-desktop-testing to discover and run tests
in an automatic way.

The installation path ${libexecdir}/installed-tests/${package} is also
a convention borrowed from GNOME's installed-tests initiative.

In addition to the automated tests, I've installed example executables
in the same place, for manual testing. They could be separated into
a different directory if desired, but they seem like they have more
similarities with the automated tests than differences: both are there
to test that PipeWire works correctly, and neither should be relied on
for production use. Some examples are installed in deeper subdirectories
to avoid name clashes.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-16 17:58:02 +00:00
Simon McVittie 8b97d2ae74 spa examples: Load plugins from SPA_PLUGIN_DIR or installed path
This lets them be used installed or uninstalled, like pipewire itself.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-16 17:58:02 +00:00
Wim Taymans 0b47b47b6c libcamera: disable by default
Until it is at least more comon available in distros.
2020-06-04 10:50:54 +02:00
raghu447 9024cc4444 Integrating libcamera 2020-06-04 10:36:39 +02:00
Wim Taymans 0a54249718 fix error reporting
dlopen and dlsym don't set errno
2020-05-12 17:23:30 +02:00
Wim Taymans 4cb2d58e89 factory: do more version checks
So that we don't accidentally load an old plugin.
2020-04-22 18:10:26 +02:00
Wim Taymans 5da6973863 example: fix buffer check 2020-03-19 12:58:39 +01:00
Wim Taymans a528189d26 slave -> follower
We use master/follower terminology everywhere.
2020-02-21 10:47:32 +01:00
Wim Taymans 4bd6f5a055 examples: fix some typos and indentation errors 2020-02-04 13:02:38 +01:00
Julian Bouzas a5d17ba6d1 spa: add adapter-control example to test audioadapter nodes
Example executable that runs an output audioadapter using audiotestsrc as slave
with an input audioadapter using alsa-pcm-sink as slave for easy testing.
2020-02-04 12:00:27 +01:00
Julian Bouzas 1eba8d7f74 spa: add support system so that example-control can play audio
The example-control executable does not play audio. This is because
alsa-pcm-sink needs a data system to run. This patch fixes the example by
loading a data system from libspa-support before creating the nodes.
2020-02-04 11:55:28 +01:00
Wim Taymans ac24743b2e the epoll shim should only be used by the system library.
All other places should use the system library to get the right
fds.
2019-11-19 15:16:18 +01:00
Gleb Popov fd937fa378 On FreeBSD, add dependency on epoll-shim library.
FreeBSD doesn't provide timerfd and eventfd functions. These are implemented in
3rd party library called epoll-shim. Link targets requiring these functions to
this library.
2019-11-19 13:41:40 +01:00
Wim Taymans 9ffec214b8 fix includes 2019-10-25 15:01:02 +02:00
Wim Taymans 59bf522ce1 system: use the same bits as POLL and EPOLL
Use the same bits for the io mask as POLL and EPOLL so that we
can avoid conversions.
2019-09-19 13:15:38 +02:00
Wim Taymans 4381e79632 control: clean up some control includes
Remove control from channelmix, it's not used
Add control metadata
Add OSC control type
Improve some docs
2019-09-16 15:49:46 +02:00
Wim Taymans 8b85cc225e rename HAVE/NEED_BUFFER -> HAVE/NEED_DATA
It is more generic and works with control-only ports as well
2019-09-16 12:55:23 +02:00
Wim Taymans 6f16d6ff8e example: remove some unused fields 2019-08-16 15:02:48 +02:00
Wim Taymans dff1cfe13e fix example 2019-08-15 19:07:03 +02:00
Wim Taymans e76a7abceb Add support for client fd memory
Remove the node buffers reply again. We don't need it. Instead add a
new method to the client-node to upload an array of buffer datas.
This method is called after the client has allocated buffer mem. It
will update the buffers on the server side with the client allocated
memory.

Wait for the async reply of use_buffers when doing alloc_buffers so
that we can get the updated buffer mem before we continue.

Let the link follow the states of the ports.

Add some error code to the port error states.

Add PW_STREAM_FLAG_ALLOC_BUFFERS flag to make the client alloc buffer
memory.
2019-07-26 16:17:39 +02:00
Wim Taymans deb6c52f76 node: remove port_alloc_buffers
Remove the now obsolete port_alloc_buffer, rework to use the
port_use_buffers with the ALLOC flag.
2019-07-25 14:08:43 +02:00
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 9934e62fe4 don't use error() 2019-06-21 16:14:36 +02:00
Wim Taymans 6720ded529 names: add standard factory name definitions
Define a set of standard factory names and document what they
contain. This makes it possible to change the implementation by
mapping the factory-name to a different shared library.
2019-06-21 13:31:34 +02:00
Wim Taymans 86dc0496a5 simply use INTERFACE_Loop for the main-loop 2019-06-06 15:20:43 +02:00
Wim Taymans 1d1f035e78 monitor: return factory_name in the object_info
Pass a factory_name in the object_info of monitor and device.
Restructure the factory name to mean something functionaly. With
the factory to library mapping this then means that the implementation
of certain factories can be configured in the config file.
2019-05-31 15:06:44 +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 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 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 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 cbdc024f4c example: remove unused variable 2019-02-14 16:01:16 +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 3ee463ed3a spa: Update tests and examples
Keep tests in spa/tests
Make spa/examples
Remove some old examples
2019-01-17 09:27:41 +01:00