audioconvert: do _port_set_param on fmtconvert if convert mode

The fmtconvert plugin does not support SPA_PARAM_PortConfig. Instead, we need to
set the format in the specific port with SPA_PARAM_Format.
This commit is contained in:
Julian Bouzas 2021-08-20 14:46:34 -04:00 committed by Wim Taymans
parent dedc08cdf8
commit b368bea98c
2 changed files with 17 additions and 8 deletions

View file

@ -729,13 +729,20 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
spa_pod_builder_init(&b, buffer, sizeof(buffer));
param = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &info->info.raw);
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig,
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(direction),
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_dsp),
SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_Bool(monitor),
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
res = spa_node_set_param(this->fmt[direction], SPA_PARAM_PortConfig, 0, param);
if (mode == SPA_PARAM_PORT_CONFIG_MODE_dsp) {
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig,
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(direction),
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_dsp),
SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_Bool(monitor),
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
res = spa_node_set_param(this->fmt[direction], SPA_PARAM_PortConfig, 0, param);
} else {
res = spa_node_port_set_param(this->fmt[direction], direction, 0,
SPA_PARAM_Format, 0, param);
}
if (res < 0)
return res;

View file

@ -696,6 +696,7 @@ static int port_set_format(void *object,
port->params[PORT_Format] = SPA_PARAM_INFO(SPA_PARAM_Format, SPA_PARAM_INFO_WRITE);
port->params[PORT_Buffers] = SPA_PARAM_INFO(SPA_PARAM_Buffers, 0);
}
port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
emit_port_info(this, port, false);
return 0;
}
@ -1029,7 +1030,8 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
port->id = port_id;
spa_list_init(&port->queue);
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS;
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
SPA_PORT_CHANGE_MASK_PARAMS;
port->info = SPA_PORT_INFO_INIT();
port->info.flags = SPA_PORT_FLAG_NO_REF |
SPA_PORT_FLAG_DYNAMIC_DATA;