mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
adapter: name control ports as "control"
This commit is contained in:
parent
83588daf60
commit
6b09a304dc
1 changed files with 17 additions and 4 deletions
|
|
@ -95,7 +95,7 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
||||||
struct pw_properties *new;
|
struct pw_properties *new;
|
||||||
const char *str, *path, *desc, *nick, *name, *node_name, *media_class;
|
const char *str, *path, *desc, *nick, *name, *node_name, *media_class;
|
||||||
char position[8], *prefix;
|
char position[8], *prefix;
|
||||||
bool is_monitor, is_device, is_duplex, is_virtual;
|
bool is_monitor, is_device, is_duplex, is_virtual, is_control = false;
|
||||||
|
|
||||||
direction = pw_impl_port_get_direction(port);
|
direction = pw_impl_port_get_direction(port);
|
||||||
|
|
||||||
|
|
@ -105,6 +105,9 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
||||||
if (!is_monitor && direction != n->direction)
|
if (!is_monitor && direction != n->direction)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ((str = pw_properties_get(old, PW_KEY_FORMAT_DSP)) != NULL)
|
||||||
|
is_control = spa_streq(str, "8 bit raw midi");
|
||||||
|
|
||||||
path = pw_properties_get(n->props, PW_KEY_OBJECT_PATH);
|
path = pw_properties_get(n->props, PW_KEY_OBJECT_PATH);
|
||||||
media_class = pw_properties_get(n->props, PW_KEY_MEDIA_CLASS);
|
media_class = pw_properties_get(n->props, PW_KEY_MEDIA_CLASS);
|
||||||
|
|
||||||
|
|
@ -120,7 +123,10 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
||||||
|
|
||||||
new = pw_properties_new(NULL, NULL);
|
new = pw_properties_new(NULL, NULL);
|
||||||
|
|
||||||
if (is_duplex)
|
if (is_control)
|
||||||
|
prefix = direction == PW_DIRECTION_INPUT ?
|
||||||
|
"control" : "notify";
|
||||||
|
else if (is_duplex)
|
||||||
prefix = direction == PW_DIRECTION_INPUT ?
|
prefix = direction == PW_DIRECTION_INPUT ?
|
||||||
"playback" : "capture";
|
"playback" : "capture";
|
||||||
else if (is_virtual)
|
else if (is_virtual)
|
||||||
|
|
@ -156,13 +162,20 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
||||||
pw_properties_setf(new, PW_KEY_OBJECT_PATH, "%s:%s_%d",
|
pw_properties_setf(new, PW_KEY_OBJECT_PATH, "%s:%s_%d",
|
||||||
path ? path : node_name, prefix, pw_impl_port_get_id(port));
|
path ? path : node_name, prefix, pw_impl_port_get_id(port));
|
||||||
|
|
||||||
pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, str);
|
if (is_control)
|
||||||
|
pw_properties_setf(new, PW_KEY_PORT_NAME, "%s", prefix);
|
||||||
|
else
|
||||||
|
pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, str);
|
||||||
|
|
||||||
if ((node_name = nick) == NULL && (node_name = desc) == NULL &&
|
if ((node_name = nick) == NULL && (node_name = desc) == NULL &&
|
||||||
(node_name = name) == NULL)
|
(node_name = name) == NULL)
|
||||||
node_name = "node";
|
node_name = "node";
|
||||||
|
|
||||||
pw_properties_setf(new, PW_KEY_PORT_ALIAS, "%s:%s_%s",
|
if (is_control)
|
||||||
|
pw_properties_setf(new, PW_KEY_PORT_ALIAS, "%s:%s",
|
||||||
|
node_name, prefix);
|
||||||
|
else
|
||||||
|
pw_properties_setf(new, PW_KEY_PORT_ALIAS, "%s:%s_%s",
|
||||||
node_name, prefix, str);
|
node_name, prefix, str);
|
||||||
|
|
||||||
pw_impl_port_update_properties(port, &new->dict);
|
pw_impl_port_update_properties(port, &new->dict);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue