commit 7c5b5d12ed1497240f6b0a79ab93be9dcd1c1d0c
Author: Nedko Arnaudov <nedko@nedk.org>
Date:   Wed Mar 11 19:13:15 2026 +0200

    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.

diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c
index 56191b93c..d34d96bd6 100644
--- a/pipewire-jack/src/pipewire-jack.c
+++ b/pipewire-jack/src/pipewire-jack.c
@@ -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
