adapter: use internalFormat for EnumFormat and Format

Always place the follower EnumFormat or Format as internalFormat on
the EnumPortConfig and PortConfig respectively.

This ways, internalFormat always refers to the follower formats and
the format is the external format after (optional) conversion by the
adapter.

The idea was to keep some sort of compatibility with older versions but
that doesn't really apply because the format was never used on
EnumPortConfig and interalFormat didn't exist.
This commit is contained in:
Wim Taymans 2026-06-15 11:12:43 +02:00
parent 5cf5e335eb
commit bdf5b5a2a7
2 changed files with 6 additions and 10 deletions

View file

@ -32,9 +32,9 @@ enum spa_param_port_config {
SPA_PARAM_PORT_CONFIG_mode, /**< (Id enum spa_param_port_config_mode) mode */ SPA_PARAM_PORT_CONFIG_mode, /**< (Id enum spa_param_port_config_mode) mode */
SPA_PARAM_PORT_CONFIG_monitor, /**< (Bool) enable monitor output ports on input ports */ SPA_PARAM_PORT_CONFIG_monitor, /**< (Bool) enable monitor output ports on input ports */
SPA_PARAM_PORT_CONFIG_control, /**< (Bool) enable control ports */ SPA_PARAM_PORT_CONFIG_control, /**< (Bool) enable control ports */
SPA_PARAM_PORT_CONFIG_format, /**< (Object) possible/external format configuration */ SPA_PARAM_PORT_CONFIG_format, /**< (Object) external format configuration */
SPA_PARAM_PORT_CONFIG_group, /**< (String) the port group name */ SPA_PARAM_PORT_CONFIG_group, /**< (String) the port group name */
SPA_PARAM_PORT_CONFIG_internalFormat, /**< (Object) actual internal format */ SPA_PARAM_PORT_CONFIG_internalFormat, /**< (Object) possible/actual internal format */
}; };
/** /**

View file

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