Commit graph

12894 commits

Author SHA1 Message Date
Wim Taymans
ce89ce304d alsa: fix compilation wirh -UFASTPATH 2024-07-30 09:53:14 +02:00
Wim Taymans
802972f1ae ump: handle f0 .. f0 f7 .. f0 f7 .. f7 packets
Support the RFC 4695 sysex segmentation rules where a sysex packet can
be split into multiple chunks using the f0 and f7 patterns like:

begin      f0 ... f0
continue   f7 ... f0
end        f7 ... f7

Add a unit test for the sysex UMP conversion.
2024-07-30 09:38:40 +02:00
Wim Taymans
e507c03ad3 doc: update some MIDI docs
The current situation is:

 - The ALSA sequencer produces and consumes raw UMP only. Legacy input
   is converted with the control mixer to UMP.
 - All apps and plugins are made to consume and produce UMP.
 - The control mixer can convert between UMP and MIDI when required.
 - Legacy apps (pw-filter) will still receive MIDI1 events (converted by
   the control mixer).
 - Helper functions to convert UMP to and from MIDI can be used to ease
   implementation when legacy MIDI is still required.

Using UMP natively over raw MIDI has some advantages:

 - Transparent support for MIDI2 hardware and the new MIDI2 features
   such as increased resolution for events, microtonal support, etc..
 - Easy to convert between legacy MIDI and UMP
 - Large SysEx can be fragmented properly.
 - Fixed size messages are easier to parse and handle.
2024-07-30 09:38:40 +02:00
Wim Taymans
d057c95b2b midifile: add support for UMP
Add a type to the events, which can be MIDI1 or UMP.

Add debug functions for UMP messages.

midifile only supports saving MIDI1 format files for now. It will convert
to MIDI1 when asked to write an UMP message.

In pw-cat, convert the MIDI1 messages to UMP before sending into the
graph.
2024-07-30 09:38:40 +02:00
Wim Taymans
d9e7a10b0d modules: accept and produce UMP only 2024-07-30 09:38:40 +02:00
Wim Taymans
40cd8535eb audioconvert: only accept UMP on the control port 2024-07-30 09:38:40 +02:00
Wim Taymans
94bb5a2dd2 alsa: add UMP support
Use the new UMP alsa sequencer API to make it produce UMP packets.

Set the alsa sequencer to MIDI2.0, which will make it convert all
messages to MIDI-2.0 UMP automatically. We can copy this straight into
the control buffers.

This also solves some problems with large sysex messages that are now
nicely split into chunks with UMP.
2024-07-30 09:38:40 +02:00
Wim Taymans
7f38653589 filter: Use the stream DSP format to negotiate control types
Add OSC and UMP control types and make sure the mixer converts to the
selected format.

Mostly useful for legacy filters that use the old MIDI format, placing
the Midi control type in the format will make the mixer convert to it.
2024-07-30 09:38:18 +02:00
Wim Taymans
0c4ea83b89 control: add support for mixing to UMP
Check the negotiated control output format and convert to it when
necessary.
2024-07-29 18:15:58 +02:00
Wim Taymans
648ba982d4 jack: Add UMP to MIDI conversions
Add 2 new port format extensions, one for OSC and another for UMP.

Make sure we convert the events from UMP/OSC/MIDI to jack events
depending on the port type.

Try to produce UMP by default.
2024-07-29 18:15:58 +02:00
Wim Taymans
7b03a41e3d spa: add some helpers to convert MIDI to and from UMP 2024-07-29 18:15:57 +02:00
Wim Taymans
3e87aca7a9 spa: Add UMP control type
UMP (universal Midi Packet) is an improved version of transmitting MIDI
messages. It also has support for MIDI 2.0 and is backwards compatible
with MIDI 1.0.
2024-07-29 18:15:57 +02:00
Wim Taymans
bb82b2e493 impl-port: improve IO_Buffers management on ports
Make sure we clear IO_Buffers on the port and mixer before we clear the
buffers or the format. The IO_Buffer is used to check if the port should
be processed or not and its update is synchronized with the data-thread.

Set IO_Buffers on the mixer and node only after we have configured the
buffers on the node.

See #4094
2024-07-29 18:15:09 +02:00
Wim Taymans
61dcd8dede audioconvert: set IO_Buffers only when buffers are negotiated
The IO_Buffers is used in the data thread to check if the port should be
scheduled or not. Make sure it is only set after we set buffers on the
port and cleared before the buffers are cleared.

Make sure we sync the port->io with the data thread.

See #4094
2024-07-29 18:15:06 +02:00
Pauli Virtanen
d7235c1dbd doc: rename pipewire-devices.7 and move stream properties into it
Collect the list of object properties into a single place.

Group properties in the index based on the object type. Consider
"Monitor" as a separate object type, as it's generally configured
separately.

Add something about Port, Link, and Client properties. Just explain some
of these as they're fairly technical, so just link to API docs.
2024-07-28 14:06:34 +00:00
Pauli Virtanen
3d8fb4844c doc: drop the links to configuration wiki pages
The wiki pages mostly just duplicate the content here.
2024-07-28 14:06:34 +00:00
Vlad
308a93bd14 bluez5: Update default sync_factor
Due to the how the kernel part of BlueZ computes the extended
advertising interval for a Broadcast Source, a sync_factor smaller
than 2 will result in an invalid interval value (too small).
2024-07-28 13:45:45 +00:00
Pauli Virtanen
23f02b0d98 CI: build docs also for 1.2 branch, and show them on main page 2024-07-25 21:25:48 +03:00
Wim Taymans
57b495f775 module-netjack2: support local.ifname for manager
Fixes #4141
2024-07-22 13:34:14 +02:00
Wim Taymans
959491966a modules: fix doc
Fixes #4134
2024-07-22 13:21:27 +02:00
Wim Taymans
db710359ad impl-link: make async link when on e of the nodes is async
We simply cannot schedule async nodes properly if we don't have the
async link. This change was done to make sure that driver sources don't
end up with async buffers and cause a unneccesary 1 cycle delay in
async clients. But we can fix this in a better way, like this:

Increment the cycle counter after we copy the output port buffers. This
ensures the async clients immediately pick up the new buffers (or the
output buffers from the previous cycle).

Also remove some old compatibility code that is no longer useful.

Fixes #4138
See #4133
2024-07-22 13:10:33 +02:00
Wim Taymans
2a8a08f303 loop: signal when queue is full
When our queue is full, signal the wakeup event to make sure the thread
will wake up and try to clear the queue before we go to sleep.
2024-07-20 14:05:09 +02:00
Wim Taymans
8a62563d5b module-rtp: fix ptime and target_buffer checks
target_buffer is in samples and ptime in msec so we can't really compare
them. Use psamples instead, which is ptime but then as samples.

See #4095
2024-07-19 13:17:51 +02:00
Wim Taymans
9a313a5d42 link-factory: destroy all links in error
There is no possibility to recover from this so simply destroy the link.
The clients should already have received the link status when we destroy
it.
2024-07-19 12:06:09 +02:00
Wim Taymans
7447dedef4 module-netjack2: implement netjack2.connect
When netjack2.connect is true, make streams and set the autoconnect
property on them. Otherwise, make sink/source as it was before.

Fixes #4125
2024-07-19 11:48:14 +02:00
Wim Taymans
0062d64b3a module-netjack2: stop follower when setup io errors out
Just disable the data socket when it errors out but stop the follower
when the setup socket is in error.

This makes shutdown work properly when the setup socket is stopped,
which is what actually happens eventually.
2024-07-19 11:47:07 +02:00
Wim Taymans
b5a7a1f224 module-netjack2: improve port names
Let the default port logic make the port names. For network nodes this
will be with a send/recv prefix.
2024-07-19 11:42:51 +02:00
Wim Taymans
842e620c1a jack: jack_get_time() returns microseconds
As found by David García Goñi

Fixes #4128
2024-07-19 10:04:44 +02:00
Wim Taymans
398060bc7b jack: don't check timestamps in mixdown
jack_port_get_buffer() can be called with 0 frames, This is to restrict
the available space in the returned midi buffer after mixdown. While we
mixdown, we should not check timestamps so that all midi events are
added to the mixdown buffer.

Fixes qsynth.
2024-07-18 16:49:11 +02:00
Wim Taymans
c73b56db38 fix compilation 2024-07-18 14:24:53 +02:00
Wim Taymans
280bbd88d4 modules: don't unload module on stream error
Unloading the module on stream errors is a bit too much because a
suspend can clear the stream error again (or the error might not be
fatal)

This can happen for example when negotiation fails on some stream ports
(wireplumber tries to link the midi ports to audio ports) and it's
better to not completely fail on that.

Fixes #4121
2024-07-18 14:15:22 +02:00
Wim Taymans
32e4553a05 impl-node: always INACTIVATE when stopping
A remote node is prepared when the Start command sync reply has been
received.

If we however quickly switch from active to inactive, the
pending reply is cancelled but the remote node will have set the
FINISHED status and will be ready to be scheduled.

Make it so that we always set the INACTIVE status when the node is
canceled and unprepared, even if we didn't get the reply and the node
was not prepared.

Fixes #4122
2024-07-18 13:44:36 +02:00
Arun Raghavan
0dc17d8d88 spa: alsa: Fix stale function name in comment 2024-07-17 20:07:57 -04:00
Daniel Lundqvist
8b613e20d9 module-jack-tunnel: Properly propagate error from dlopen()
dlopen() does not set errno on failure, rather you're supposed to call
dlerror() to get the latest error. dlerror() return a string so
instead return -ENOENT from weakjack_load_by_path().

Depending on errno weakjack_load() could think it successfully loaded
the library, and later module-jack-tunnel would crash because it call
a NULL function pointer.
2024-07-17 20:26:56 +02:00
Sven Püschel
0c07c78621 spa: libcamera: uncomment setting integer controls
When using Open Broadcaster Software with Pipewire and a libcamera
camera node, changing the ExposureTime doesn't work.

The commit introducing the camera control setting has commented out the
integer case: ef4b9745b2 ("libcamera: handle canceled requests")
But as it doesn't give a reson for the comment, it looks like an
oversight.

Therefore removing the comment to allow setting the ExposureTime integer.

Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
2024-07-17 16:00:23 +00:00
Sven Püschel
5932963506 spa: match camera property types with libcamera
The Pipewire libcamera spa plugin exposes multiple camera properties.
Unlike v4l2, libcamera usually exposes these as normalized floating
point values. But as the SPA_PROP types are based on v4l2, they are
currently set to integers.

This causes a problem when using pw-cli to change the properties,
as the spa_json_to_pod_part function casts the properties according
to their spa_type_info. Other software that doesn't depend on the
spa_type_info can correctly set the properties, as the values are
encoded in the spa_pod type and therefore also carry a type.

As the limited range from switching integers to floats is likely not a
problem, the affected spa properties were changed to the Float type.
This will cause pw-cli to also generate spa_pod values of type float
when setting v4l2 properties. Therefore the v4l2 spa plugin is also
adapted to allow floating point properties and cast these to integers.

Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de>
2024-07-17 15:56:53 +00:00
Arun Raghavan
ab5fadec2b pw-profiler: Move clients' legend away from graph data
With a large number of clients, some of them might be obscured by the
graph. Separate out the legend for now. We might be able to do better
formatting, but for now, this should do.
2024-07-17 15:54:34 +00:00
Arun Raghavan
585106df04 pw-profiler: Add more explanatory text to profile graphs
Should help make it easier to parse what each field means.
2024-07-17 15:54:34 +00:00
Arun Raghavan
41c30d3564 impl-node: Document timing-related pw_node_activation fields
Should make the meanings of the fields a bit clearer.
2024-07-17 15:54:34 +00:00
Arun Raghavan
a3c68ef9cf module-rtp: Make max SAP sessions configurable
Keep the current limit, but allow for more if someone wants to track
more.
2024-07-16 08:45:50 -04:00
Frédéric Danis
291fd9704f bluez5: backend-native: Send error for not supported event only as AG
The HS/HF roles should not sent error messages, only commands.
2024-07-15 13:27:30 +02:00
Wim Taymans
3de4f0d48b pw-profiler: add -n and -J options
The -n option sets the number of iterations to log.

The -J option dumps the raw profiler data as JSON on stdout.
2024-07-15 12:23:58 +02:00
Wim Taymans
d4515378e7 node-driver: 5 seconds of freewheel timeout is enough
We retry to run the graph every 5 seconds in case it didn't complete. A
10 seconds timeout feels quite long.
2024-07-12 12:25:18 +02:00
Wim Taymans
42096de3cc node: add a clock XRUN_RECOVER flag
Make a new flag that is set when the process function is called because
of a recover from a graph xrun.

Use this flag in the freewheel driver to detect a recover and to avoid
scheduling a new timeout. We should schedule a new timeout only when the
process function was called after completion.

This fixes export in ardour some more when the initial driver timeout
didn't complete (when, for example, some nodes were still starting up).
2024-07-12 12:21:59 +02:00
Wim Taymans
73d41308b1 module-raop: remove unused deprecated header 2024-07-10 19:20:26 +02:00
Wim Taymans
4baa94fce2 thread: make it possible to set a custom create function
Make a property to pass a custom function pointer to create threads
instead of pthread_create.

Use this in jack instead of bypassing the thread utils create function,
which gives the wrong thread rt priority with rtkit.

Fixes #4099
2024-07-09 17:04:35 +02:00
Wim Taymans
853a46120e v4l2: Improve format and control enumeration
Use dynamic pod builder so that we can also build complex formats.

Make sure we zero the format before we parse it or else we end up with
potentially uninitialized values.

When ENUM_FRAMESIZES or VIDIOC_ENUM_FRAMEINTERVALS return EINVAL for the
first index, make a dummy result and continue with that. This will
trigger an intersect withe filter so that we end up with something valid
instead of nothing.

Handle 0 framerates without crashing.

See #4063
2024-07-09 14:14:42 +02:00
Wim Taymans
2c1ec7fa43 v4l2: use a dynamic pod builder to handle larger PropInfo
The labels from the vivid driver need more space so use a dynamic
builder to make sure we can handle them.

See #4063
2024-07-09 09:23:49 +02:00
Wim Taymans
8cff77706a module-snapcast: don't hardcode the JSON message id
Use a counter to make it increment for each message.
2024-07-09 09:10:31 +02:00
Arun Raghavan
9b33cea0f7 module-rtp: Minor robustness improvement to PTP socket reading
Mark socket as CLOEXEC like we do everything else, log when we flush
stale data, and check for errors in the while loop.
2024-07-06 22:45:56 +00:00