mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
impl-port: add port.group property
Can be used to group ports together. Mostly because they are all from the same stream and split into multiple ports by audioconvert/adapter. Also useful for the alsa sequence to group client ports together. Also interesting when pw-filter would be able to handle streams in the future to find out what ports belong to what streams.
This commit is contained in:
parent
54c3fa06ed
commit
9d1d1fcbef
13 changed files with 62 additions and 23 deletions
|
|
@ -12,6 +12,7 @@
|
|||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/node/keys.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
|
@ -150,7 +151,7 @@ static int emit_node(struct impl *this, struct acp_device *dev)
|
|||
|
||||
info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
|
||||
|
||||
items = alloca((dev->props.n_items + 8) * sizeof(*items));
|
||||
items = alloca((dev->props.n_items + 9) * sizeof(*items));
|
||||
n_items = 0;
|
||||
|
||||
snprintf(card_index, sizeof(card_index), "%d", card->index);
|
||||
|
|
@ -174,6 +175,7 @@ static int emit_node(struct impl *this, struct acp_device *dev)
|
|||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_OPEN_UCM, "true");
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_PCM_CARD, card_index);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_PCM_STREAM, stream);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, stream);
|
||||
|
||||
snprintf(channels, sizeof(channels), "%d", dev->format.channels);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNELS, channels);
|
||||
|
|
|
|||
|
|
@ -3758,7 +3758,10 @@ void spa_alsa_emit_port_info(struct state *state, bool full)
|
|||
state->port_info.change_mask = state->port_info_all;
|
||||
if (state->port_info.change_mask) {
|
||||
uint32_t i;
|
||||
|
||||
static const struct spa_dict_item info_items[] = {
|
||||
{ SPA_KEY_PORT_GROUP, "stream.0" },
|
||||
};
|
||||
state->port_info.props = &SPA_DICT_INIT_ARRAY(info_items);
|
||||
if (state->port_info.change_mask & SPA_PORT_CHANGE_MASK_PARAMS) {
|
||||
for (i = 0; i < state->port_info.n_params; i++) {
|
||||
if (state->port_params[i].user > 0) {
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ static void emit_port_info(struct seq_state *this, struct seq_port *port, bool f
|
|||
if (full)
|
||||
port->info.change_mask = port->info_all;
|
||||
if (port->info.change_mask) {
|
||||
struct spa_dict_item items[5];
|
||||
struct spa_dict_item items[6];
|
||||
uint32_t n_items = 0;
|
||||
int id;
|
||||
snd_seq_port_info_t *info;
|
||||
|
|
@ -234,6 +234,7 @@ static void emit_port_info(struct seq_state *this, struct seq_port *port, bool f
|
|||
char name[256];
|
||||
char path[128];
|
||||
char alias[128];
|
||||
char stream[32];
|
||||
|
||||
snd_seq_port_info_alloca(&info);
|
||||
snd_seq_get_any_port_info(this->sys.hndl,
|
||||
|
|
@ -273,9 +274,12 @@ static void emit_port_info(struct seq_state *this, struct seq_port *port, bool f
|
|||
}
|
||||
clean_name(name);
|
||||
|
||||
snprintf(path, sizeof(path), "alsa:seq:%s:client_%d:%s_%d",
|
||||
snprintf(stream, sizeof(stream), "client_%d", port->addr.client);
|
||||
clean_name(stream);
|
||||
|
||||
snprintf(path, sizeof(path), "alsa:seq:%s:%s:%s_%d",
|
||||
this->props.device,
|
||||
port->addr.client,
|
||||
stream,
|
||||
port->direction == SPA_DIRECTION_OUTPUT ? "capture" : "playback",
|
||||
port->addr.port);
|
||||
clean_name(path);
|
||||
|
|
@ -285,10 +289,12 @@ static void emit_port_info(struct seq_state *this, struct seq_port *port, bool f
|
|||
snd_seq_port_info_get_name(info));
|
||||
clean_name(alias);
|
||||
|
||||
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi");
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_OBJECT_PATH, path);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, name);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_ALIAS, alias);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_GROUP, stream);
|
||||
if ((id = snd_seq_client_info_get_card(client_info)) != -1) {
|
||||
snprintf(card, sizeof(card), "%d", id);
|
||||
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_API_ALSA_CARD, card);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue