mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: refactor channel position parsing
This commit is contained in:
parent
eca4049a38
commit
ad6ab7e0b7
3 changed files with 18 additions and 10 deletions
|
|
@ -390,6 +390,22 @@ void channel_map_parse(const char *str, struct channel_map *map)
|
|||
}
|
||||
}
|
||||
|
||||
void channel_map_parse_position(const char *str, struct channel_map *map)
|
||||
{
|
||||
struct spa_json it[2];
|
||||
char v[256];
|
||||
|
||||
spa_json_init(&it[0], str, strlen(str));
|
||||
if (spa_json_enter_array(&it[0], &it[1]) <= 0)
|
||||
spa_json_init(&it[1], str, strlen(str));
|
||||
|
||||
map->channels = 0;
|
||||
while (spa_json_get_string(&it[1], v, sizeof(v)) > 0 &&
|
||||
map->channels < SPA_AUDIO_MAX_CHANNELS) {
|
||||
map->map[map->channels++] = channel_name2id(v);
|
||||
}
|
||||
}
|
||||
|
||||
bool channel_map_valid(const struct channel_map *map)
|
||||
{
|
||||
uint8_t i;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue