audioconvert: small cleanups

This commit is contained in:
Wim Taymans 2018-10-18 12:47:46 +02:00
parent c6551cead4
commit 79e976e5d7
2 changed files with 60 additions and 72 deletions

View file

@ -351,8 +351,7 @@ static int port_enum_formats(struct spa_node *node,
switch (*index) {
case 0:
if (direction == SPA_DIRECTION_OUTPUT) {
if (port->have_format) {
if (direction == SPA_DIRECTION_INPUT || port->have_format) {
*param = spa_format_audio_raw_build(builder,
SPA_PARAM_EnumFormat, &port->format.info.raw);
}
@ -381,12 +380,6 @@ static int port_enum_formats(struct spa_node *node,
DEFAULT_CHANNELS, 1, MAX_PORTS),
0);
}
}
else {
struct port *other = GET_IN_PORT(this, port_id);
*param = spa_format_audio_raw_build(builder,
SPA_PARAM_EnumFormat, &other->format.info.raw);
}
break;
default:
return 0;

View file

@ -104,8 +104,10 @@ static int init_port(struct impl *this, uint32_t port_id, uint32_t rate, uint32_
struct port *port = GET_OUT_PORT(this, port_id);
port->id = port_id;
port->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
snprintf(port->position, 7, "%s", rindex(spa_type_audio_channel[position].name, ':')+1);
port->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS;
port->info_props_items[0] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio");
port->info_props_items[1] = SPA_DICT_ITEM_INIT("port.channel", port->position);
port->info_props = SPA_DICT_INIT(port->info_props_items, 2);
@ -351,8 +353,7 @@ static int port_enum_formats(struct spa_node *node,
switch (*index) {
case 0:
if (direction == SPA_DIRECTION_INPUT) {
if (port->have_format) {
if (direction == SPA_DIRECTION_OUTPUT || port->have_format) {
*param = spa_format_audio_raw_build(builder,
SPA_PARAM_EnumFormat, &port->format.info.raw);
}
@ -386,12 +387,6 @@ static int port_enum_formats(struct spa_node *node,
DEFAULT_CHANNELS, 1, MAX_PORTS),
0);
}
}
else {
struct port *other = GET_OUT_PORT(this, port_id);
*param = spa_format_audio_raw_build(builder,
SPA_PARAM_EnumFormat, &other->format.info.raw);
}
break;
default:
return 0;