Commit graph

51 commits

Author SHA1 Message Date
Wim Taymans
4148e0ff78 cleanups:
Keep lock while doing recycle_buffer
Pass context to main loop
Recycle WorkItems in a free list
Push and pull from the node data loop
Do async start/pause in alsa
Add alsa fds right after open.
2016-10-25 11:21:53 +02:00
Wim Taymans
73e6272488 node: keep separate array of links
Keep a separate array with the links that we only access and update from
the data-thread.
2016-10-24 18:01:04 +02:00
Wim Taymans
d3dd90bb05 simplify events and commands 2016-10-24 15:30:15 +02:00
Wim Taymans
0373f73bac Add invoke method to schedule executing in a main loop 2016-10-24 12:20:44 +02:00
Wim Taymans
1bd751372e Cleanups
Remove unused events, drained and marker can be done with
ASYNC_COMPLETED messages
Handle result of idle callback to disable the poll item
Identify poll items with a unique id.
Remove set_state vfunc
push_event -> send_command, commands are to do something, events are the
result of something.
Add poll item in v4l2 as soon as we have the fd but disable the item
until streaming starts.
2016-10-21 15:03:32 +02:00
Wim Taymans
9b2b4b9b5c cancel pending defers 2016-10-20 19:36:26 +02:00
Wim Taymans
8fac22afdb Work on main loop
Make a main-loop object with associated helper functions to handle async
methods.
rtloop -> data_loop
Handle async results a lot better.
Remove REMOVE_MEM command. We don't need it.
Handle stream memory updates better.
2016-10-20 16:36:29 +02:00
Wim Taymans
98dbb6424d Cleanups
spa_serialize -> pinos_serialize
Improve PinosPort, move links to the object and make it part of
PinosNode
Work on improving signals to react to changes in the graph
Error when a client-node becomes unlinked, like when removing a camera.
2016-10-19 17:18:30 +02:00
Wim Taymans
82414810e8 avoid deref
We can avoid a deref when we use container_of to get from the interface
to the handle.
2016-10-12 17:27:29 +02:00
Wim Taymans
2905d91467 Add poll interface and remove poll events
Use an interface to change items in a poll loop.
2016-10-07 17:10:46 +02:00
Wim Taymans
fc4fd1424a Add mapper
Ger rid of static ids for interfaces and replace with something we can
register dynamically
Implement logger.
2016-10-07 13:19:50 +02:00
Wim Taymans
d828073bb8 Add port direction again
simplify port numbering again by using 0->max_ports for bot input ports
and output ports. This means we need to tall what direction the port is.
Add port_info serialize functions
Copy metadata and data when we are not sharing buffers.
Make pinossink work again.
2016-10-03 19:48:24 +02:00
Wim Taymans
b208e8b690 Plug some leaks
Add maxsize to bufferdata in case the memory size can be variable such
as with encoded formats. Copy new size in the proxy.
2016-09-30 19:56:41 +02:00
Wim Taymans
9d4048e73a Enable header metadata
Enable the header metadata so that we have timestamps again.
Rework allocation in the link a little. Reuse previously allocated
buffers when possible. Keep track of where the buffers was allocated.
Make some more convenience functions to initialize buffer headers. Make
it so that we move allocations to the app.
Make some helpers to make memfd memory in pinos now that we will be able
to do all allocation there.
2016-09-30 17:07:38 +02:00
Wim Taymans
24108e01c1 mem: remove memory stuff
Remove the memory stuff from the spa API, we can do thing more simple
and efficiently if we always allocate buffers outside of the plugins and
only implement an alloc function on the node when it can do something
clever.
Move serialize code to the props/format/buffer code
Make it possible to copy a format and properties.
2016-09-29 18:18:59 +02:00
Wim Taymans
fe37e2bc1b Make PinosPort struct
Keep track of the ports, their links and the allocated buffers in a
small struct managed by the node.
2016-09-28 10:42:36 +02:00
Wim Taymans
c6861845a7 pass the client object around
Pass the client object around, it's easier to deal with than the sender
id.
Fix the ASYNC return check
Don't overwrite the fds of a pollitem, instead keep an index of their
position in the global fd array.
2016-09-27 16:59:45 +02:00
Wim Taymans
7b53fa8685 rt-poll: make small poll helper object
Remove the event loop code into a separate object so that we can share
the same loop for multiple nodes.
Some cleanups
2016-09-26 17:27:04 +02:00
Wim Taymans
67dd3adb87 port to meson 2016-09-26 12:15:52 +02:00
Wim Taymans
1ba10cf848 Remove some events
Remove port added and port removed, we can get that info by inspecting
the port ids.
Remove data from ringbuffer, we just need the ringbuffer to keep track
of the read and write positions.
Handle async-complete in the main thread
Work on async node initialization
Work on using a queue as the link between nodes
Make the daemon link things based on the node states
Use queue helper in v4l2
2016-09-23 17:08:20 +02:00
Wim Taymans
68148188fa Add support for async results
Add an async result code and an event to signal the completion.
Use async return values to signal completion of a method and potential
state change.
Add selected format to port update message.
Make it possible to parse into a custom copy of the command memory.
Remove state change events from the elements, we now just update the
state.
Implement async results in the proxy element
Add support for removing buffers in the client.
Fix up pinossink
Deal with async return in the links.
2016-09-22 09:08:44 +02:00
Wim Taymans
4b83d6cfc8 videotestsrc: remove threads
Remove the threads from the element and use timerfd to schedule timeouts
Propagate live flag between node links
2016-09-19 19:17:59 +02:00
Wim Taymans
2bf322ee71 Handle error cases
Add a link state
Add error quark
Track the state of node we create and error when it is in error.
Handle stream error states when negotiating
Make the node error when a link is in error
2016-09-16 13:13:41 +02:00
Wim Taymans
6497c82a7d Use v4l2 monitor
Use the v4l2 monitor to dynamically add and remove nodes.
Use the info from the monitor as parameter for the factory init and use
it to configure the new node.
Add info to the node.
Use info from the factory as properties on the PinosNode
2016-09-15 17:51:34 +02:00
Wim Taymans
b75d9786d4 pinossrc: handle latency and liveness
Use NULL filter when the port format enumeration returns nothing.
Send clock update even when there is no clock.
Don't send data to a port when the node is not streaming
Add latency support to the clock update
Copy the unset_mask when copying the formats
2016-09-13 17:43:57 +02:00
Wim Taymans
021eccb8ad Fix stream restart
Make sure we always send a clock update before sending a start command.
Fix memory size.
Follow the state of the node to do allocation
Use the pinos node to control the state
When doing STREAMOFF, all buffers will be dequeued. requeue them buffers
for when we go to playing again.
2016-09-13 10:34:32 +02:00
Wim Taymans
e34ef88dac node: add port_id
Decouple the SPA port ids from the pinos port ids, this allows us to
more easily link and relink things and do dynamic connection later.
Implement multiple output ports on a pinos node.
2016-09-12 18:29:59 +02:00
Wim Taymans
36bcdaa4bc improve state change 2016-09-12 15:25:53 +02:00
Wim Taymans
f86b50d202 add clock
Add a gstreamer pinos clock that reports the time at the server
2016-09-12 12:28:51 +02:00
Wim Taymans
0b380dd43e Add suport for clocks
Add a clock interface to get raw clocking information from an element
Make events and commands to request and configure clock updates.
Add support for passing events and commands in control
Set the size of the buffers in pinossrc
2016-09-09 16:05:58 +02:00
Wim Taymans
8ada6736c0 Cleanups
Make events and command specific to the node
Remove some unused code
Improve state changes
Use easier fixate by just taking the element default value
Fix reuse buffer in the proxy
2016-09-06 16:43:37 +02:00
Wim Taymans
ac3cd24d5c Fix REMOVE_POLL 2016-09-05 16:40:07 +02:00
Wim Taymans
7aa79a2a0d Add audiotestsrc
Work on idle poll
Move node state to the node interface so that we can actually get it in
the sync case.
Add enabled field to the poll event
Work on audiotestsrc
2016-09-05 16:23:40 +02:00
Wim Taymans
52e45cf2a1 more cleanups 2016-09-02 20:09:13 +02:00
Wim Taymans
7d3e46e7f9 Remove port
Remove the port object. We don't use it as a dbus object and we don't
need it, we can use the link and node object directy.
Move poll code and event handler to the node.
2016-09-02 19:51:23 +02:00
Wim Taymans
463954a299 cleanups
Remove some unused things.
Work on shutdown.
2016-09-01 10:04:25 +02:00
Wim Taymans
9485bd77e7 Remove direction
Direction is tied to the port id.
Handle nodes with fixed ports.
2016-08-29 18:31:53 +02:00
Wim Taymans
ca7d08c406 Work on sink
Remove _remove from properties, we can do the same with set of a NULL
value.
Add signals to the stream API to manage the buffers. Wrap those buffers
in a GstBuffer in the pinossrc and pinossink elements and pool them in a
bufferpool.
Remove SPA_EVENT_TYPE_PULL_INPUT, we can do the same with NEED_INPUT and
by using a ringbuffer.
Do more complete allocation of buffers in the link. Use the buffer
allocator if none of the nodes can allocate.
Follow the node state to trigger negotiation and allocation.
Remove offset and size when refering to buffers, we want to always deal
with the complete buffer and use a ringbuffer for ranges or change the
offset/size in the buffer data when needed.
Serialize port_info structures as part of the port_update
Print both the enum number and the name when debuging properties or
formats.
2016-08-24 16:38:51 +02:00
Wim Taymans
bdbddaf75b improve introspection
Small cleanups
2016-08-18 12:17:31 +02:00
Wim Taymans
ab0537305f handle set_format with existing format
If one calls set-format with the current format, we return success
Remove some unused utils now
Work on cleanup of buffers
2016-08-11 11:20:12 +02:00
Wim Taymans
837c23a370 format: implement more gstreamer -> pinos format 2016-08-09 14:35:44 +02:00
Wim Taymans
0d2f5a1386 work on port-update control message
Serialize format and properties.
Simplify the properties by moving the unset-mask inside the property
structure. We can then also just use the index of the property as the
bit in the mask.
Work on stopping on disconnect
2016-08-08 22:10:57 +02:00
Wim Taymans
de53315f6e Work on node creation
Implements the basics of the PORT_UPDATE control message
Add the ports to the proxy node with whe PORT_UPDATE control message.
Let the proxy node check the events and create dbus objects based on
added/removed ports.
2016-08-05 19:46:37 +02:00
Wim Taymans
3ace7e9648 More work on implementing remote protocol
Rework things so that we negotiate buffer pools beforehand and only pass
buffer ids around We can then remove the refcount of buffers, events and
commands.
More work on buffer reuse
Use the node state changes to trigger the next step in the configuration
sequence.
Move most of the client-node to a plugin
Do buffer allocation in the port link.
2016-08-02 16:34:44 +02:00
Wim Taymans
907bd7bfd7 add client-node again
Add a client node again that uses the channel protocol but looks like
a node in the graph.
2016-07-22 17:17:44 +02:00
Wim Taymans
31041a4e16 node: update state in the skeleton 2016-07-20 18:04:34 +02:00
Wim Taymans
eefe6aacb9 some more rework 2016-07-18 17:40:58 +02:00
Wim Taymans
8407430891 rework: make client and server nodes
work on making nodes and ports on the client.
2016-05-12 17:03:28 +02:00
Wim Taymans
20c50772fa Add provide mode to pinossink
Add a mode to provide a stream to pinossink
Small improvements, leak fixes.
2016-05-06 17:54:23 +02:00
Wim Taymans
ba4ef9b5d9 Introduce the concept of a Port
A port is an input or output on a Node.
Channels are created from the ports and inherit the direction of the
port.
do automatic port selection based on the direction and caps and
node/port name.
Simplify stream_connect by passing the direction.
Fix pinossink to connect in setcaps so that we know the format and can
select a good sink to connect to.
2016-05-06 13:01:52 +02:00