Commit graph

158 commits

Author SHA1 Message Date
Wim Taymans
c9855763c3 remote: always close the fd in connect_fd
Not closing the fd causes leaks in existing apps. It's probably better
to always close it and let apps deal with that by using dup or similar.

Make gst sink and source dup the fd before connect_fd().

Fixes #181
2019-09-10 11:05:38 +02:00
Wim Taymans
8db4a797aa core: remove parent_id from the global event
Remove the parent_id from the global event. Remove the parent
and owner from the global object.

Use properties instead to mark parents and owners of objects.

Properties are easier to control for client exported objects and
usually a simple parent/child is not enough. For example, a client
exported node has the client as a parent but also the factory that
created the node.
2019-08-16 22:11:42 +02:00
Wim Taymans
c6a7b3eedb channelmix: implement per channel volume
Implement per channel volume on channelmix. Extend control on stream to
take an array of values when possible.

Remove name argument from pw_node_new and pw_device_new. We can pass
this as a property instead.

Improve properties on nodes to more closely match what pulseaudio does.
Don't let the monitor do too much with the udev properties but let the
session manager set the description and icon-names.

Remove some change_mask flags for things that don't change in
introspect. Use the flags to mark changes in -cli and -monitor.
2019-08-12 15:14:39 +02:00
Wim Taymans
00ea15dc1f improve error handling 2019-06-19 16:22:22 +02:00
Wim Taymans
009a33668b make property for monitors 2019-05-31 16:47:37 +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
Michael Olbrich
c79a30bd8a gstpipewiresrc: clear timestamps when processing a buffer
This is necessary for 'do-timestamp' to work if the source provides no
timestamps. Without this, the timestamp from the first use will remain,
because the basesrc only overwrites timestamps that are
GST_CLOCK_TIME_NONE.
2019-05-23 10:15:43 +02:00
Wim Taymans
58fa5561b8 interface: get_registry always returns a Registry type 2019-05-21 15:46:31 +02:00
Wim Taymans
6ee192dff5 hooks: use hook to implement the callbacks
This way we get the version check implemented and save some
code.
2019-05-15 11:19:23 +02:00
Wim Taymans
9a842e4643 pipewiresrc: actually use the fd when set 2019-05-07 14:53:53 +02:00
Wim Taymans
bb3da2fcc1 remote-node: reuse activation logic in pw_node
Set the received eventfd as the node eventfd and let existing
logic take care of scheduling the node.
2019-04-17 15:23:11 +02:00
Wim Taymans
787900e8bf v4l2: map all jpeg formats to video/mjpeg 2019-04-10 17:10:34 +02:00
Wim Taymans
4faa28fd96 gst: handle clock reset
The clock time is reset to 0 after a new format is negotiated. Make sure
the time reported by the gstreamer clock is increasing in this case.
2019-03-11 15:09:28 +01:00
Wim Taymans
3281737199 link: keep per link buffer negotiation state
Keep buffers cached on output ports.
Complete the link to PAUSED when we have negotiated buffers on
input and output.
2019-03-11 12:35:04 +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
f2ff6f393b more async improvements
Make the sequence number an int.

Keep track of the last received seq number and pass it in error
replies.

Pass seq in for_each methods.
2019-02-25 16:25:27 +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
George Kiagiadakis
ba653fccfc add .editorconfig files
These files help editors choose the correct coding style
conventions, mostly useful for the indentation style

Pipewire uses tab characters of size 8 in all of its codebase
except in the meson files and in the gstreamer plugins,
which use 2-space indentation
2019-02-13 11:19:21 +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
2622e085a9 pod: add more helpers
Implement more unit-tests
2019-01-17 17:23:47 +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
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
349a11cde5 add const to info 2019-01-09 17:49:45 +01:00
Wim Taymans
1ed27a8f2b add _GNU_SOURCE as compiler flag 2019-01-08 17:36:58 +01:00
Wim Taymans
979d155382 core: add user_data to core 2019-01-08 17:32:37 +01:00
Wim Taymans
b0f4be5fbc fix more compile errors
Avoid void * arithmetic
Do explicit casts to target type to make c++ happy
2019-01-08 11:53:36 +01:00
Wim Taymans
e918f9f77c fix sign confusion 2019-01-07 15:52:42 +01:00
Wim Taymans
54f527ac02 introspect: remove ENUM_PARAM change
Remove the ENUM_PARAM change bit, we want to do this with a specific
event later that would allow us to specify which params changed etc.
2018-11-28 17:31:00 +01:00
Wim Taymans
088ee9f09e Improve TIMESPEC_TO_TIME
Add explicit TO_NSEC and TO_USEC versions to make it clearer and to
allow for some optimizations.
2018-11-07 09:56:24 +01:00
Wim Taymans
85f2e93c54 Relicense as MIT/X11
Remove some obsolete files
2018-11-05 17:48:52 +01:00
Wim Taymans
b905b70a76 stream: pass target id as uint32_t 2018-11-02 11:52:39 +01:00
Wim Taymans
aeb77e37f7 gst: don't dup, use DONT_CLOSE flag on fd_allocator 2018-10-31 09:36:19 +00:00
Wim Taymans
7186bd2583 gst: remove old format id conversion code 2018-10-16 17:13:27 +02:00
Wim Taymans
627dfa3da2 fix some leaks
Make pw_get_client_name() return a static string.
Unload the dbus interface. Rename the method to make it more obvious
that the interface needs to be unloaded.
Free module properties
Free remote objects and types
Free stream params and the array
2018-09-19 13:38:39 +02:00
Wim Taymans
5196f7f053 audio: remove layout from audio
Make special format types for planar and interleaved instead of
having a field.
Add enum for audio channel positions
Add some default audio channel layouts
Place the channel layout in the audio format when possible
alsa: place audio channel positions in format
Add sse optimized channel mixing for some common cases
Remove name from port info, it's not mandatory and in the properties
Add direction to port info
2018-09-13 17:03:56 +02: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
ff6a244d8f Make media type and subtype properties
This is easier to debug and we only want properties in objects
in the future.
2018-08-29 18:08:52 +02:00
Wim Taymans
80de83f38a format: make helper function to parse media type 2018-08-29 14:50:58 +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
a7807ef1c5 pipewiresrc: hack live source for now 2018-08-15 21:35:02 +02:00
Wim Taymans
d181574520 gstpipewiresrc: cleanups
Clear the stream after we remove it from the clock.
2018-08-15 21:30:43 +02:00
Wim Taymans
a3e4c6df99 gst: improve buffer params 2018-08-15 21:29:40 +02:00
Wim Taymans
009f23abaa gst: interpollate clock times 2018-08-15 21:28:21 +02:00
Wim Taymans
0f66716de9 gst: avoid clock overflow 2018-08-15 15:51:35 +02:00
Wim Taymans
921b613cca pipewiresink: improve driver mode 2018-08-15 13:46:40 +02:00