pulse-server: split out media roles

Part of !776.
This commit is contained in:
Barnabás Pőcze 2021-06-18 22:50:32 +02:00
parent 62832609c1
commit 5318c0eeca
4 changed files with 93 additions and 29 deletions

View file

@ -24,6 +24,8 @@
#include <spa/utils/string.h>
#include "media-roles.h"
#define VOLUME_MUTED ((uint32_t) 0U)
#define VOLUME_NORM ((uint32_t) 0x10000U)
#define VOLUME_MAX ((uint32_t) UINT32_MAX/2)
@ -47,25 +49,6 @@ static inline float volume_to_linear(uint32_t vol)
return v * v * v;
}
struct str_map {
const char *pw_str;
const char *pa_str;
const struct str_map *child;
};
const struct str_map media_role_map[] = {
{ "Movie", "video", },
{ "Music", "music", },
{ "Game", "game", },
{ "Notification", "event", },
{ "Communication", "phone", },
{ "Movie", "animation", },
{ "Production", "production", },
{ "Accessibility", "a11y", },
{ "Test", "test", },
{ NULL, NULL },
};
const struct str_map key_table[] = {
{ PW_KEY_DEVICE_BUS_PATH, "device.bus_path" },
{ PW_KEY_DEVICE_FORM_FACTOR, "device.form_factor" },
@ -80,16 +63,6 @@ const struct str_map key_table[] = {
{ NULL, NULL },
};
static inline const struct str_map *str_map_find(const struct str_map *map, const char *pw, const char *pa)
{
uint32_t i;
for (i = 0; map[i].pw_str; i++)
if ((pw && spa_streq(map[i].pw_str, pw)) ||
(pa && spa_streq(map[i].pa_str, pa)))
return &map[i];
return NULL;
}
enum {
TAG_INVALID = 0,
TAG_STRING = 't',