Commit graph

163 commits

Author SHA1 Message Date
Wim Taymans
eb93f259e0 avoid some useless assignments 2020-05-20 15:24:25 +02:00
Wim Taymans
653ae96b20 pipewiresrc: set corrupted flag
See #72
2020-05-09 19:46:14 +02:00
Michael Tretter
52c14e2378 gst: keep track of queued buffers
Pipewire might update buffers that have not been recycled by GStreamer,
because they are still used downstream. There is nothing we can do about
it in the pipewiresrc.

If a buffer is sent downstream more than once, take an additional
reference to make sure that we don't queue a buffer that is still used
and print a warning.
2020-05-05 13:53:02 +00:00
Wim Taymans
5d12929153 gst: use the pw_stream queue
There is no need to keep a separate queue in the source, simply use
the one from pw_stream.
2020-04-23 13:01:03 +02:00
Michael Tretter
fd00d16361 gst: add properties for limits of negotiated buffers
By default, the pipewiresrc tries to negotiate 16 buffers. This value is
hard coded in the pipewiresrc. If the buffers are large, this could lead
to an undesirably high memory usage. Applications that know about the
buffer size and that fewer buffers are sufficient should be able to
configure the limits for the number of buffers that are negotiated.

Therefore, add the min-buffers and max-buffers properties to the
pipewiresrc to enable applications to configure limits for the number of
negotiated buffers.
2020-04-13 07:42:35 +00:00
Wim Taymans
7a29c15628 enable more warnings
Fix some warnings
2020-04-01 12:51:42 +02:00
Wim Taymans
c12f2276c4 stream: streams are always live for now. 2020-02-11 11:22:52 +01:00
Wim Taymans
043e7f24fe add some more useful defines
Add define to match all ids for nodes and params.
Add define for invalid permissions
2020-01-15 11:15:51 +01:00
Michael Tretter
dfa8011ed4 gst: fix log level of GStreamer debug messages
Messages that are printed for every buffer should use the LOG debug
level, while messages that happen during setup and tear down should use
the DEBUG debug level.

Therefore, use LOG in on_process and when popping buffers and DEBUG when
Pipewire adds or removes buffers.
2019-12-19 15:42:55 +01:00
Michael Tretter
d5b1ab9db4 gst: replace tabs with spaces
In general, the GStreamer elements use spaces for indentation. Replace
the tabs by spaces.
2019-12-19 15:42:42 +01:00
Wim Taymans
698ab911c3 loop: pass spa_dict to *_loop_new
Make the thread_loop alloc its own loop by default to simplify
some core. Add extra new_full method to pass a custom pw_loop.
Make other loop implementations ready to support custom loops
if we want that later.
2019-12-13 11:34:25 +01:00
Wim Taymans
ecc6b27cd7 rename core_proxy -> core
Rename core_proxy to core and move the introspect and interface
contents to core.h

In an effort to promote the proxy API.
2019-12-11 07:46:59 +01:00
Wim Taymans
8ea78c2e3f pw_core -> pw_context
The proxy API is the one that we would like to expose for applications
and the other API is used internally when implementing modules or
factories.

The current pw_core object is really a context for all objects so
name it that way. It also makes it possible to rename pw_core_proxy
to pw_proxy later.
2019-12-10 18:19:56 +01:00
Wim Taymans
8a959ea7a1 core_proxy: prepare to rename pw_remote -> pw_core_proxy
The pw_remote object is really a wrapper around the pw_core_proxy.
The events it emits are also available in the core proxy and are
generally awkward to use.

With some clever new pw_core_proxy_* methods and a pw_core_connect
to create the core_proxy, we can convert all code away from pw_remote.

This is a first step in this conversion, using the pw_remote behind
the scenes. It leaks into some places because it really needs to become
its own struct in a next step.
2019-12-06 11:48:40 +01:00
Wim Taymans
738603fd04 stream: Align with pw_filter
Remove some of the unused states in pw_stream. The app can know the
state by following the format and buffer events.

Make it possible to be notified of io are updates. This should make it
possible to follow the transport etc.

Make it possible to be notified of any param changes.

Rename finish_format to update_params because that is what it does.
Make this work in the same was as the filter: updating the params
removes all old params of the types and installs the new ones.

Don't get the Props and PropInfo from the node proxy, instead get them
directly from the adapter that we have locally. Update the controls
directly on the adapter instead of going to the server first.
2019-11-21 16:14:50 +01:00
Wim Taymans
9ffec214b8 fix includes 2019-10-25 15:01:02 +02:00
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
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
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
9a842e4643 pipewiresrc: actually use the fd when set 2019-05-07 14:53:53 +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
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
979d155382 core: add user_data to core 2019-01-08 17:32:37 +01:00
Wim Taymans
e918f9f77c fix sign confusion 2019-01-07 15:52:42 +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
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
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
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
f0a1ab993f gst: keep track of clock time
Invalidate the clock when the stream is destroyed and let the new
clock take the time of previous clock when no timing info is
available.
2018-08-14 14:32:57 +02:00
Wim Taymans
21a79241ed pipewiresrc: fix refcounting of buffers 2018-08-14 14:29:44 +02:00
Wim Taymans
3f45ccd6a5 gst: update to current API 2018-07-08 15:23:28 +02:00
Wim Taymans
8481356f4b stream: add const to format event 2018-04-03 16:29:36 +02:00
Wim Taymans
f9ceedb714 stream: improve stream API
Simplify the stream API. make just 2 methods to queue and dequeue
buffers. Make just one callback when new buffers can be dequeued.
Add support for driver nodes such as the video-src.
Pass a pw_buffer structure to add/remove_buffer and make it possible
to attach metadata to it. This makes it a lot easier to implement
the gstreamer pipewire pool.
Call the stream process function from the main loop and use a lockfree
ringbuffer to pass buffers between the threads. Make it possible to
also call process from the RT thread.
unmap the buffer data when needed.
2018-04-03 16:29:36 +02:00
Wim Taymans
d841e0f778 pipewiresrc: use the right allocator for dmabuf
Use the dmabuf allocator when we get dmabuf memory.
https://github.com/PipeWire/pipewire/issues/31
2018-02-08 12:24:23 +01:00
Jonas Ådahl
f2aafffb2c gstpipewiresrc: Add fd parameter
Will be passed to a pw_remote_connect_fd() instead of plain a
pw_remote_connect() call.
2018-01-23 10:19:25 +01:00
Wim Taymans
e2c49199f6 link: fix param enumeration
When the input port param enumeration has no result, use the NULL
filter to still enumerate the output port parameters instead of
returning nothing.
Fix the offset in the gst element.
2017-11-24 16:48:13 +01:00
Joakim Johansson
47086cd9ee gstpipewiresrc: Fix id in param for buffer and meta 2017-11-24 09:02:04 +01:00
Wim Taymans
4288a634f4 buffer: don't use ringbuffer in chunk
We can't use a ringbuffer on the chunk because it implies the
consumer would write to it to update the read position, which we
can't do because the chunk is read-only and might even be shared.
Go back to offset/size pairs, which can sortof do the same thing
if we want later when we keep a non-shared read pointer in the
consumer.
Keep alsa timestamp around and filled state for future.
mmap the input port meta/data/chunk as read-only.
Only do clock update requests when asked.
2017-11-21 12:42:27 +01:00
Wim Taymans
5bebfe022b cleanups
Follow the data/size argument order convention to make the api
more consistent.
2017-11-20 15:26:44 +01:00
Wim Taymans
2fd5bcb623 gst: fix gstreamer elements
Handle new ringbuffer area on buffers
Set the id correctly for format enumerations.
2017-11-20 11:04:02 +01:00
Wim Taymans
440f681f4b Improve enum_param
Add an argument to pass the result param to the caller instead of
having the caller have to pick it up from the builder.
Improve docs for node, clock and monitor
Pass spa_pod everywhere instead of spa_pod_object.
Pass result argument to spa_pod_filter to make things a little
nicer.
2017-11-13 17:57:38 +01:00
Wim Taymans
6fb0f580ea Use errno for result errors
Make new enumeration for data transport status and use errno
style error numbers for errors.
2017-11-13 09:41:41 +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