Commit graph

375 commits

Author SHA1 Message Date
Wim Taymans fc90a4e48a Implement config/state file handling
Make methods to load_config and load/save state. For now the config
and state directories are the same but it might not be. Implement
the search path for all config/state files as:

  $XDG_CONFIG_HOME/[$prefix]/$name
  $HOME/.config/[$prefix]/$name
  $PIPEWIRE_CONFIG_DIR/pipewire/[$prefix]/$name
  /etc/pipewire/[$prefix]/$name

Make some config files for jack and RT clients. Make pw-cat use the
client-rt config.

Use core state and config management in media-session.
Move all session manager state and config files to the build dir and
set the PIPEWIRE_CONFIG_DIR to this build dir.
2021-02-12 10:25:11 +01:00
Wim Taymans 83c403ed1c jack: use PIPEWIRE_PROPS for the context as well
Use PIPEWIRE_PROPS to create and connect the context as well. This
makes it possible to pass configuration to the modules loaded by
the context such as:

PIPEWIRE_PROPS="context.modules.args={nice.level=-14}" jack_simple_client

To set the nice level of the jack app.

See #698
2021-02-10 11:23:52 +01:00
Wim Taymans 51cfb98ea6 jack: Pass custom flags as port.extra info
Make a port.extra property that contains API specific extra port
information that is passed in the global object properties.
Use this to pass the custom jack flags for a port. Carla uses this
to mark CV ports.
2021-02-09 16:09:53 +01:00
Wim Taymans ef150bfb3c jack: return an empty session command
We need to return an empty message because apps don't expect a
NULL pointer.
2021-02-09 10:26:14 +01:00
Wim Taymans 19b6942965 jack: use PIPEWIRE_PROFILE_MODULES first
We want to respect the PROFILE_MODULES settings if any or else
we use the default,rtkit profile.

See #683
2021-02-08 18:02:58 +01:00
Wim Taymans 0f028dab40 jack: use the context data thread
Configure the data thread as cancelable, there is no need to make
another thread.

See #683
2021-02-08 15:29:48 +01:00
Wim Taymans 210950dc0a context: disable mlock warnings by default
Make this a tunable option instead.
2021-02-08 10:59:02 +01:00
Wim Taymans 3450bea416 jack: implement some missing methods
to make qjackctl 0.9.0 work
2021-02-04 15:48:36 +01:00
Wim Taymans 2b44f42845 pass the complete buffer size to snprintf
There is no reason to pass size-1, snprintf will always put a \0
at the end.
2021-02-02 12:09:29 +01:00
Wim Taymans abfc67a3ca Revert "remove mlock and use MAP_LOCKED"
This reverts commit ab91e94b59.

When no memory can be locked, the mmap fails with -EAGAIN.

Fixes #592
2021-01-19 14:47:52 +01:00
Wim Taymans ab91e94b59 remove mlock and use MAP_LOCKED
The warnings are confusing and a properly tuned system would have
the limits set correctly.
2021-01-19 11:59:21 +01:00
Wim Taymans c430b1de58 jack: move monitor ports after playback ports
Enumerate monitor ports after their playback ports, like how
jack does this.

See #527
2021-01-05 15:38:52 +01:00
Wim Taymans 776147c125 jack: also find port by aliases
one can also use the aliases to connect ports, qjackctl does this.

Fixes #527
2021-01-03 21:25:55 +01:00
Wim Taymans 2b507cbe79 jack: use the node activation position after connecting
Until we get assigned to a driver, use our own activation position
to report samplerate and buffer size.
2020-12-09 20:48:59 +01:00
Elliott Sales de Andrade 86fd6a0d3e Fix some possible-NULL pointer usage. 2020-11-23 15:36:08 +00:00
Wim Taymans fb44d3428c jack: block some cases
Refuse to run when we run in the daemon, we can't really do a blocking
connect to the daemon from its main thread.

Also refuse to run when we detect an old pipewire libaray. Blocks the
case where some app linked against 0.2 wants to use the replacement
libjack.so.
2020-11-19 12:37:10 +01:00
Wim Taymans f42da492f9 warn about lock just once 2020-11-14 21:21:20 +01:00
Wim Taymans 38bcab4610 jack: handle connect errors
Listen on the proxy for errors and report this to the caller. This
avoids hanging in jack_connect.
2020-11-04 21:05:45 +01:00
Wim Taymans c43026d93e don't handle EINTR and EAGAIN as the same
EAGAIN means a non-blocking operation would block and we should not
try again right away but leave the loop and wait instead.

See #358
2020-11-02 16:43:56 +01:00
Wim Taymans e094640c7b handle EINTR and EAGAIN
Just do the call again instead of failing or logging an error.

Fixes #358
2020-11-02 14:51:07 +01:00
Wim Taymans acfb48e3da pulse: improve debug 2020-10-27 16:46:12 +01:00
Wim Taymans 70e9e622eb jack: declare constants like jack does again 2020-10-22 15:23:56 +02:00
Wim Taymans 4dd1e02526 jack: return error when out of midi events
Fixes #334
2020-10-19 23:30:44 +02:00
Wim Taymans 68bff629b3 jack: optimize get_buffer
Keep track of global mix port.
Calculate the get_buffer function beforehand.
2020-09-30 11:59:41 +02:00
Wim Taymans 2a630dbecd jack: move some debug to fastpath 2020-09-29 16:57:50 +02:00
Wim Taymans c2fc8423eb jack: move metadata to exports file
So that we don't have to depend on the header file.

Fixes #306
2020-09-25 17:39:26 +02:00
Wim Taymans 136f556d79 jack: lock for accessing the globals 2020-09-22 13:10:58 +02:00
Wim Taymans c979f181a5 jack: return useful version number (major version 3)
Also add the PipeWire string in there to give apps a chance to
report this.
2020-09-11 11:28:04 +02:00
Wim Taymans dc2cfb2bd2 jack: only report latency for terminal ports
Only report latency for terminal ports for now and use the buffer
size as the latency.
2020-09-10 09:15:47 +02:00
Simon McVittie b8c58c74d8 Link pipewire-jack to libatomic if required
This is necessary on some 32-bit architectures that implement atomic
operations on 64-bit quantities as library calls, including Debian's
armel and mipsel ports.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-07 15:17:57 +00:00
Wim Taymans d995df95f8 jack: small cleanup 2020-09-07 16:16:26 +02:00
Wim Taymans 4c372a87ca pw-jack: add samplerate and period options 2020-09-03 11:14:29 +02:00
Wim Taymans 0c04481ba7 metadata: improve default sink/source
Only check defaults when subject is PW_ID_CORE
Handle NULL keys: remove the defaults
2020-08-18 17:56:05 +02:00
Wim Taymans 759e1ccb6b jack: fix default source and sink handling 2020-08-18 17:18:37 +02:00
Wim Taymans 8c893cbc4a jack: improve debug 2020-08-18 16:52:27 +02:00
Wim Taymans 36c10046da metadata: fix string compare 2020-08-12 18:58:48 +02:00
Wim Taymans cc044b0e08 jack: don't overwrite any PIPEWIRE_PROPS values 2020-08-11 12:12:37 +02:00
Wim Taymans f73a0c97e3 jack: use empty area when get_buffer frames is 0
Client that call port_get_buffer with 0 frames get the empty scratch
buffer because we can't know the final output size.
2020-08-11 12:09:50 +02:00
Wim Taymans 753af7c7b3 jack: improve buffer size callbacks
Make sure we emit the buffer callback either from the calling thread
or from the thread_loop. Mark the callback as pending and don't call
the process function until the callback has been handled.
2020-08-11 11:11:00 +02:00
Wim Taymans e71936f870 Improve naming
master -> driving
priority_master -> priority_driver
segment_master -> segment_owner
2020-08-06 13:49:33 +02:00
Wim Taymans 3abd46b619 jack: Use out node name from the server
Get the node name from the global info when we see it.
Check if the name changed and set the right result flag for the app.
2020-08-05 12:26:59 +02:00
Wim Taymans d76b509995 jack: prefer nick for node name
The nick is shorter and nicer for jack applications. We have the
full description in the port alias 2.
2020-08-03 18:13:31 +02:00
Wim Taymans 407ea74513 don't use qsort_r, it's not implemented everywhere
Fixes #260
2020-08-02 12:50:56 +02:00
Wim Taymans 2b3a58ed13 jack: improve client name
Only append app name and node name when they are different
Use / to separate app name from node name because : is used to
separate client name from port name.
2020-07-30 12:56:20 +02:00
Wim Taymans 2e95f7dd85 jack: improve metadata callbacks
Only emit callbacks when something changed.

When setting a value, first update the local store. This triggers
the emit from the calling thread (as expected by jack clients) and
when the update arrives from the server, it will not emit the callback
anymore because the value didn't change.
2020-07-30 12:11:24 +02:00
Wim Taymans f888c58b83 jack: fix client uuid 2020-07-30 12:10:46 +02:00
Wim Taymans bb20e0646c jack: parse varargs and use server name
Parse the varargs and use the server name as the remote
2020-07-23 13:18:14 +02:00
Wim Taymans 266e1301d2 use id to store default sink/source
This is easier to handle in general and we should not use the name
as a unique id. If the session manager wants to save things, it can
use whatever fields it wants from the object to create a unique
persistent name.
2020-07-23 11:59:13 +02:00
Wim Taymans ca066fbf3b jack: use PIPEWIRE_PROPS env to add properties to jack nodes 2020-07-21 16:50:45 +02:00
Wim Taymans d4d80c16c1 jack: handle NULL keys 2020-07-21 16:47:58 +02:00
Wim Taymans 8b291ada27 jack: increase client name size 2020-07-21 15:41:52 +02:00
Wim Taymans 13492fd282 jack: include application name in client name 2020-07-20 16:54:38 +02:00
Wim Taymans ee2c1f3882 jack: enforce unique port names as well 2020-07-20 16:27:26 +02:00
Wim Taymans 7711c98123 jack: use default sink/source to sort ports 2020-07-17 17:23:43 +02:00
George Kiagiadakis a108752514 jack: fix crash on close when metadata are not available 2020-06-17 12:13:34 +00:00
Wim Taymans 0441653ce4 jack: use PIPEWIRE_LINK_PASSIVE environment var
Let the jack client make passive links when the PIPEWIRE_LINK_PASSIVE
variable is set. Makes it possible to start qsynth with passive links
so that it suspends when not in use.
2020-06-17 13:17:28 +02:00
Wim Taymans 660d77cff0 jack: allocate mix structure dynamically 2020-06-16 21:12:12 +02:00
Wim Taymans c9d4c1ba95 jack: dynamically fill the port array
Don't preallocate ports, do so on demand to reduce memory
usage.
2020-06-16 20:57:52 +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 e493be3844 scripts: Use special ${LIB} token for architecture-independence
On GNU/Linux systems, the literal string '${LIB}' in dynamic linker
paths expands to "lib", a biarch libQUAL directory such as "lib64", or
a Debian-style multiarch directory such as "lib/x86_64-linux-gnu".
If we're installing libraries to such a directory, and we have both
word-sizes' compatibility libraries available, then pw-pulse can
use LD_LIBRARY_PATH='/usr/${LIB}/pipewire-0.3/pulse' to make both
i386 and x86_64 programs load the correct version.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-05 13:40:50 +00:00
Simon McVittie 96eb6e4df8 scripts: Don't add an empty entry to LD_LIBRARY_PATH
LD_LIBRARY_PATH="/path/to/lib:" is interpreted as equivalent to
LD_LIBRARY_PATH="/path/to/lib:.", loading libraries from the current
working directory, which could lead to malicious libraries being loaded
if the current working directory is untrusted. To avoid this, only add
the current LD_LIBRARY_PATH to the new LD_LIBRARY_PATH if it is
actually set.

This commit also single-quotes the interpolated @VARIABLES@ so that
their values can contain shell special characters (other than single
quotes).

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-06-05 13:40:50 +00:00
Wim Taymans 6ee9853133 jack: free old mem after we configure new mem 2020-06-05 13:02:56 +02:00
Wim Taymans 814b74265c jack: stop the thread loop before we destroy objects 2020-06-04 13:08:39 +02:00
Wim Taymans 253e304124 jack: destroy link proxy
Destroy the link proxy immediately so that we don't leak it.
The link is marked as 'linger' and will thus keep on living
even when our proxy is gone.
2020-06-04 12:59:55 +02:00
Wim Taymans 38cfa2d71d jack: fix leaks 2020-06-04 12:59:20 +02:00
Wim Taymans c546167ad3 require meson 0.49 2020-05-20 15:26:35 +02:00
Wim Taymans a898f21c87 improve debug
When we fail to read the eventfd, don't try to use the value.
2020-05-20 15:24:25 +02:00
Wim Taymans e6ccc72feb fix compiler warnings 2020-05-08 20:40:02 +02:00
Wim Taymans c117ca0899 jack: fix unlock 2020-04-30 16:18:40 +02:00
Wim Taymans 420c186124 jack: also sync position area with data thread 2020-04-30 16:15:22 +02:00
Wim Taymans 0fd46d057e remote: free io area after we set the new area
First set the new area, then destroy the old one. Otherwise the
data thread might still be using the old area and crash.
2020-04-30 16:13:50 +02:00
Wim Taymans 8141c92dde jack: free some objects 2020-04-30 13:11:01 +02:00
Wim Taymans 30d5a247e1 jack: improve locking
Protect the global metadata with a lock because we update this from
multiple clients. Avoid updating the metadata if it didn't change.

Add a simple lock to protect the session objects, they could be
accessed from the main thread or data thread. Use the simple lock
in methods that just read.

Use the new data loop invoke to make sure we sync the data update
with the data thread.

Stop the data loop when our position io is removed.
2020-04-30 12:57:56 +02:00
Wim Taymans d8d4e2f335 jack: make dummy server and net libraries 2020-04-29 16:32:15 +02:00
Wim Taymans 9f810d1bbc add pw-jack and pw-pulse to set the library path
pw-pulse and pw-jack set the replacement library path correctly
so that pulse and jack apps run on top of PipeWire.
2020-04-29 13:28:08 +02:00
Wim Taymans 293386c21a install replacement libraries in modules directory
Don't use a special name for the replacement libraries but install
them into the modules directory by default. Add an option to install
them into another location.

This way, we don't need to set up symlinks in development, distros can
choose to install them where they want and/or we can use symlinks or
LD_LIBRARY path to select the replacement versions.
2020-04-29 11:24:24 +02:00
Wim Taymans 83b30dcd3d jack: always initialize the port buffer
Init the port buffer after we create it, not only after we get a buffer
on the port.
Cleanup a little.
2020-04-28 14:15:49 +02:00
Wim Taymans 730c85e5b0 metadata: fix order of type/value 2020-04-27 12:54:14 +02:00
Wim Taymans 90e1eb1b22 jack: add more metadata keys 2020-04-27 12:22:32 +02:00
Wim Taymans aafd1e7298 improve debug
Improve log so that debug level 3 gives a reasonably readable overview
of what is going on.
2020-04-22 12:47:18 +02:00
Wim Taymans 2e06d0819b jack: only do transport when there is a driver 2020-04-21 16:15:45 +02:00
Wim Taymans 90054f5f3e jack: clear buffers when freeing the mixer 2020-04-21 15:53:43 +02:00
Wim Taymans 539296069d jack: implement more metadata API
Rework the metadata implementation without pw_properties to make
it easier to delete all subjects and implement the metadata API.
Remove metadata from all objects when they are destroyed.
2020-04-20 15:19:06 +02:00
Wim Taymans 16ca53e592 jack: implement get_property 2020-04-20 11:51:20 +02:00
Wim Taymans 0db9c4ef6b jack: use current buffer and samplerate 2020-03-18 17:52:48 +01:00
Wim Taymans e8cf29a7c8 jack: remove some hardcoded defaults
We get those from the server instead.
2020-03-18 17:42:11 +01:00
Wim Taymans 72d70b0f48 Add and fix some more warnings
Fixes #216
2020-03-17 11:37:56 +01:00
Wim Taymans cb7bfdf98a sprinkly SPA_LIKELY/UNLIKELY around 2020-03-16 12:52:28 +01:00
Wim Taymans 5273320825 jack: fix midi output 2020-03-15 08:45:56 +01:00
Wim Taymans b070752add context: don't load rtkit by default
Don't load and use rt-kit by default because it can cause sigkill in
the app, which is not good when it happens in a compositor.

Make the module profile a comma-separated list of profiles and make
it possible to explicitly load rtkit as well.

load the rtkit profile as well in jack.
2020-03-05 12:12:46 +01:00
Wim Taymans c4b2be2aad use true and false for boolean properties
So that it's easier to convert them to booleans in introspection
code later.
2020-03-03 18:17:46 +01:00
Wim Taymans 37a1dc5265 jack: use constant for type_id 2020-03-02 16:50:37 +01:00
Wim Taymans 73da0f8878 jack: use pthread cancel to stop the data thread
Activate the new option to pthread_cancel the data thread because
that is what jack apps expect.

Fixes #211
2020-03-02 15:47:52 +01:00
Wim Taymans bcdd47273d jack: call buffer_size callback right after activate
Some jack clients expect this callback right after activate.
Should fix jackaudiosink in gstreamer.
2020-02-25 18:02:49 +01:00
Wim Taymans a4d744e3cf jack: improve sample_rate callback
Call the sample rate callback when we install it and we know the
sample rate. Otherwise, the sample rate callback might never be
triggered.
2020-02-24 15:39:19 +01:00
Wim Taymans cde7fa797c jack: improve timemaster install
When we get the driver activation try to install ourselves as
timemaster.
2020-02-24 15:38:21 +01:00
Wim Taymans 9e44b957f0 jack: check arguments
Guard against some evil jack clients
2020-02-24 11:25:31 +01:00
Wim Taymans ea911f2e3f tweak buffers a little
JACK can handle 2 buffers at most, make the default buffer allocator
allocate 2 buffers when no params are given.
Prefer 2 buffers, it allows some form of async fill/consume
2020-02-19 10:17:00 +01:00
Wim Taymans b3d94cde87 jack: fix stride of midi
Midi has a stride of 1
Error when the number of buffers is too big
2020-02-18 18:03:30 +01:00
Wim Taymans 1f3cb3d207 jack: fix invalid unlink
Don't unlink the mix->link when freeing, it is only linked when
in the free pool.

Protect against invalid number of buffers that could corrupt our
state.
2020-02-18 17:37:02 +01:00
Wim Taymans e6c3619521 jack: don't try to consume port without data
Or else we handle old data.
2020-02-18 13:38:25 +01:00
Wim Taymans 905e5af058 jack: implement the jack_info_callback and function 2020-02-10 10:59:24 +01:00
Jan Koester 656c58fd98 jack: add error callback 2020-02-10 10:48:49 +01:00
Wim Taymans ee67ab9c04 client-node: keep target links in list
Don't allocate the links in an array because they might be moved
when the array is resized. Instead just use calloc and add them
to a list.

Make sure we update the list used in the real-time thread from a
safe context.
2020-02-07 16:45:58 +01:00
Wim Taymans 936c290cc1 plugins: fix the licence of alsa and jack libraries
It's all MIT
2020-02-07 15:43:13 +01:00
Wim Taymans 9acf592e9c jack: remove leftover printf debug 2020-02-07 13:33:59 +01:00
Wim Taymans ed1cf46c31 jack: add jack_get_video_image_size extension
Add a JACK PipeWire extension to get the video size of the DSP
pipeline and use this instead of the hardcoded values in the example.
2020-02-07 13:31:49 +01:00
Wim Taymans 14fbd4f520 jack: wait for transport
Wait for the transport to be configured before we exit from
client_open. We then have at least an activation or even a driver
set.
2020-02-07 13:30:24 +01:00
Wim Taymans ae4e17e9a2 Remove old LICENSE files and README 2020-02-07 13:24:06 +01:00
Wim Taymans 5c4be385ad jack: only append node id when name already taken 2020-02-05 10:27:37 +01:00
Wim Taymans 41b47e726e context: add some more defaults
Make a property to allow mlock and use it.
mlock in stream and filter when asked to mmap mem.
2020-02-04 17:09:41 +01:00
Wim Taymans 5e5bab4680 jack: don't take clock time as awake timestamp
Take a sample from the monotonic clock to generate the AWAKE
timestamp.
2020-01-31 13:35:39 +01:00
Wim Taymans 7450bfd88b Improve mlock failure warning message 2020-01-29 11:07:26 +01:00
Wim Taymans 8de267cf02 jack: handle plugins that cache jack_port_get_buffer()
Some plugins (calfjackhost) only call jack_port_get_buffer()
once and cache the pointer. This behaviour has been deprecated
in JACK2 but still works.

Add a workaround for this by getting a buffer ourselves and memcpy
into it from the scratch buffer.
2020-01-29 10:29:26 +01:00
Wim Taymans 84258c9078 jack: fix set_sync_timeout
It needs to update the node activation, not the driver activation.
2020-01-28 20:49:21 +01:00
Wim Taymans 6ac9b7b3a7 spa: add spa_aprintf helper
Add a asprintf helper function that handles errors correctly.
Use this in places where we use asprintf to avoid warnings when we
don't check the return value.
2020-01-27 12:19:21 +01:00
Wim Taymans ae51b0acf1 jack: stop data thread when closing client
Make sure we deactivate and stop the data thread when closing a
client or we might get segfaults.
2020-01-16 13:29:56 +01:00
Wim Taymans ded3a2a58f append -pw and version to .so libraries
So that we can place them next to the real ones and use a symlink
to switch.
2020-01-16 12:57:25 +01:00
Wim Taymans 1f03d26e53 install the jack and pulseaudio libraries 2020-01-15 17:01:48 +01:00
Wim Taymans 9b41e4dfd9 jack: use sample rate from position
Use the sample rate from the position io area as soon as we get it.
2020-01-09 16:06:28 +01:00
Wim Taymans 852ac043d3 Use the DSP format for dsp formats
Use the DSP media subtype to describe DSP formats. DSP formats
don't include the rate, channels and channel position in the
format and must use the rate and duration from the position io. This
makes it possible to later change the samplerate dynamically without
having to renegotiate the graph.

The same goes for the video DSP format, which uses the io_video_size
from the io_position to get the size/stride. Set this up in the node
based on the defaults from the context.

Make it possible to define defaults in the daemon config file, such
as samplerate, quantum, video size and framerate. This is stored in
the context and used for the DSP formats.
2020-01-09 15:18:59 +01:00
Wim Taymans f391353c7f Make interface types a string
This is more in line with wayland and it allows us to create new
interfaces in modules without having to add anything to the type
enum. It also removes some lookups to map type_id to readable
name in debug.
2019-12-19 13:36:04 +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 743450a19f pw_client_node_proxy -> pw_client_node 2019-12-11 16:13:46 +01:00
Wim Taymans e633e205c2 pw_link_proxy -> pw_link 2019-12-11 15:11:56 +01:00
Wim Taymans 49d736bbb7 pw_registry_proxy -> pw_registry 2019-12-11 09:44:48 +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 c9a54112e4 client-node: use bound id from the proxy
Remove the obsolete node_id from the transport. We get this info
now from the proxy.
2019-11-29 13:34:06 +01:00
Wim Taymans a1801b690f jack: use explicit variable to keep track of transport 2019-11-29 13:34:06 +01:00
Wim Taymans e40fbf8cc4 Add printf checks for proxy_error and resource_error
Add an error variant without checks.
2019-11-21 16:09:05 +01:00
Wim Taymans 40e837555d jack: improve port sort order
Sort by object path before attepting by id.
2019-11-21 09:33:16 +01:00
Wim Taymans cd1ec41253 jack: use metadata when available 2019-11-05 10:03:35 +01:00
Arun Raghavan 863a642e08 Merge pipewire-jack subtree 2019-11-03 15:20:56 +01:00
Arun Raghavan 59bdab94bc Drop git submodule structure
The workflow is getting a little messy with these, so we're just going
to merge those repositories in.
2019-11-03 15:19:43 +01:00
Wim Taymans 612bfe9a64 jack: update 2019-11-03 10:41:26 +01:00
Wim Taymans b179b11e66 jack: update 2019-10-29 12:03:57 +01:00
Wim Taymans 2728babc85 jack: sync 2019-10-28 18:05:37 +01:00
Wim Taymans 96ff726666 jack: update 2019-10-28 15:04:18 +01:00
Wim Taymans 4f5a5fc917 vulkan: tag port as video DSP port 2019-10-28 13:20:42 +01:00
Wim Taymans aab72a70e6 submodule update 2019-10-24 11:05:49 +02:00
Wim Taymans eb1d675cb0 node: add master priority
Change node.priority to priority.session to indicate that this
is the priority that the session manager uses to select the node.

Add another priority.master that the core uses to select a master
driver. Keep the driver nodes sorted by master priority.

Let jack always prefer to connect to the master driver nodes.
2019-10-22 12:25:25 +02:00
Wim Taymans 3aa19dd38a node: send Suspend to the node
Send suspend to the node when suspending. This is usually the same
as puse for all nodes.
Implement negotiation when we Start audioadapter. This makes it
easier that to track the ports that are negotiated for now.
Use Suspend to clear the audioadapter negotiation.
2019-10-21 17:24:51 +02:00
Wim Taymans 6e0ffb0c47 flags: change flag macros
SPA_FLAG_CHECK -> SPA_FLAG_IS_SET
SPA_FLAG_UNSET -> SPA_FLAG_CLEAR
Add SPA_FLAG_UPDATE
2019-10-02 18:00:42 +02:00
Wim Taymans f539b42a03 alsa: improve midi
Add some debug
Ignore ports without buffers.
2019-09-26 11:57:25 +02:00
Wim Taymans db341a6450 improve properties on node and port
Rename some alsa filenames.
2019-09-23 20:51:34 +02:00
Wim Taymans ab0d1b7fad alsa: cleanups
Avoid getting the clock time just for debug.
Improve time at startup.
2019-09-19 16:55:02 +02:00
Wim Taymans 322ccb452c small cleanups 2019-09-19 13:17:30 +02:00
Wim Taymans 49a5e97d69 format: add application/control media type
Add a new application/control media type that can be used to negotiate
control streams between ports.
2019-09-16 21:09:52 +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 d648ea4ad3 control: don't fail on async port_set_io 2019-09-10 18:50:28 +02:00
Wim Taymans 80ba0b2dcf node: only put async state changes to work queue 2019-09-10 12:13:26 +02:00
Wim Taymans 3142d3b979 mem: add private mapping flag 2019-09-10 09:59:31 +02:00
Wim Taymans 9c9bff8fe9 data-loop: add _wait function
Add function to wait for one iteration of the loop. This can be used
by specialized implementations of the data loop, like jack.
2019-09-09 17:17:03 +02:00
Wim Taymans 4a4fa57efc alsa: handle target better
Rework how we handle the current device fill level and our desired
fill level so that we handle it more consistently.
2019-09-05 13:45:37 +02:00
Wim Taymans 73628c91de audioconvert: refuse invalid channels and rate 2019-09-03 13:49:38 +02:00
Wim Taymans 6341469456 jack: update 2019-09-02 17:19:00 +02:00
Wim Taymans faaf84286b node: improve position and transport
Reorganize some things, let the clients update the segment info
in their own activation, then let the server merge it. This avoids
clients stepping on eachother. When looping through the clients,
copy the segment info when we encounter its owner.

Remove the list of segment owners to the activation. This is better
than in the activation because we can then just keep one list of
owners.

Remove the NONBLOCK flag from the eventfd so that we can do blocking
reads as well.

Just keep a reposition owner in the driver activation. This points
to the node that has the reposition info. This avoid complicated
synchronization to keep multiple nodes from stepping on eachother.
Now they can just prepare the reposition info in their activation and
set themselves as the reposition owner. The last one who succeeds
wins.
2019-09-02 12:05:05 +02:00
Wim Taymans 0f9594e119 node: add suport for quantum updates
When the node latency property is changed, trigger a graph recalc
to set the new quantum if needed.

Also update the driver quantum when unassigned nodes are assigned
to a driver.
2019-08-30 17:00:26 +02:00
Wim Taymans aaa6821052 jack: update 2019-08-30 15:41:49 +02:00
Wim Taymans fc770a5fbb jack: update 2019-08-30 15:30:49 +02:00
Wim Taymans 8afa5b0ada node: move segment owner into the io area
This makes it easier to keep track of who is responsible for what.
Also remove the valid fields and move them to flags in the segment
info. That way, the owner can update the flags without having to
worry about concurrency.

Keep separate info for the reposition information. We need to do this
to make it possible to seek in other formats than the frame.

Clear out the owner field when the node is destroyed or removed from
the driver.
2019-08-29 18:24:09 +02:00
Wim Taymans a910deb0fc pipewire: set default log level to WARNING 2019-08-29 15:34:36 +02:00
Wim Taymans 35c5cf9b52 node: improve sync
Place the requested sync and position update flag in the node
activation. This way we can use our existing loop to update the node
sync states and check if the node is ready.

Implement sync timeout, when the client can't start or seek within the
timeout, we start RUNNING anyway and hope the client catches up.
2019-08-29 14:01:48 +02:00
Wim Taymans 84405dae2a node: add fields to support sync
Sync is enabled when clients need time to move to a new location.
It's a bit like GStreamer preroll after a seek. Clients that need
time, increment the sync_total. Whenever a seek is done, the server
waits in the Starting state until the sync_pending is 0 (or timeout
later).

Improve atomic operations
2019-08-28 13:56:23 +02:00
Wim Taymans 0a15e1f804 io: add offset for clock times
Add an offset to apply to the clock time before we can compare to the
segment values. This way we can keep the segment start independent of the
clock values and we only need to adjust the offset when paused. It's
like the base_time in GStreamer to calculate the running time.
2019-08-28 10:28:06 +02:00
Wim Taymans 2805713da3 io: rename some segment variables
Also initalize a default segment in the node.
2019-08-27 21:49:49 +02:00
Wim Taymans 7c865f5db0 io: add support for segment
Move fields from the io_position to io_segment. The segment contains
the mapping between raw clock time and stream time in various
formats. We keep an array of pending segments available in the
io_position field so clients can anticipate changes.

Make looping a flag in the segment instead of a state.

Prepare for segment masters. These will be registered clients that
are responsible for updating parts of the extended segment info.

Add namespace to some defines.
2019-08-27 21:36:15 +02:00
Wim Taymans b356c83d32 node: add support for transport
Move some things around. Move the duration of the current cycle
to the clock. Also add the estimated next timeout to the clock.
Add a generic media specific counter to the clock.

Clean up the position_bar info. We can do with only a double beat
value and make the signature in floats.

Flesh out the io_position info. This has now the information needed
to convert a raw clock time into a stream time. It basically has
the same kind of features as GStreamer segments such as looping,
variable rate playback etc.. It also contains the state of the
timeline (paused/playing) and it can be used to update the position
and state from clients.

There is also extended information in the position field that
clients can update when they can.

Plugins basically only update the clock info they get (and use
the position info to check if they are slaved or not).

Before each cycle, check if there is a pending position update and
apply it.
2019-08-27 14:41:47 +02:00
Wim Taymans 8f01dd4c75 node: improve debug 2019-08-22 18:02:15 +02:00
Wim Taymans 93fbe121d0 node: tweak CPU load values
JACK uses a CPU calculation with an exponential moving average
with degree of 1/2.
2019-08-22 14:06:59 +02:00
Wim Taymans 6ad4adc194 node: add xrun callback
Let alsa emit xrun callbacks.
Write the xrun stats to the activation area of the node so all
clients can read it.
2019-08-22 13:25:38 +02:00
Wim Taymans c9e177827b node: calculate cpu time 2019-08-22 10:59:53 +02:00
Wim Taymans 1a4713ee3a jack: update 2019-08-21 20:37:36 +02:00
Wim Taymans f8d5b3947a jack: update 2019-08-21 18:37:57 +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 a42c517682 improve debug 2019-08-08 11:03:13 +02:00
Wim Taymans 447d1f94bf jack: update 2019-08-07 12:59:46 +02:00
Wim Taymans f1ea49d6e9 mem: add size of tag to make it possible to check subtags 2019-08-01 13:55:03 +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 18776b155b mem: Add tag to memmap
Add a tag field when creating a memmap so that we can do lookup on it.
This makes it easier to implement the tracking of mappings for io areas.
Remove custom io memory tracking and use the tags.

Add flags to spa_chunk to make data corrupted. The flags on the buffer
stay constant for the life of the buffer. Add flags to mark memory
readable and writable. Mark memory readonly in v4l2-source.

Pass the daemon activation area to the client in the transport event.
This never changes and need to be handled differently from the other
activation areas.

Use the right flags when importing memory.

Add the (desired) memory type to mempool_alloc.

improve some debug.
2019-07-25 12:10:05 +02:00
Wim Taymans 2caf81c97c mem: improve memory handling
Add a memory pool to manage blocks of memory. Make it possible
to allocate and import blocks.

Add add_mem and remove_mem to the core events to signal a client
of a block of memory. Remove the client-node add_mem.

Make a global pool for memory and a per client pool where we
import and share the memory we need with the client.

Use the new memory pool to track and map memory in clients.
2019-07-23 17:46:43 +02:00
Wim Taymans 497a8364c5 printf format fixes 2019-06-07 17:16:02 +02:00
Wim Taymans db88e9f954 System: More work on making system functions pluggable
Move the epoll functions to the system functions and make the loop
use those. Use simple mask for events instead of enum.
Add the used system api in pw_loop.
Add System API to spa_support and use it where possible.
Pass the system API used in the realtime loops in spa_support as
well and use this in the realtime paths.
Improve bootstrapping, load only the log and cpu interfaces because
those can/need to be shared between instances. Let the core load
the other interfaces.
Add keys to configure the System and Loop implementations used in
pw_loop.
2019-06-06 15:31:53 +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
Wim Taymans 58fa5561b8 interface: get_registry always returns a Registry type 2019-05-21 15:46:31 +02:00
Wim Taymans 9ec3e3ab6d private: set min quantum to 32
Going as low as 32 is possible now with the better clock rate
estimation.
2019-04-25 13:04:44 +02:00
Wim Taymans dcddd5080b submodule update 2019-04-23 17:42:55 +02:00
Wim Taymans 45e2219149 update submodule 2019-04-11 16:39:08 +02:00
Wim Taymans 964be84e1c list: check for empty list before insert
We can't insert an empty list.
2019-03-08 11:34:28 +01:00
Wim Taymans b357b7a7da scheduling: don't use the graph helpers.
Simplify the scheduling by using simple lists and removing the
subgraphs etc..

Make the driver node trigger all nodes it manages and when they
complete, trigger the driver node to finish the graph.
2019-03-06 20:33:55 +01:00
Wim Taymans ed988788fd client-node: pass spa_node_info along
Pass the complete spa_node_info to update node information. Remove
the redundant max/min port info.
Update the remote node based on port and node update events.
2019-03-04 12:30:45 +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 499dd3ff22 node: add port and node params
Add a new struct spa_param_info that lists the available params on
a node/port and if they are readable/writable/updated. We can use
this to replace and improve the PARAM_List and also to notify
property change and updates.

Update elements and code to deal with this new param stuff. Add
port and node info to most elements and signal changes.

Use async enum_params in -inspect and use the param info to know
which ones to enumerate.

Use the port info to know what parameters to update in the
remote-node.
2019-02-27 16:43:01 +01:00
Wim Taymans 245a0d5634 global: pass bind function to _new
Make the bind function a callback instead of an event. We can then
get a return value and use that to clean up the pending proxy and
generate an error.
2019-02-25 17:16:40 +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