don't force a MEDIA_ROLE property

The application has to set a media role.
This commit is contained in:
Wim Taymans 2020-10-14 12:11:35 +02:00
parent 6469663265
commit 1bd31c1cf1
2 changed files with 24 additions and 25 deletions

View file

@ -419,8 +419,6 @@ static int snd_pcm_pipewire_prepare(snd_pcm_ioplug_t *io)
pw_properties_set(props, PW_KEY_MEDIA_CATEGORY,
io->stream == SND_PCM_STREAM_PLAYBACK ?
"Playback" : "Capture");
if (pw_properties_get(props, PW_KEY_MEDIA_ROLE) == NULL)
pw_properties_set(props, PW_KEY_MEDIA_ROLE, "Music");
pw->stream = pw_stream_new(pw->core, pw->node_name, props);
if (pw->stream == NULL)

View file

@ -970,28 +970,28 @@ static int create_stream(pa_stream_direction_t direction,
devid = PW_ID_ANY;
}
if ((str = pa_proplist_gets(s->proplist, PA_PROP_MEDIA_ROLE)) == NULL)
str = "Music";
else 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";
if ((str = pa_proplist_gets(s->proplist, PA_PROP_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";
}
stride = pa_frame_size(&s->sample_spec);
if (direction == PA_STREAM_RECORD)
@ -1004,7 +1004,8 @@ static int create_stream(pa_stream_direction_t direction,
items[n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_CATEGORY,
direction == PA_STREAM_PLAYBACK ?
"Playback" : monitor ? "Monitor" : "Capture");
items[n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_ROLE, str);
if (str != NULL)
items[n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_ROLE, str);
if (monitor)
items[n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_STREAM_MONITOR, "true");
if (no_remix)