pipewire-jack: fix jack_port_type_id() to return jack1/jack2 compatible values

pipewire-jack defines TYPE_ID_VIDEO=1 between audio and MIDI, shifting
TYPE_ID_MIDI to 2. This caused jack_port_type_id() to return 2 for MIDI
ports, breaking compatibility with jack1/jack2 which return 1.

The jack_port_type_id() return value is part of the public JACK API and
consumers such as jackdbus rely on the conventional values established
by jack1/jack2: 0 for audio, 1 for MIDI.

Map internal TYPE_ID_* values to their jack1/jack2 compatible equivalents
before returning. All MIDI variants (MIDI, OSC, UMP) map to 1. Video has
no jack1/jack2 equivalent so maps to 3, beyond the conventional range.
This commit is contained in:
Nedko Arnaudov 2026-03-11 19:13:15 +02:00 committed by Wim Taymans
parent b0065bfe9a
commit 7c5b5d12ed

View file

@ -6018,7 +6018,16 @@ jack_port_type_id_t jack_port_type_id (const jack_port_t *port)
return_val_if_fail(o != NULL, 0);
if (o->type != INTERFACE_Port)
return TYPE_ID_OTHER;
return o->port.type_id;
/* map internal type IDs to jack1/jack2 compatible public values */
switch (o->port.type_id) {
case TYPE_ID_AUDIO: return 0;
case TYPE_ID_MIDI:
case TYPE_ID_OSC:
case TYPE_ID_UMP: return 1; /* all MIDI variants map to 1 */
case TYPE_ID_VIDEO: return 3; /* video maps to 3 */
default: return o->port.type_id;
}
}
SPA_EXPORT