stream: Change PW_CAPABILITY_DEVICE_ID_NEGOTIATION to a version number

This allows easier evolvement of the negotiation protocol.
This commit is contained in:
Jonas Ådahl 2026-01-22 14:39:46 +01:00 committed by Wim Taymans
parent 04793138b5
commit 8600721de0
3 changed files with 12 additions and 9 deletions

View file

@ -438,8 +438,9 @@ discover_capabilities(struct data *data, const struct spa_pod *param)
return;
spa_dict_for_each(it, &dict) {
if (spa_streq(it->key, PW_CAPABILITY_DEVICE_ID_NEGOTIATION) &&
spa_streq(it->value, "true")) {
if (spa_streq(it->key, PW_CAPABILITY_DEVICE_ID_NEGOTIATION)) {
int version = atoi(it->value);
if (version >= 1)
data->device_negotiation_supported = true;
} else if (spa_streq(it->key, PW_CAPABILITY_DEVICE_IDS)) {
collect_device_ids(data, it->value);
@ -787,7 +788,7 @@ int main(int argc, char *argv[])
params[n_params++] =
spa_param_dict_build_dict(&b, SPA_PARAM_Capability,
&SPA_DICT_ITEMS(
SPA_DICT_ITEM(PW_CAPABILITY_DEVICE_ID_NEGOTIATION, "true")));
SPA_DICT_ITEM(PW_CAPABILITY_DEVICE_ID_NEGOTIATION, "1")));
#endif
/* now connect the stream, we need a direction (input/output),

View file

@ -450,8 +450,9 @@ discover_capabilities(struct data *data, const struct spa_pod *param)
return;
spa_dict_for_each(it, &dict) {
if (spa_streq(it->key, PW_CAPABILITY_DEVICE_ID_NEGOTIATION) &&
spa_streq(it->value, "true")) {
if (spa_streq(it->key, PW_CAPABILITY_DEVICE_ID_NEGOTIATION)) {
int version = atoi(it->value);
if (version >= 1)
data->device_negotiation_supported = true;
}
}
@ -799,7 +800,7 @@ int main(int argc, char *argv[])
params[n_params++] =
spa_param_dict_build_dict(&b, SPA_PARAM_Capability,
&SPA_DICT_ITEMS(SPA_DICT_ITEM(PW_CAPABILITY_DEVICE_ID_NEGOTIATION, "true"),
&SPA_DICT_ITEMS(SPA_DICT_ITEM(PW_CAPABILITY_DEVICE_ID_NEGOTIATION, "1"),
#ifdef SUPPORT_DEVICE_IDS_LIST
SPA_DICT_ITEM(PW_CAPABILITY_DEVICE_IDS, device_ids)
#endif /* SUPPORT_DEVICE_IDS_LIST */