Use "8 bit raw midi" for control ports again

There is no need to encode the potential format in the format.dsp of
control ports, this is just for legacy compatibility with JACK apps. The
actual format can be negotiated with the types field.

Fixes midi port visibility with apps compiled against 1.2, such as JACK
apps in flatpaks.
This commit is contained in:
Wim Taymans 2025-05-23 16:46:13 +02:00
parent 617f1b8a38
commit 564c9b1ba5
15 changed files with 18 additions and 34 deletions

View file

@ -3466,24 +3466,6 @@ static const char* type_to_string(jack_port_type_id_t type_id)
}
}
static const char* type_to_format_dsp(jack_port_type_id_t type_id)
{
switch(type_id) {
case TYPE_ID_AUDIO:
return JACK_DEFAULT_AUDIO_TYPE;
case TYPE_ID_VIDEO:
return JACK_DEFAULT_VIDEO_TYPE;
case TYPE_ID_OSC:
return JACK_DEFAULT_OSC_TYPE;
case TYPE_ID_MIDI:
return JACK_DEFAULT_MIDI_TYPE;
case TYPE_ID_UMP:
return JACK_DEFAULT_UMP_TYPE;
default:
return NULL;
}
}
static bool type_is_dsp(jack_port_type_id_t type_id)
{
switch(type_id) {
@ -5546,7 +5528,7 @@ jack_port_t * jack_port_register (jack_client_t *client,
spa_list_init(&p->mix);
pw_properties_set(p->props, PW_KEY_FORMAT_DSP, type_to_format_dsp(type_id));
pw_properties_set(p->props, PW_KEY_FORMAT_DSP, type_to_string(type_id));
pw_properties_set(p->props, PW_KEY_PORT_NAME, port_name);
if (flags > 0x1f) {
pw_properties_setf(p->props, PW_KEY_PORT_EXTRA,

View file

@ -275,7 +275,7 @@ static void emit_port_info(struct seq_state *this, struct seq_port *port, bool f
snprintf(alias, sizeof(alias), "%s:%s", client_name, port_name);
clean_name(alias);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit raw UMP");
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi");
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_OBJECT_PATH, path);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, name);
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_ALIAS, alias);

View file

@ -375,7 +375,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_IGNORE_LATENCY, "true");
} else if (PORT_IS_CONTROL(this, port->direction, port->id)) {
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, "control");
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit raw UMP");
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi");
}
if (this->group_name[0] != '\0')
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, this->group_name);

View file

@ -2024,13 +2024,13 @@ impl_init(const struct spa_handle_factory *factory,
for (i = 0; i < N_PORTS; ++i) {
struct port *port = &this->ports[i];
static const struct spa_dict_item in_port_items[] = {
SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit raw UMP"),
SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi"),
SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, "in"),
SPA_DICT_ITEM_INIT(SPA_KEY_PORT_ALIAS, "in"),
SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, "group.0"),
};
static const struct spa_dict_item out_port_items[] = {
SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit raw UMP"),
SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi"),
SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, "out"),
SPA_DICT_ITEM_INIT(SPA_KEY_PORT_ALIAS, "out"),
SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, "group.0"),

View file

@ -240,7 +240,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_IGNORE_LATENCY, "true");
} else if (PORT_IS_CONTROL(this, port->direction, port->id)) {
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, "control");
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "32 bit raw UMP");
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi");
}
if (this->group_name[0] != '\0')
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, this->group_name);

View file

@ -213,7 +213,7 @@ int main(int argc, char *argv[])
PW_FILTER_PORT_FLAG_MAP_BUFFERS,
sizeof(struct port),
pw_properties_new(
PW_KEY_FORMAT_DSP, "32 bit raw UMP",
PW_KEY_FORMAT_DSP, "8 bit raw midi",
PW_KEY_PORT_NAME, "output",
NULL),
NULL, 0);

View file

@ -772,7 +772,7 @@ static int make_stream_ports(struct stream *s)
break;
case ffado_stream_type_midi:
props = pw_properties_new(
PW_KEY_FORMAT_DSP, "32 bit raw UMP",
PW_KEY_FORMAT_DSP, "8 bit raw midi",
PW_KEY_PORT_NAME, port->name,
PW_KEY_PORT_PHYSICAL, "true",
PW_KEY_PORT_TERMINAL, "true",

View file

@ -540,7 +540,7 @@ static void make_stream_ports(struct stream *s)
} else {
snprintf(name, sizeof(name), "midi_%s_%d", prefix, i - s->info.channels + 1);
props = pw_properties_new(
PW_KEY_FORMAT_DSP, "32 bit raw UMP",
PW_KEY_FORMAT_DSP, "8 bit raw midi",
PW_KEY_PORT_NAME, name,
PW_KEY_PORT_PHYSICAL, "true",
NULL);

View file

@ -452,7 +452,7 @@ static void make_stream_ports(struct stream *s)
} else {
snprintf(name, sizeof(name), "midi%d", i - s->info.channels);
props = pw_properties_new(
PW_KEY_FORMAT_DSP, "32 bit raw UMP",
PW_KEY_FORMAT_DSP, "8 bit raw midi",
PW_KEY_AUDIO_CHANNEL, name,
PW_KEY_PORT_PHYSICAL, "true",
NULL);

View file

@ -614,7 +614,7 @@ static void make_stream_ports(struct stream *s)
} else {
snprintf(name, sizeof(name), "midi%d", i - s->info.channels);
props = pw_properties_new(
PW_KEY_FORMAT_DSP, "32 bit raw UMP",
PW_KEY_FORMAT_DSP, "8 bit raw midi",
PW_KEY_PORT_PHYSICAL, "true",
PW_KEY_AUDIO_CHANNEL, name,
NULL);

View file

@ -390,7 +390,7 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
res = -EINVAL;
goto out;
}
pw_properties_set(props, PW_KEY_FORMAT_DSP, "32 bit raw UMP");
pw_properties_set(props, PW_KEY_FORMAT_DSP, "8 bit raw midi");
impl->stride = impl->format_info->size;
impl->rate = pw_properties_get_uint32(props, "midi.rate", 10000);
if (impl->rate == 0)

View file

@ -307,7 +307,7 @@ struct vban_stream *vban_stream_new(struct pw_core *core,
res = -EINVAL;
goto out;
}
pw_properties_set(props, PW_KEY_FORMAT_DSP, "32 bit raw UMP");
pw_properties_set(props, PW_KEY_FORMAT_DSP, "8 bit raw midi");
impl->stride = impl->format_info->size;
impl->rate = pw_properties_get_uint32(props, "midi.rate", 10000);
if (impl->rate == 0)

View file

@ -1855,8 +1855,10 @@ void *pw_filter_add_port(struct pw_filter *filter,
add_control_dsp_port_params(impl, p, 1u << SPA_CONTROL_Midi);
else if (spa_streq(str, "8 bit raw control"))
add_control_dsp_port_params(impl, p, 0);
else if (spa_streq(str, "32 bit raw UMP"))
else if (spa_streq(str, "32 bit raw UMP")) {
add_control_dsp_port_params(impl, p, 1u << SPA_CONTROL_UMP);
pw_properties_set(props, PW_KEY_FORMAT_DSP, "8 bit raw midi");
}
}
/* then override with user provided if any */
if (update_params(impl, p, SPA_ID_INVALID, params, n_params) < 0)

View file

@ -2055,7 +2055,7 @@ pw_stream_connect(struct pw_stream *stream,
pw_properties_set(impl->port_props, PW_KEY_FORMAT_DSP, str);
else if (impl->media_type == SPA_MEDIA_TYPE_application &&
impl->media_subtype == SPA_MEDIA_SUBTYPE_control)
pw_properties_set(impl->port_props, PW_KEY_FORMAT_DSP, "32 bit raw UMP");
pw_properties_set(impl->port_props, PW_KEY_FORMAT_DSP, "8 bit raw midi");
if (pw_properties_get(impl->port_props, PW_KEY_PORT_GROUP) == NULL)
pw_properties_set(impl->port_props, PW_KEY_PORT_GROUP, "stream.0");

View file

@ -1985,7 +1985,7 @@ int main(int argc, char *argv[])
SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application),
SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control));
pw_properties_set(data.props, PW_KEY_FORMAT_DSP, "32 bit raw UMP");
pw_properties_set(data.props, PW_KEY_FORMAT_DSP, "8 bit raw midi");
break;
case TYPE_DSD:
{