mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
jack: Pass custom flags as port.extra info
Make a port.extra property that contains API specific extra port information that is passed in the global object properties. Use this to pass the custom jack flags for a port. Carla uses this to mark CV ports.
This commit is contained in:
parent
e6ea01046e
commit
51cfb98ea6
3 changed files with 16 additions and 0 deletions
|
|
@ -2144,6 +2144,10 @@ static void registry_event_global(void *data, uint32_t id,
|
|||
|
||||
node_id = atoi(str);
|
||||
|
||||
if ((str = spa_dict_lookup(props, PW_KEY_PORT_EXTRA)) != NULL &&
|
||||
strstr(str, "jack:flags:") == str)
|
||||
flags = atoi(str+11);
|
||||
|
||||
if ((str = spa_dict_lookup(props, PW_KEY_PORT_NAME)) == NULL)
|
||||
goto exit;
|
||||
|
||||
|
|
@ -3204,6 +3208,7 @@ jack_port_t * jack_port_register (jack_client_t *client,
|
|||
struct object *o;
|
||||
jack_port_type_id_t type_id;
|
||||
uint8_t buffer[1024];
|
||||
char port_flags[64];
|
||||
struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
|
||||
struct spa_pod *params[4];
|
||||
uint32_t n_params = 0;
|
||||
|
|
@ -3276,6 +3281,14 @@ jack_port_t * jack_port_register (jack_client_t *client,
|
|||
dict = SPA_DICT_INIT(items, 0);
|
||||
items[dict.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_FORMAT_DSP, port_type);
|
||||
items[dict.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_PORT_NAME, port_name);
|
||||
if (flags > 0x1f) {
|
||||
snprintf(port_flags, sizeof(port_flags), "jack:flags:%lu", flags & ~0x1f);
|
||||
items[dict.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_PORT_EXTRA, port_flags);
|
||||
}
|
||||
if (flags & JackPortIsPhysical)
|
||||
items[dict.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_PORT_PHYSICAL, "true");
|
||||
if (flags & JackPortIsTerminal)
|
||||
items[dict.n_items++] = SPA_DICT_ITEM_INIT(PW_KEY_PORT_TERMINAL, "true");
|
||||
port_info.props = &dict;
|
||||
port_info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS;
|
||||
port_params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);
|
||||
|
|
|
|||
|
|
@ -837,6 +837,7 @@ int pw_impl_port_register(struct pw_impl_port *port,
|
|||
PW_KEY_PORT_TERMINAL,
|
||||
PW_KEY_PORT_CONTROL,
|
||||
PW_KEY_PORT_ALIAS,
|
||||
PW_KEY_PORT_EXTRA,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ extern "C" {
|
|||
#define PW_KEY_PORT_CONTROL "port.control" /**< if this port is a control port */
|
||||
#define PW_KEY_PORT_MONITOR "port.monitor" /**< if this port is a monitor port */
|
||||
#define PW_KEY_PORT_CACHE_PARAMS "port.cache-params" /**< cache the node port params */
|
||||
#define PW_KEY_PORT_EXTRA "port.extra" /**< api specific extra port info, API name
|
||||
* should be prefixed. "jack:flags:56" */
|
||||
|
||||
/** link properties */
|
||||
#define PW_KEY_LINK_ID "link.id" /**< a link id */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue