mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
audioconvert: handle unexpected channel positions
This commit is contained in:
parent
ef98361630
commit
c160a063b9
2 changed files with 16 additions and 5 deletions
|
|
@ -208,8 +208,14 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
|
||||||
port->direction = direction;
|
port->direction = direction;
|
||||||
port->id = port_id;
|
port->id = port_id;
|
||||||
|
|
||||||
snprintf(port->position, 16, "%s",
|
if (position < SPA_N_ELEMENTS(spa_type_audio_channel)) {
|
||||||
spa_debug_type_short_name(spa_type_audio_channel[position].name));
|
snprintf(port->position, 16, "%s",
|
||||||
|
spa_debug_type_short_name(spa_type_audio_channel[position].name));
|
||||||
|
} else if (position >= SPA_AUDIO_CHANNEL_CUSTOM_START) {
|
||||||
|
snprintf(port->position, 16, "AUX%d", position - SPA_AUDIO_CHANNEL_CUSTOM_START);
|
||||||
|
} else {
|
||||||
|
snprintf(port->position, 16, "UNK");
|
||||||
|
}
|
||||||
|
|
||||||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||||
SPA_PORT_CHANGE_MASK_PROPS |
|
SPA_PORT_CHANGE_MASK_PROPS |
|
||||||
|
|
|
||||||
|
|
@ -157,9 +157,14 @@ static int init_port(struct impl *this, enum spa_direction direction,
|
||||||
port->direction = direction;
|
port->direction = direction;
|
||||||
port->id = port_id;
|
port->id = port_id;
|
||||||
|
|
||||||
snprintf(port->position, 7, "%s",
|
if (position < SPA_N_ELEMENTS(spa_type_audio_channel)) {
|
||||||
spa_debug_type_short_name(spa_type_audio_channel[position].name));
|
snprintf(port->position, 16, "%s",
|
||||||
|
spa_debug_type_short_name(spa_type_audio_channel[position].name));
|
||||||
|
} else if (position >= SPA_AUDIO_CHANNEL_CUSTOM_START) {
|
||||||
|
snprintf(port->position, 16, "AUX%d", position - SPA_AUDIO_CHANNEL_CUSTOM_START);
|
||||||
|
} else {
|
||||||
|
snprintf(port->position, 16, "UNK");
|
||||||
|
}
|
||||||
|
|
||||||
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
port->info_all = SPA_PORT_CHANGE_MASK_FLAGS |
|
||||||
SPA_PORT_CHANGE_MASK_PROPS |
|
SPA_PORT_CHANGE_MASK_PROPS |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue