Commit graph

263 commits

Author SHA1 Message Date
Wim Taymans 93bd18ccc5 fix build of test 2017-09-29 12:18:38 +02:00
Wim Taymans d65012ff21 remove json stuff
using JSON for formats or properties is not a good idea because we can't
add more types like pointers, fd, rectangles without weird hacks. Our
PODs are more easy to parse and extend and now there is an easy way
to parse and create them as well.
2017-09-28 17:07:43 +02:00
Wim Taymans 24d80e5c00 Add new pod parser and builder
Add a new pod builder and parser that is less verbose and
a little more powerful.
2017-09-28 17:00:51 +02:00
Wim Taymans 3e49aec61b json tests: add properties and 2017-09-21 18:03:48 +02:00
Wim Taymans b93ecb70fc more experiments: add json pattern matcher 2017-09-20 20:33:15 +02:00
Wim Taymans 86c8955c3a more json tests 2017-09-20 13:06:52 +02:00
Wim Taymans ac382c052a Work on JSON based format descriptions 2017-09-20 08:03:56 +02:00
Wim Taymans 577f86be0d graph: use spa_node as implementation
Always use a spa_node as the graph implementation, implementing the
methods is just as easy.
Plug some mem leaks in remote
2017-08-27 12:12:14 +02:00
Wim Taymans bece3a013b Make scheduler more generic
Add some callbacks to trigger push and pull in a graph
Remove the scheduler, make some implementations of graph push/pull
functions.
Add some properties to jack clients and nodes
Fix the parent of the clients.
Notify link format changes
2017-08-20 18:33:07 +02:00
Wim Taymans eba2b82c8e graph: fix the API a little
Add test for atomic graph updates
2017-08-18 18:54:45 +02:00
Wim Taymans 0602d76b9e Cleanups
Only pass data to callbacks.
Rename some structs
Provide methods to access structs
2017-08-06 06:42:26 +02:00
Wim Taymans 3d9f28c676 Use remote to join nodes on remote graphs
Make a new method that can take a local node and run it in a remote
pipeline. This basically replaces all functionality of the streams
and more.
Add 2 examples for exporting a sink and a v4l2 node
Make some more things const
Cleanups
Make it possible to do things when the node needs scheduling. The
default node will schedule the local pipeline but the remote node might
also schedule the remote pipeline.
2017-07-25 19:52:31 +02:00
Wim Taymans 847cef83b6 Work on unifying client and server
Remove context and extensions, make client API also use the core.
Make a new pw_remote object that keeps connections with remote
instances.
Remove introspection API, it's just as easy to connect to the registry
and get updates like that.
Expand the protocol a little to make it useful for making listeners
and connections.
Move protocol specific connection to the module. Make some new
convenience methods.
Make a factory to create nodes from spa objects
Add an example of a local pipeline displaying a v4l2 source.
2017-07-11 12:40:01 +02:00
Wim Taymans 0738f7fcf5 Rework node and ports
Rework the node and port API so that other implementations can be used
than the spa_node. The plan is to morph this into the stream and
context API.
Rework the graph API a little so that init + add is separated.
2017-07-07 17:55:26 +02:00
Wim Taymans 8886f5d373 build fixes 2017-07-04 11:30:49 +02:00
Wim Taymans d2f877912a Use graph to schedule things
Make real spa_graph nodes and ports and schedule those. This makes
it possible to add explicit tee and mixers in the real graph.
Rework the way we add and remove ports and nodes from the graph.
Remove confusing pw_port_link and merge core with pw_link_new()
Move scheduling in separate files, add some more graph-schedulers.
2017-06-30 19:36:39 +02:00
Wim Taymans 83e65c31ab graph: improve API a little
Node allow linking to multiple inputs when there is a mixer.
2017-06-29 09:31:50 +02:00
Wim Taymans bc56c59597 loop: add block flag to invoke
Remove async shutdown and block instead.
2017-06-26 10:41:19 +02:00
Wim Taymans 763bd1100e Add user_data to callbacks
Add user data to callbacks, it's more flexible and natural
2017-06-18 19:48:31 +02:00
Wim Taymans c3b73ba47d Add versions to structures
Use versions instead of size
Remove user_data from callbacks, we can simply pass the callback struct.
2017-06-14 18:32:39 +02:00
Wim Taymans 34450ed7ed Make done event on node
Replace the AsyncDone event with an explicit done callback in the node
to signal completion of an async operation.
Pass read and write fd together with the transport
2017-06-09 17:24:18 +02:00
Wim Taymans b4fdcbd322 Debug: remove logger
Make a default logger and mapper in a .h file to be used by examples
Remove logger and mapper from libs
Make method to set the default mapper for the debug methods
2017-06-06 13:30:34 +02:00
Wim Taymans 783bbe6c64 Small cleanups 2017-05-30 20:01:37 +02:00
Wim Taymans cf94117244 improve props test 2017-05-26 20:52:04 +02:00
Wim Taymans 5b037661d9 indent 2017-05-26 08:05:01 +02:00
Wim Taymans 11f23a3ffa spa: don't use typedef for struct and enum 2017-05-25 13:28:15 +02:00
Wim Taymans 83964cec87 pinos -> pipewire 2017-05-23 19:15:33 +02:00
Wim Taymans 12effccb06 Add fakesrc ! fakesink test
Add fakesrc and fakesink and some performance test
Small cleanups
2017-05-19 12:48:51 +02:00
Wim Taymans 6691eb7845 graph: add graph datastructure and scheduler
Improve event and command init so that it can be used more easily
as compound literals.
Improve volume
Make it possible to use graph scheduler in test-mixer
2017-05-18 17:16:48 +02:00
Wim Taymans 53dd63eb3a type: improve type check 2017-05-17 12:47:33 +02:00
Wim Taymans 6cbf398ad4 node: the callbacks determine async operation 2017-05-11 16:11:08 +02:00
Wim Taymans 01246f399e test: pass device in args 2017-05-11 11:41:39 +02:00
Wim Taymans 3b33e3d362 node: improve callbacks
Make separate callbacks for events and RT notifications.
2017-05-11 10:29:20 +02:00
Wim Taymans 3d54d31fac tests: fix for port status changes
We now need to tell the node we consumed a buffer by setting the status
back to NEED_BUFFER.
2017-04-28 17:37:16 +02:00
Wim Taymans fe68ca1be3 audiomixer: small improvements
Improve the audiomixer state handling
Improve PortIO status handling.
2017-04-28 17:22:23 +02:00
Wim Taymans cc8a5da9c7 Rename buffer status to make it more symetrical
Only try to pull once in a timeout.
We can reuse the last returned state as our internal state in
audiomixer.
2017-04-28 11:49:13 +02:00
Wim Taymans 214a0e27d8 Add support for trace logging in lockfree ringbuffer
Fix some crashes when the connection is dead.
Small cleanups in the audio mixer
Only propose alloc_buffer when we are using export_buf in v4l2
2017-04-27 17:17:47 +02:00
Wim Taymans b51d3e4862 buffer: make data and meta types dynamic
Use dynamic types for the data and meta types.
Move the meta into a separate header.
Remove port state, we can keep track of that ourselves.
Add size to MetaDataEnable params
2017-04-26 18:54:18 +02:00
Wim Taymans 63d060a63e ringbuffer: add stress test 2017-04-25 19:22:06 +02:00
Wim Taymans 7d1d3bd666 stream: use 2 eventfds for client <-> server signaling 2017-04-21 10:24:42 +02:00
Wim Taymans f0aafb5b51 alsa: work on ringbuffer data transport
Add ringbuffer test
2017-04-20 19:25:14 +02:00
Wim Taymans d9bb116d27 node: schedule upstream first
In pull mode, schedule all upstream nodes first, if any of them
produce output, push it into the current node.
Underrun streams without input on audiomixer, avoids glitch when
starting a new stream.
2017-04-12 11:24:11 +02:00
Wim Taymans 4c7b56020a audiomixer: improve mixing
Remove PortIO flags, we can use the status
Move PortIO to ports
Move transport to client-node
Improve scheduling
2017-04-12 10:40:17 +02:00
Wim Taymans 9bd92b781c small fixes 2017-04-08 20:59:38 +02:00
Wim Taymans 39c3650b5f fix media.class 2017-04-04 15:32:11 +02:00
Wim Taymans 032cc69f2f plugins: small cleanups 2017-04-04 09:40:12 +02:00
Wim Taymans 32368d741d audiotestsrc: implement sine wave
Fix audiomixer some more
2017-04-03 19:23:53 +02:00
Wim Taymans 5c32690cc8 Add sync and async support in *testsrc
Make minumum alsa latency configurable.
2017-04-03 16:54:44 +02:00
Wim Taymans 01c13adab5 improve node io
Unify input and output io areas.
Add support for ranges in the io area.
Automatically recycle buffers in the output areas in process_output
Improve the mixer, add use_buffer support, use a queue of input buffers,
fix mixing, add support for ranges.
Fix mixer and v4l2 tests
2017-04-03 14:56:04 +02:00
Wim Taymans 29fbf2e841 props: improve prop flags
Only keep the READONLY prop flag.
Work on test-mixer
2017-03-31 11:48:24 +02:00
Wim Taymans 29cb7bf39a format: improve format parsing 2017-03-24 18:11:11 +01:00
Wim Taymans 141202b1fd type: add subclass check 2017-03-24 13:25:43 +01:00
Wim Taymans 25b7ede0bc uri -> type
Clean up some more types.
2017-03-24 13:11:57 +01:00
Wim Taymans 5825c62d6d types: more work on types 2017-03-24 11:40:58 +01:00
Wim Taymans acedfe71c0 clean up types 2017-03-23 21:15:52 +01:00
Wim Taymans c44a7c9735 command: make commands dynamic
Ensure format object type.
2017-03-22 10:04:24 +01:00
Wim Taymans 03292fd80f audio: make audio format an uri type 2017-03-21 16:50:44 +01:00
Wim Taymans ff62c1b9ce format: make formats as uri 2017-03-21 13:36:22 +01:00
Wim Taymans 3f5a3e215b format: make media types and properties dynamic
Use URI properties to dynamically register the media types/subtypes and
property names. Add some helpers to set up the mappings.
2017-03-21 11:28:23 +01:00
Wim Taymans 8a6ce3b179 Make AllocParams into POD objects
Make allocparams into pod objects. This makes it easy to serialize,
copy, create and intersect them.
Add convenience macros for properties
Add helper function to collect object properties.
2017-03-17 11:58:09 +01:00
Wim Taymans b1f7df52e3 format: use padding attribute 2017-03-15 17:09:28 +01:00
Wim Taymans 905743dac6 Improve padding
Write out 0 while padding to make sure all memory is initialized
Remove the fd from the loop before destroying the node.
2017-03-09 09:48:41 +01:00
Wim Taymans a1dad30fd1 Use new builder for props and formats 2017-03-07 19:40:51 +01:00
Wim Taymans 78a3cd61b8 pod-builder: make more generic builder
Make a vararg based builder that produces much smaller code.
Catch demarshal errors.
Simplify array handling
2017-03-07 17:23:35 +01:00
Wim Taymans f92b68c3c3 Use types with known sizes where we can, easier to serialize
Add iterator for POD and use it to implement some demarshalling.
2017-03-07 11:56:43 +01:00
Wim Taymans 41399b0b25 Rework serialization
Move serialization to the protocol, we now just send blocks of bytes
over the connection and let the protocol deserialize them.
2017-03-06 15:48:04 +01:00
Wim Taymans 7a7ede96e5 Format: implement intersection and fixate 2017-02-28 15:09:34 +01:00
Wim Taymans dbae2e3f96 rework props with pod 2017-02-27 21:25:33 +01:00
Wim Taymans f02f93cda9 pod: make format like other PODs 2017-02-27 17:07:48 +01:00
Wim Taymans e79a294816 tests: add static caps example
Add example of how to define a static caps.
2017-02-24 18:46:30 +01:00
Wim Taymans 16b62de53a Rework formats
Use a POD for the format body. This allows us to more easily build
and copy the formats.
Remove obsolete code to make video and audio formats.
Use SpaVideo/AudioInfo to keep track of formats. Make functions to parse
the format into the structures.
Update plugins
2017-02-24 09:28:18 +01:00
Wim Taymans 7fc73953cd Add POD helper objects
POD (plain old data) objects are similar to LV2 Atoms and allows storage
and construction of datastructures in memory or on the stack. They can
be copied with a simple memcpy.

The idea is to use this to construct the network messages and to replace
the structures used for describing formats and properties.
2017-02-22 13:12:32 +01:00
Wim Taymans 808d6b6fca prop-builder: add helper to make properties and formats
Use this to make a format filter. Use the filter to negotiate
a format automatically.
2017-02-20 17:22:46 +01:00
Wim Taymans ae93f15965 Work on event loop
Make a new epoll based event loop and use it for the data tranport.
Simplify the spa event api a little and rename to SpaLoop
2016-11-18 17:46:01 +01:00
Wim Taymans e88a376d7c Optimize transport some more
We can optimize the transport some more if we allow the host to
configure the area used for transfering buffers. We can then also place
the current status in the area and avoid calling get_status(). We can
also allocate this area in shared memory, avoiding a memcpy in the
client-node.
2016-11-07 18:23:09 +01:00
Wim Taymans 7e46f9e3ad More hacking
Move array and map to pinos
Move more things to spa lib
ControlCmd -> Message
Make pinos log, use for plugins as well
work on ringbuffer in alsa and nodes
work on making registry with all objects
2016-11-03 19:41:53 +01:00
Wim Taymans d3dd90bb05 simplify events and commands 2016-10-24 15:30:15 +02:00
Wim Taymans ee202e13e9 Beginnings of dbus based control 2016-10-14 16:46:09 +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 49dae17dfb Add logger
Add logger interface
Make it possible to pass extra interfaces to the element at init time,
such as a logger.
2016-10-05 17:43:11 +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 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 67dd3adb87 port to meson 2016-09-26 12:15:52 +02:00
Wim Taymans 9f53eda6cb Add monitor interface
Add an interface to monitor devices and helper program
Add v4l2 monitor
Add simple dictionary with key/value pairs
2016-09-15 11:49:34 +02:00
Wim Taymans 829adbab59 Add h264 format
Improve format support
Remove the type from the value because we can find that from the
property info.
2016-09-07 16:25:31 +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 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 b67c216a04 Make new USE_BUFFERS command
Make a new USE_BUFFERS command to atomically send a buffer array to the
remote client. We can use this to then clean up an old array and go to
the PAUSED state if possible.
Work on formats. Make one structure that can hold all video formats.
Work on pipeline suspend and resume.
Add jpeg support to v4l2.
Work on enum_formats with a filter in v4l2.
2016-08-26 17:43:48 +02:00
Wim Taymans fbd6304663 Cleanups
Remove old code
Only depend on GStreamer for the plugins
Rename STOP to PAUSE because that's what it really does
Start working on format_fixate.
Remove default property value from props
Fix framerate
2016-08-25 14:10:38 +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 ac5d22ec79 Work on negotiation
Add helpers to convert between pinos and gstreamer formats.
Use pinos formats in the API.
Work on removing some hardcoded stuff and instead use the real format
from the pinos server.
Use memfd and sealing.
2016-08-05 16:39:26 +02:00
Wim Taymans dd1fbef28f work on memory references
Add a memory reference helper struct that we can use to track the memory
in buffers and formats.
Remove custom property get and set, the default ones will work fine.
Custom ones are problematic when we want to serialize properties in
formats etc.
Deserialized Formats are now tracked in the memory pool and can be freed
if needed.
2016-08-04 19:24:16 +02:00
Wim Taymans 8f9222bf9e implement set_format
Serialize the formats
Use SpaMemoryRef where we can
Add more debug
2016-08-04 17:33:49 +02:00
Wim Taymans 98679cbd53 make test app work again
Some cleanups and removal of unused code
2016-08-03 22:11:03 +02:00
Wim Taymans 1169c2419b Make buffer data point to memory blocks
Make buffer data point to a registered memory block by its mem_id.
Add some more helpers to allocate memfd backed memory.
Allocate buffers in memfd so that we easily share them between client
and server.
Update pts and seq in v4l2 now that this change will actually be visible
at the client.
2016-08-03 21:33:57 +02:00
Wim Taymans 98993c680b Make buffer structure sharable
Use stucture offsets instead of pointers so that we can share the buffer
structure between client and server.
We can then pass an fd wrapping the memory of the buffer to the client.
Add beginnings of a memory pool
2016-08-03 15:59:17 +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 05829f33e6 Work on memory allocation
We now only allow per port preallocated buffers. We exchange the index
into the array instead of passing the buffers around. We still use the
refcount to track when a buffer can be reused.
Improve API a little, allow passing the node as the first argument of
the interface call.
Implement alloc_buffer in v4l2 and improve the test.
2016-07-30 20:35:34 +02:00
Wim Taymans 4cb90f3b86 Rework transport protocol
Remove the old PinosBuffer object and replace it with SpaControl, this
communication protocol is designed to make it possible to implement
remote nodes and so it is moved to Spa.
Move SpaBuffer into to API
Work on easier API to make formats, implement enumeration and support
for all formats in v4l2.
Improve format output in -inspect
2016-07-28 21:19:20 +02:00
Wim Taymans b9320c67c2 inspect: improve output
Keep state variable to enumerate things. This allows us to remove the
expectation that the same index will give the same item.
Use a new rectangle type for video size. When enumerating sizes, this
allows us to specify relations between width and height more easily.
Remove the struct and bytes type, they are like pointer.
Add filter to enum_formats to speed up enumerations.
2016-07-25 10:50:46 +02:00
Wim Taymans 61caf0e19c buffer: add ptr_type to the data
We can give more info about the memory or fd that way and we can also
pass other structures as data later if we need to.
2016-07-25 10:50:46 +02:00
Wim Taymans 6ab8af91e0 More hacking
Add spa based v4l2 pinos module
Add allocation params to port_alloc_buffers
Let the app do allocation for handles.
2016-07-25 10:50:46 +02:00
Wim Taymans 4c7cee6b28 improve buffer import
Add generic pointer metadata type that is copied on import
Pass array of pointers to SpaBuffers in use_buffers.
Make sure we use the same data and metadata as the imported buffer.
2016-07-25 10:50:05 +02:00
Wim Taymans c5a31acf8c v4l2: add support for buffer import
Add support for buffer import
Rename some methods
2016-07-25 10:50:05 +02:00
Wim Taymans 5fa334a89b poll: remove threads from alsa-sink
Remove the thread from alsa sink and use the pollfd event.
Make it possible to pass multiple fds in one pollfd event
Add 3 callbacks to the pollfd event and add support for timeouts
2016-07-25 10:50:05 +02:00
Wim Taymans ac59fa9371 test: pass device as parameter 2016-07-25 10:50:05 +02:00
Wim Taymans 81bde64550 v4l2: remove poll and send event instead
Don't start a thread for polling in the node itself but let this be
handled by the app.
2016-07-25 10:50:05 +02:00
Wim Taymans cbde76f500 v4l2: show v4l captured output in SDL window 2016-07-25 10:50:05 +02:00
Wim Taymans a1a27328e2 v4l2: continue work on the capture device
Remove activate and deactivate commands.
Add STEP property range type for v4l2 frame sizes later
v4l2: implement negotiation and data capture
2016-07-25 10:50:05 +02:00
Wim Taymans beedb65f00 video: add video format
start working on v4l2 source
2016-07-25 10:50:05 +02:00
Wim Taymans 3c029cba53 more hacking
Move plugin API to separate directory for now
Add ringbuffer and way to get ringbuffer from a port
2016-07-25 10:50:05 +02:00