port: use right properties

Use format.dsp as a key to mark the dsp format on a port
Use audio.channel as the key to set the audio channel on a port
This commit is contained in:
Wim Taymans 2019-05-24 16:14:19 +02:00
parent 3ad73f0532
commit a680f434d2
7 changed files with 8 additions and 9 deletions

@ -1 +1 @@
Subproject commit 7d5e860d0c40383bbfa57b4a2ef84505e4071942
Subproject commit af61dcebbfd05fa853cf15aa3798a98b4a087a92

View file

@ -139,8 +139,8 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
uint32_t n_items = 0;
if (PORT_IS_DSP(port->direction, port->id)) {
items[n_items++] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio");
items[n_items++] = SPA_DICT_ITEM_INIT("port.channel", port->position);
items[n_items++] = SPA_DICT_ITEM_INIT("format.dsp", "32 bit float mono audio");
items[n_items++] = SPA_DICT_ITEM_INIT("audio.channel", port->position);
if (port->direction == SPA_DIRECTION_OUTPUT)
items[n_items++] = SPA_DICT_ITEM_INIT("port.monitor", "1");
}

View file

@ -159,8 +159,8 @@ static int init_port(struct impl *this, enum spa_direction direction,
port->info = SPA_PORT_INFO_INIT();
port->info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS |
SPA_PORT_FLAG_DYNAMIC_DATA;
port->info_props_items[0] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio");
port->info_props_items[1] = SPA_DICT_ITEM_INIT("port.channel", port->position);
port->info_props_items[0] = SPA_DICT_ITEM_INIT("format.dsp", "32 bit float mono audio");
port->info_props_items[1] = SPA_DICT_ITEM_INIT("audio.channel", port->position);
port->info_props = SPA_DICT_INIT(port->info_props_items, 2);
port->info.props = &port->info_props;
port->params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ);

View file

@ -497,7 +497,7 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id,
spa_list_append(&impl->node_list, &node->l);
node->type = NODE_TYPE_UNKNOWN;
pw_log_debug(NAME" %p: node media.class %s", impl, media_class);
pw_log_debug(NAME" %p: node "PW_KEY_MEDIA_CLASS" %s", impl, media_class);
if (media_class == NULL)
return 0;

View file

@ -202,7 +202,7 @@ static void node_port_init(void *data, struct pw_port *port)
else
prefix = "capture";
if ((str = pw_properties_get(old, PW_KEY_PORT_CHANNEL)) == NULL ||
if ((str = pw_properties_get(old, PW_KEY_AUDIO_CHANNEL)) == NULL ||
strcmp(str, "UNK") == 0) {
snprintf(position, 7, "%d", port->port_id);
str = position;

View file

@ -116,7 +116,6 @@ extern "C" {
#define PW_KEY_PORT_NAME "port.name" /**< port name */
#define PW_KEY_PORT_DIRECTION "port.direction" /**< the port direction, one of "in" or "out"
* or "control" and "notify" for control ports */
#define PW_KEY_PORT_CHANNEL "port.channel" /**< port channel */
#define PW_KEY_PORT_ALIAS1 "port.alias1" /**< port alias1 */
#define PW_KEY_PORT_ALIAS2 "port.alias2" /**< port alias2 */
#define PW_KEY_PORT_PHYSICAL "port.physical" /**< if this is a physical port */

View file

@ -693,7 +693,7 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
pw_properties_set(port->properties, PW_KEY_PORT_DIRECTION, dir);
if ((str = pw_properties_get(port->properties, PW_KEY_PORT_NAME)) == NULL) {
if ((str = pw_properties_get(port->properties, PW_KEY_PORT_CHANNEL)) != NULL &&
if ((str = pw_properties_get(port->properties, PW_KEY_AUDIO_CHANNEL)) != NULL &&
strcmp(str, "UNK") != 0) {
pw_properties_setf(port->properties, PW_KEY_PORT_NAME, "%s_%s", dir, str);
}