mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
audioconvert: small cleanups
This commit is contained in:
parent
c6551cead4
commit
79e976e5d7
2 changed files with 60 additions and 72 deletions
|
|
@ -351,8 +351,7 @@ static int port_enum_formats(struct spa_node *node,
|
||||||
|
|
||||||
switch (*index) {
|
switch (*index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (direction == SPA_DIRECTION_OUTPUT) {
|
if (direction == SPA_DIRECTION_INPUT || port->have_format) {
|
||||||
if (port->have_format) {
|
|
||||||
*param = spa_format_audio_raw_build(builder,
|
*param = spa_format_audio_raw_build(builder,
|
||||||
SPA_PARAM_EnumFormat, &port->format.info.raw);
|
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),
|
DEFAULT_CHANNELS, 1, MAX_PORTS),
|
||||||
0);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -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);
|
struct port *port = GET_OUT_PORT(this, port_id);
|
||||||
|
|
||||||
port->id = 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);
|
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[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_items[1] = SPA_DICT_ITEM_INIT("port.channel", port->position);
|
||||||
port->info_props = SPA_DICT_INIT(port->info_props_items, 2);
|
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) {
|
switch (*index) {
|
||||||
case 0:
|
case 0:
|
||||||
if (direction == SPA_DIRECTION_INPUT) {
|
if (direction == SPA_DIRECTION_OUTPUT || port->have_format) {
|
||||||
if (port->have_format) {
|
|
||||||
*param = spa_format_audio_raw_build(builder,
|
*param = spa_format_audio_raw_build(builder,
|
||||||
SPA_PARAM_EnumFormat, &port->format.info.raw);
|
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),
|
DEFAULT_CHANNELS, 1, MAX_PORTS),
|
||||||
0);
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue