From bdf5b5a2a7f7acbf55241b5ecb74971daea3113f Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 15 Jun 2026 11:12:43 +0200 Subject: [PATCH] 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. --- spa/include/spa/param/port-config.h | 4 ++-- spa/plugins/audioconvert/audioadapter.c | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/spa/include/spa/param/port-config.h b/spa/include/spa/param/port-config.h index 686dd9099..d4038c947 100644 --- a/spa/include/spa/param/port-config.h +++ b/spa/include/spa/param/port-config.h @@ -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_monitor, /**< (Bool) enable monitor output ports on input 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_internalFormat, /**< (Object) actual internal format */ + SPA_PARAM_PORT_CONFIG_internalFormat, /**< (Object) possible/actual internal format */ }; /** diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index db95856a7..5bb8e4130 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -173,20 +173,16 @@ 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, pc_id; + uint32_t fmt_id, fmt_start = 0; int res; if (this->convert == NULL) return 0; - if (id == SPA_PARAM_EnumPortConfig) { + if (id == SPA_PARAM_EnumPortConfig) fmt_id = SPA_PARAM_EnumFormat; - pc_id = SPA_PARAM_PORT_CONFIG_format; - } - else { + 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, @@ -199,7 +195,7 @@ static int convert_enum_port_config(struct impl *this, 0); if (res > 0) { spa_pod_builder_add(builder, - pc_id, SPA_POD_Pod(format), + SPA_PARAM_PORT_CONFIG_internalFormat, SPA_POD_Pod(format), 0); } f1 = spa_pod_builder_pop(builder, &f[0]);