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,9 +970,8 @@ 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)
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";
@ -992,6 +991,7 @@ static int create_stream(pa_stream_direction_t direction,
str = "Test";
else
str = "Music";
}
stride = pa_frame_size(&s->sample_spec);
if (direction == PA_STREAM_RECORD)
@ -1004,6 +1004,7 @@ 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");
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");