summaryrefslogtreecommitdiff
path: root/pipewire-jack
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2020-07-21 16:50:45 +0200
committerWim Taymans <wtaymans@redhat.com>2020-07-21 16:50:45 +0200
commitca066fbf3bc286b7ce176dbaf5c5c710314730db (patch)
tree2262eff0df12cd0d173b3c8fee72fdb2483c6223 /pipewire-jack
parentd4d80c16c1bf49ac4083466ce3e49ccfa8ff0599 (diff)
jack: use PIPEWIRE_PROPS env to add properties to jack nodes
Diffstat (limited to 'pipewire-jack')
-rw-r--r--pipewire-jack/src/pipewire-jack.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/pipewire-jack/src/pipewire-jack.c b/pipewire-jack/src/pipewire-jack.c
index 6cb59f40..a5814d7d 100644
--- a/pipewire-jack/src/pipewire-jack.c
+++ b/pipewire-jack/src/pipewire-jack.c
@@ -246,6 +246,7 @@ struct client {
struct context context;
struct pw_data_loop *loop;
+ struct pw_properties *props;
struct pw_core *core;
struct spa_hook core_listener;
@@ -2334,6 +2335,13 @@ jack_client_t * jack_client_open (const char *client_name,
&client->registry_listener,
&registry_events, client);
+ if ((str = getenv("PIPEWIRE_PROPS")) != NULL)
+ client->props = pw_properties_new_string(str);
+ if (client->props == NULL)
+ client->props = pw_properties_new(NULL, NULL);
+ if (client->props == NULL)
+ goto init_failed;
+
props = SPA_DICT_INIT(items, 0);
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_NAME, client_name);
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_TYPE, "Audio");
@@ -2343,11 +2351,13 @@ jack_client_t * jack_client_open (const char *client_name,
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_LATENCY, str);
items[props.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_NODE_ALWAYS_PROCESS, "true");
+ pw_properties_add(client->props, &props);
+
client->node = pw_core_create_object(client->core,
"client-node",
PW_TYPE_INTERFACE_ClientNode,
PW_VERSION_CLIENT_NODE,
- &props,
+ &client->props->dict,
0);
if (client->node == NULL)
goto init_failed;
@@ -2445,6 +2455,7 @@ int jack_client_close (jack_client_t *client)
pw_log_debug(NAME" %p: free", client);
pthread_mutex_destroy(&c->context.lock);
pw_data_loop_destroy(c->loop);
+ pw_properties_free(c->props);
free(c);
return res;