port-config: add internalFormat to PortConfig

Use the Format for all possible formats on the
EnumPortConfig and the configured external format on PortConfig.

Make a new internalFormat that contains the configured format of the
adapter follower.

Make pw-top use the PortConfig internalFormat in the FORMAT view and fall
back to Format, when not available (for older clients).
This commit is contained in:
Wim Taymans 2026-06-12 17:50:46 +02:00
parent d780f4f535
commit b5555cc3f6
5 changed files with 23 additions and 10 deletions

View file

@ -173,16 +173,20 @@ static int convert_enum_port_config(struct impl *this,
{
struct spa_pod *f1, *f2 = NULL, *format = NULL;
struct spa_pod_frame f[1];
uint32_t fmt_id, fmt_start = 0;
uint32_t fmt_id, fmt_start = 0, pc_id;
int res;
if (this->convert == NULL)
return 0;
if (id == SPA_PARAM_EnumPortConfig)
if (id == SPA_PARAM_EnumPortConfig) {
fmt_id = SPA_PARAM_EnumFormat;
else
pc_id = SPA_PARAM_PORT_CONFIG_format;
}
else {
fmt_id = SPA_PARAM_Format;
pc_id = SPA_PARAM_PORT_CONFIG_internalFormat;
}
res = spa_node_port_enum_params_sync(this->follower,
this->direction, 0,
@ -195,7 +199,7 @@ static int convert_enum_port_config(struct impl *this,
0);
if (res > 0) {
spa_pod_builder_add(builder,
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(format),
pc_id, SPA_POD_Pod(format),
0);
}
f1 = spa_pod_builder_pop(builder, &f[0]);
@ -253,7 +257,8 @@ next:
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(this->direction),
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(
SPA_PARAM_PORT_CONFIG_MODE_passthrough),
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(format));
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(format),
SPA_PARAM_PORT_CONFIG_internalFormat, SPA_POD_Pod(format));
result.next++;
res = 1;
break;

View file

@ -558,7 +558,7 @@ static int node_param_port_config(struct impl *this, uint32_t id, uint32_t index
}
if (dir->have_format) {
spa_pod_builder_prop(b, SPA_PARAM_PORT_CONFIG_format, 0);
spa_format_audio_raw_build(b, id, &dir->format.info.raw);
spa_format_audio_build(b, id, &dir->format);
}
*param = spa_pod_builder_pop(b, &f[0]);
break;