pulse-server: add support for proplist value conversion

This commit is contained in:
Wim Taymans 2020-11-17 11:26:54 +01:00
parent 573e2afd5e
commit 242cddd371
2 changed files with 51 additions and 59 deletions

View file

@ -1461,36 +1461,6 @@ static const struct pw_stream_events stream_events =
.drained = stream_drained,
};
static void fix_stream_properties(struct stream *stream, struct pw_properties *props)
{
const char *str;
if ((str = pw_properties_get(props, PW_KEY_MEDIA_ROLE)) != NULL) {
if (strcmp(str, "video") == 0)
str = "Movie";
else if (strcmp(str, "music") == 0)
str = "Music";
else if (strcmp(str, "game") == 0)
str = "Game";
else if (strcmp(str, "event") == 0)
str = "Notification";
else if (strcmp(str, "phone") == 0)
str = "Communication";
else if (strcmp(str, "animation") == 0)
str = "Movie";
else if (strcmp(str, "production") == 0)
str = "Production";
else if (strcmp(str, "a11y") == 0)
str = "Accessibility";
else if (strcmp(str, "test") == 0)
str = "Test";
else
str = "Music";
pw_properties_set(props, PW_KEY_MEDIA_ROLE, str);
}
}
static int do_create_playback_stream(struct client *client, uint32_t command, uint32_t tag, struct message *m)
{
struct impl *impl = client->impl;
@ -1677,7 +1647,6 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
pw_properties_setf(props,
PW_KEY_NODE_TARGET, "%u", sink_index);
fix_stream_properties(stream, props),
stream->stream = pw_stream_new(client->core, name, props);
props = NULL;
if (stream->stream == NULL)
@ -1912,7 +1881,6 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint
}
}
fix_stream_properties(stream, props),
stream->stream = pw_stream_new(client->core, name, props);
props = NULL;
if (stream->stream == NULL)
@ -2938,7 +2906,6 @@ static int do_update_proplist(struct client *client, uint32_t command, uint32_t
if (stream == NULL || stream->type == STREAM_TYPE_UPLOAD)
goto error_noentity;
fix_stream_properties(stream, props);
pw_stream_update_properties(stream->stream, &props->dict);
} else {
pw_core_update_properties(client->core, &props->dict);