mixer: handle control.ump property

Add a control.ump port property. When true, the port wants UMP and the
mixer will convert to it. When false, the port supports both UMP and
Midi1 and no conversions will happen. When unset, the mixer will always
convert UMP to midi1.

Remove the CONTROL_types property from the filter. This causes problems
because this is the format negotiated with peers, which might not
support the types but can still be linked because the mixer will
convert.

The control.ump port property is supposed to be a temporary fix until we
can negotiate the mixer ports properly with the CONTROL_types.

Remove UMP handling from bluetooth midi, just use the raw Midi1 events
now that the mixer will give those and we are supposed to output our
unconverted format.

Fix midi events in-place in netjack because we can.

Update docs and pw-mididump to note that we are back to midi1 as the
default format.

With this, most of the midi<->UMP conversion should be gone again and we
should be able to avoid conversion problems in ALSA and PipeWire.

Fixes #5183
This commit is contained in:
Wim Taymans 2026-03-25 11:47:01 +01:00
parent 7fe191bc10
commit 9eeb2f1930
9 changed files with 88 additions and 105 deletions

View file

@ -72,6 +72,7 @@ struct impl {
struct spa_node node;
uint32_t quantum_limit;
uint32_t control_types;
struct spa_log *log;
@ -473,9 +474,9 @@ static int port_set_format(void *object,
if (!port->have_format) {
this->n_formats++;
port->have_format = true;
port->types = types;
spa_log_debug(this->log, "%p: set format on port %d:%d",
this, direction, port_id);
port->types = types == 0 ? this->control_types : types;
spa_log_debug(this->log, "%p: set format on port %d:%d types:%08x %08x",
this, direction, port_id, port->types, this->control_types);
}
}
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
@ -955,6 +956,8 @@ impl_init(const struct spa_handle_factory *factory,
}
this->quantum_limit = 8192;
/* by default we convert to midi1 */
this->control_types = 1u<<SPA_CONTROL_Midi;
for (i = 0; info && i < info->n_items; i++) {
const char *k = info->items[i].key;
@ -962,6 +965,14 @@ impl_init(const struct spa_handle_factory *factory,
if (spa_streq(k, "clock.quantum-limit")) {
spa_atou32(s, &this->quantum_limit, 0);
}
else if (spa_streq(k, "control.ump")) {
if (spa_atob(s))
/* we convert to UMP when forced */
this->control_types = 1u<<SPA_CONTROL_UMP;
else
/* when unforced we let both midi1 and UMP through */
this->control_types = 0;
}
}
spa_hook_list_init(&this->hooks);