diff --git a/src/context.c b/src/context.c index af8d66ab5..33a2f6341 100644 --- a/src/context.c +++ b/src/context.c @@ -136,7 +136,7 @@ struct global *pa_context_find_global_by_name(pa_context *c, uint32_t mask, cons if ((g->mask & mask) == 0) continue; if (g->props != NULL && - (str = pw_properties_get(g->props, "node.name")) != NULL && + (str = pw_properties_get(g->props, PW_KEY_NODE_NAME)) != NULL && strcmp(str, name) == 0) return g; if (g->id == id) @@ -203,7 +203,7 @@ static void device_event_info(void *object, const struct pw_device_info *info) i->owner_module = g->parent_id; if (info->change_mask & PW_DEVICE_CHANGE_MASK_PROPS) { i->driver = info->props ? - spa_dict_lookup(info->props, "device.api") : NULL; + spa_dict_lookup(info->props, PW_KEY_DEVICE_API) : NULL; if (i->proplist) pa_proplist_update_dict(i->proplist, info->props); else @@ -434,9 +434,9 @@ static void client_event_info(void *object, const struct pw_client_info *info) else i->proplist = pa_proplist_new_dict(info->props); i->name = info->props ? - spa_dict_lookup(info->props, "application.name") : NULL; + spa_dict_lookup(info->props, PW_KEY_APP_NAME) : NULL; i->driver = info->props ? - spa_dict_lookup(info->props, PW_CLIENT_PROP_PROTOCOL) : NULL; + spa_dict_lookup(info->props, PW_KEY_PROTOCOL) : NULL; } g->pending_seq = pw_proxy_sync(g->proxy, 0); } @@ -496,7 +496,7 @@ static int set_mask(pa_context *c, struct global *g) case PW_TYPE_INTERFACE_Device: if (g->props == NULL) return 0; - if ((str = pw_properties_get(g->props, "media.class")) == NULL) + if ((str = pw_properties_get(g->props, PW_KEY_MEDIA_CLASS)) == NULL) return 0; if (strcmp(str, "Audio/Device") != 0) return 0; @@ -514,7 +514,7 @@ static int set_mask(pa_context *c, struct global *g) case PW_TYPE_INTERFACE_Node: if (g->props == NULL) return 0; - if ((str = pw_properties_get(g->props, "media.class")) == NULL) + if ((str = pw_properties_get(g->props, PW_KEY_MEDIA_CLASS)) == NULL) return 0; if (strcmp(str, "Audio/Sink") == 0) { @@ -524,7 +524,7 @@ static int set_mask(pa_context *c, struct global *g) g->node_info.monitor = SPA_ID_INVALID; } else if (strcmp(str, "Audio/DSP/Playback") == 0) { - if ((str = pw_properties_get(g->props, "node.session")) == NULL) + if ((str = pw_properties_get(g->props, PW_KEY_NODE_SESSION)) == NULL) return 0; pw_log_debug("found monitor %d", g->id); g->mask = PA_SUBSCRIPTION_MASK_DSP_SINK | PA_SUBSCRIPTION_MASK_SOURCE; @@ -539,7 +539,7 @@ static int set_mask(pa_context *c, struct global *g) g->event = PA_SUBSCRIPTION_EVENT_SOURCE; } else if (strcmp(str, "Audio/DSP/Capture") == 0) { - if ((str = pw_properties_get(g->props, "node.session")) == NULL) + if ((str = pw_properties_get(g->props, PW_KEY_NODE_SESSION)) == NULL) return 0; g->mask = PA_SUBSCRIPTION_MASK_DSP_SOURCE; g->dsp_info.session = pw_properties_parse_int(str); @@ -584,10 +584,10 @@ static int set_mask(pa_context *c, struct global *g) break; case PW_TYPE_INTERFACE_Link: - if ((str = pw_properties_get(g->props, "link.output")) == NULL) + if ((str = pw_properties_get(g->props, PW_KEY_LINK_OUTPUT_PORT)) == NULL) return 0; g->link_info.src = pa_context_find_global(c, pw_properties_parse_int(str)); - if ((str = pw_properties_get(g->props, "link.input")) == NULL) + if ((str = pw_properties_get(g->props, PW_KEY_LINK_OUTPUT_PORT)) == NULL) return 0; g->link_info.dst = pa_context_find_global(c, pw_properties_parse_int(str)); @@ -801,7 +801,7 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * props = pw_properties_new(NULL, NULL); if (name) pw_properties_set(props, PA_PROP_APPLICATION_NAME, name); - pw_properties_set(props, "client.api", "pulseaudio"); + pw_properties_set(props, PW_KEY_CLIENT_API, "pulseaudio"); if (p) pw_properties_update(props, &p->props->dict); diff --git a/src/introspect.c b/src/introspect.c index 975dda880..8f22d2785 100644 --- a/src/introspect.c +++ b/src/introspect.c @@ -1433,8 +1433,8 @@ static void sink_input_callback(struct sink_input_data *d) s = find_stream(d->context, g->id); if (info->props) { - if ((name = spa_dict_lookup(info->props, "media.name")) == NULL && - (name = spa_dict_lookup(info->props, "application.name")) == NULL) + if ((name = spa_dict_lookup(info->props, PW_KEY_MEDIA_NAME)) == NULL && + (name = spa_dict_lookup(info->props, PW_KEY_APP_NAME)) == NULL) name = info->name; } else @@ -1726,8 +1726,8 @@ static void source_output_callback(struct source_output_data *d) s = find_stream(d->context, g->id); if (info->props) { - if ((name = spa_dict_lookup(info->props, "media.name")) == NULL && - (name = spa_dict_lookup(info->props, "application.name")) == NULL) + if ((name = spa_dict_lookup(info->props, PW_KEY_MEDIA_NAME)) == NULL && + (name = spa_dict_lookup(info->props, PW_KEY_APP_NAME)) == NULL) name = info->name; } else diff --git a/src/stream.c b/src/stream.c index c79355ee2..ab69074dc 100644 --- a/src/stream.c +++ b/src/stream.c @@ -28,6 +28,7 @@ #include #include +#include #include "core-format.h" #include "internal.h" @@ -197,7 +198,7 @@ static void configure_device(pa_stream *s) } else { s->device_index = g->id; - if ((str = pw_properties_get(g->props, "node.name")) == NULL) + if ((str = pw_properties_get(g->props, PW_KEY_NODE_NAME)) == NULL) s->device_name = strdup("unknown"); else s->device_name = strdup(str); @@ -526,7 +527,7 @@ static pa_stream* stream_new(pa_context *c, const char *name, else name = pa_proplist_gets(s->proplist, PA_PROP_MEDIA_NAME); - props = pw_properties_new("client.api", "pulseaudio", + props = pw_properties_new(PW_KEY_CLIENT_API, "pulseaudio", NULL); pw_properties_update(props, &s->proplist->props->dict); @@ -941,13 +942,13 @@ static int create_stream(pa_stream_direction_t direction, str = "Music"; sprintf(latency, "%u/%u", s->buffer_attr.minreq / stride, sample_rate); - items[0] = SPA_DICT_ITEM_INIT("node.latency", latency); - items[1] = SPA_DICT_ITEM_INIT(PW_NODE_PROP_MEDIA, "Audio"); - items[2] = SPA_DICT_ITEM_INIT(PW_NODE_PROP_CATEGORY, + items[0] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_LATENCY, latency); + items[1] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_TYPE, "Audio"); + items[2] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_CATEGORY, direction == PA_STREAM_PLAYBACK ? "Playback" : "Capture"); - items[3] = SPA_DICT_ITEM_INIT(PW_NODE_PROP_ROLE, str); - items[4] = SPA_DICT_ITEM_INIT("pipewire.monitor", monitor ? "1" : "0"); + items[3] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_ROLE, str); + items[4] = SPA_DICT_ITEM_INIT(PW_KEY_STREAM_MONITOR, monitor ? "1" : "0"); pw_stream_update_properties(s->stream, &SPA_DICT_INIT(items, 5)); @@ -1587,7 +1588,7 @@ pa_operation* pa_stream_set_name(pa_stream *s, const char *name, pa_stream_succe PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->state == PA_STREAM_READY, PA_ERR_BADSTATE); PA_CHECK_VALIDITY_RETURN_NULL(s->context, s->direction != PA_STREAM_UPLOAD, PA_ERR_BADSTATE); - items[0] = SPA_DICT_ITEM_INIT("media.name", name); + items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_NAME, name); dict = SPA_DICT_INIT(items, 1); pw_stream_update_properties(s->stream, &dict);