summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2020-08-03 18:16:53 +0200
committerWim Taymans <wtaymans@redhat.com>2020-08-03 18:16:53 +0200
commit66816580bc02d8173308b6a38f7e46faf90aa2e0 (patch)
tree520e910138bee4043104891b996b62445f4babd4
parent9943733b8c98fa859d427dadf50ba327af2416d5 (diff)
alsa: improve configuration of NICK
-rw-r--r--src/examples/media-session/alsa-monitor.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/examples/media-session/alsa-monitor.c b/src/examples/media-session/alsa-monitor.c
index a9a85108..e7395be4 100644
--- a/src/examples/media-session/alsa-monitor.c
+++ b/src/examples/media-session/alsa-monitor.c
@@ -258,6 +258,16 @@ static struct node *alsa_create_node(struct device *device, uint32_t id,
else
pw_properties_setf(node->props, SPA_KEY_MEDIA_CLASS, "Audio/Sink");
}
+ if (pw_properties_get(node->props, PW_KEY_NODE_NICK) == NULL) {
+ const char *s;
+ s = pw_properties_get(device->props, PW_KEY_DEVICE_NICK);
+ if (s == NULL)
+ s = pw_properties_get(device->props, SPA_KEY_API_ALSA_CARD_NAME);
+ if (s == NULL)
+ s = pw_properties_get(device->props, "alsa.card_name");
+ pw_properties_set(node->props, PW_KEY_NODE_NICK, s);
+
+ }
if (pw_properties_get(node->props, SPA_KEY_NODE_NAME) == NULL) {
const char *devname;
if ((devname = pw_properties_get(device->props, SPA_KEY_DEVICE_NAME)) == NULL)
@@ -419,13 +429,14 @@ static int update_device_props(struct device *device)
const char *s, *d;
char temp[32];
- if ((s = pw_properties_get(p, SPA_KEY_DEVICE_NAME)) == NULL) {
- if ((s = pw_properties_get(p, SPA_KEY_DEVICE_BUS_ID)) == NULL) {
- if ((s = pw_properties_get(p, SPA_KEY_DEVICE_BUS_PATH)) == NULL) {
- snprintf(temp, sizeof(temp), "%d", device->id);
- s = temp;
- }
- }
+ s = pw_properties_get(p, SPA_KEY_DEVICE_NAME);
+ if (s == NULL)
+ s = pw_properties_get(p, SPA_KEY_DEVICE_BUS_ID);
+ if (s == NULL)
+ s = pw_properties_get(p, SPA_KEY_DEVICE_BUS_PATH);
+ if (s == NULL) {
+ snprintf(temp, sizeof(temp), "%d", device->id);
+ s = temp;
}
pw_properties_setf(p, PW_KEY_DEVICE_NAME, "alsa_card.%s", s);
@@ -448,6 +459,12 @@ static int update_device_props(struct device *device)
pw_properties_set(p, PW_KEY_DEVICE_DESCRIPTION, d);
}
+ if (pw_properties_get(p, PW_KEY_DEVICE_NICK) == NULL) {
+ s = pw_properties_get(p, SPA_KEY_API_ALSA_CARD_NAME);
+ if (s != NULL)
+ pw_properties_set(p, PW_KEY_DEVICE_NICK, s);
+ }
+
if (pw_properties_get(p, PW_KEY_DEVICE_ICON_NAME) == NULL) {
d = NULL;