From 5a315d53511ac279d2ea785784dba1c2c5ca64e2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 17 Jan 2022 09:49:39 +0100 Subject: [PATCH] pulse-server: rename some id -> index It's port_index and profile_index. --- src/modules/module-protocol-pulse/collect.c | 30 +++++++++---------- src/modules/module-protocol-pulse/collect.h | 8 ++--- .../module-protocol-pulse/pulse-server.c | 18 +++++------ 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/modules/module-protocol-pulse/collect.c b/src/modules/module-protocol-pulse/collect.c index fa3e41d36..21c9f8b17 100644 --- a/src/modules/module-protocol-pulse/collect.c +++ b/src/modules/module-protocol-pulse/collect.c @@ -157,7 +157,7 @@ uint32_t collect_profile_info(struct pw_manager_object *card, struct card_info * if (spa_pod_parse_object(p->param, SPA_TYPE_OBJECT_ParamProfile, NULL, - SPA_PARAM_PROFILE_index, SPA_POD_Int(&pi->id), + SPA_PARAM_PROFILE_index, SPA_POD_Int(&pi->index), SPA_PARAM_PROFILE_name, SPA_POD_String(&pi->name), SPA_PARAM_PROFILE_description, SPA_POD_OPT_String(&pi->description), SPA_PARAM_PROFILE_priority, SPA_POD_OPT_Int(&pi->priority), @@ -167,7 +167,7 @@ uint32_t collect_profile_info(struct pw_manager_object *card, struct card_info * } if (pi->description == NULL) pi->description = pi->name; - if (pi->id == card_info->active_profile) + if (pi->index == card_info->active_profile) card_info->active_profile_name = pi->name; if (classes != NULL) { @@ -198,12 +198,12 @@ uint32_t collect_profile_info(struct pw_manager_object *card, struct card_info * return n; } -uint32_t find_profile_id(struct pw_manager_object *card, const char *name) +uint32_t find_profile_index(struct pw_manager_object *card, const char *name) { struct pw_manager_param *p; spa_list_for_each(p, &card->param_list, link) { - uint32_t id; + uint32_t index; const char *test_name; if (p->id != SPA_PARAM_EnumProfile) @@ -211,12 +211,12 @@ uint32_t find_profile_id(struct pw_manager_object *card, const char *name) if (spa_pod_parse_object(p->param, SPA_TYPE_OBJECT_ParamProfile, NULL, - SPA_PARAM_PROFILE_index, SPA_POD_Int(&id), + SPA_PARAM_PROFILE_index, SPA_POD_Int(&index), SPA_PARAM_PROFILE_name, SPA_POD_String(&test_name)) < 0) continue; if (spa_streq(test_name, name)) - return id; + return index; } return SPA_ID_INVALID; @@ -229,7 +229,7 @@ void collect_device_info(struct pw_manager_object *device, struct pw_manager_obj if (card && !monitor) { spa_list_for_each(p, &card->param_list, link) { - uint32_t id, dev; + uint32_t index, dev; struct spa_pod *props; if (p->id != SPA_PARAM_Route) @@ -237,13 +237,13 @@ void collect_device_info(struct pw_manager_object *device, struct pw_manager_obj if (spa_pod_parse_object(p->param, SPA_TYPE_OBJECT_ParamRoute, NULL, - SPA_PARAM_ROUTE_index, SPA_POD_Int(&id), + SPA_PARAM_ROUTE_index, SPA_POD_Int(&index), SPA_PARAM_ROUTE_device, SPA_POD_Int(&dev), SPA_PARAM_ROUTE_props, SPA_POD_OPT_Pod(&props)) < 0) continue; if (dev != dev_info->device) continue; - dev_info->active_port = id; + dev_info->active_port = index; if (props) { volume_parse_param(props, &dev_info->volume_info, monitor); dev_info->have_volume = true; @@ -316,7 +316,7 @@ uint32_t collect_port_info(struct pw_manager_object *card, struct card_info *car if (spa_pod_parse_object(p->param, SPA_TYPE_OBJECT_ParamRoute, NULL, - SPA_PARAM_ROUTE_index, SPA_POD_Int(&pi->id), + SPA_PARAM_ROUTE_index, SPA_POD_Int(&pi->index), SPA_PARAM_ROUTE_direction, SPA_POD_Id(&pi->direction), SPA_PARAM_ROUTE_name, SPA_POD_String(&pi->name), SPA_PARAM_ROUTE_description, SPA_POD_OPT_String(&pi->description), @@ -341,7 +341,7 @@ uint32_t collect_port_info(struct pw_manager_object *card, struct card_info *car continue; if (!array_contains(pi->devices, pi->n_devices, dev_info->device)) continue; - if (pi->id == dev_info->active_port) + if (pi->index == dev_info->active_port) dev_info->active_port_name = pi->name; } @@ -377,12 +377,12 @@ uint32_t collect_port_info(struct pw_manager_object *card, struct card_info *car return n; } -uint32_t find_port_id(struct pw_manager_object *card, uint32_t direction, const char *port_name) +uint32_t find_port_index(struct pw_manager_object *card, uint32_t direction, const char *port_name) { struct pw_manager_param *p; spa_list_for_each(p, &card->param_list, link) { - uint32_t id, dir; + uint32_t index, dir; const char *name; if (p->id != SPA_PARAM_EnumRoute) @@ -390,14 +390,14 @@ uint32_t find_port_id(struct pw_manager_object *card, uint32_t direction, const if (spa_pod_parse_object(p->param, SPA_TYPE_OBJECT_ParamRoute, NULL, - SPA_PARAM_ROUTE_index, SPA_POD_Int(&id), + SPA_PARAM_ROUTE_index, SPA_POD_Int(&index), SPA_PARAM_ROUTE_direction, SPA_POD_Id(&dir), SPA_PARAM_ROUTE_name, SPA_POD_String(&name)) < 0) continue; if (dir != direction) continue; if (spa_streq(name, port_name)) - return id; + return index; } return SPA_ID_INVALID; diff --git a/src/modules/module-protocol-pulse/collect.h b/src/modules/module-protocol-pulse/collect.h index 5d6190a81..74239bf7b 100644 --- a/src/modules/module-protocol-pulse/collect.h +++ b/src/modules/module-protocol-pulse/collect.h @@ -103,7 +103,7 @@ void collect_card_info(struct pw_manager_object *card, struct card_info *info); /* ========================================================================== */ struct profile_info { - uint32_t id; + uint32_t index; const char *name; const char *description; uint32_t priority; @@ -118,7 +118,7 @@ uint32_t collect_profile_info(struct pw_manager_object *card, struct card_info * /* ========================================================================== */ struct port_info { - uint32_t id; + uint32_t index; uint32_t direction; const char *name; const char *description; @@ -154,8 +154,8 @@ uint32_t collect_transport_codec_info(struct pw_manager_object *card, /* ========================================================================== */ struct spa_dict *collect_props(struct spa_pod *info, struct spa_dict *dict); -uint32_t find_profile_id(struct pw_manager_object *card, const char *name); -uint32_t find_port_id(struct pw_manager_object *card, uint32_t direction, const char *port_name); +uint32_t find_profile_index(struct pw_manager_object *card, const char *name); +uint32_t find_port_index(struct pw_manager_object *card, uint32_t direction, const char *port_name); struct pw_manager_object *find_linked(struct pw_manager *m, uint32_t obj_id, enum pw_direction direction); bool collect_is_linked(struct pw_manager *m, uint32_t obj_id, enum pw_direction direction); diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 3a61ce732..f96ffa4e5 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -2861,7 +2861,7 @@ static int do_set_port(struct client *client, uint32_t command, uint32_t tag, st struct pw_manager *manager = client->manager; struct pw_node_info *info; uint32_t id, card_id = SPA_ID_INVALID, device_id = SPA_ID_INVALID; - uint32_t port_id = SPA_ID_INVALID; + uint32_t port_index = SPA_ID_INVALID; const char *name, *str, *port_name; struct pw_manager_object *o, *card = NULL; int res; @@ -2901,11 +2901,11 @@ static int do_set_port(struct client *client, uint32_t command, uint32_t tag, st if (card == NULL || device_id == SPA_ID_INVALID) return -ENOENT; - port_id = find_port_id(card, direction, port_name); - if (port_id == SPA_ID_INVALID) + port_index = find_port_index(card, direction, port_name); + if (port_index == SPA_ID_INVALID) return -ENOENT; - if ((res = set_card_port(card, device_id, port_id)) < 0) + if ((res = set_card_port(card, device_id, port_index)) < 0) return res; return operation_new(client, tag); @@ -2967,7 +2967,7 @@ static int do_set_port_latency_offset(struct client *client, uint32_t command, u res = 0; for (j = 0; j < pi->n_devices; ++j) { - res = set_card_volume_mute_delay(card, pi->id, pi->devices[j], NULL, NULL, &value); + res = set_card_volume_mute_delay(card, pi->index, pi->devices[j], NULL, NULL, &value); if (res < 0) break; } @@ -3460,7 +3460,7 @@ static int fill_card_info(struct client *client, struct message *m, const char *name = "off"; for (j = 0; j < n_profiles; ++j) { - if (profile_info[j].id == pi->profiles[i]) { + if (profile_info[j].index == pi->profiles[i]) { name = profile_info[j].name; break; } @@ -4416,7 +4416,7 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag, struct pw_manager *manager = client->manager; struct pw_manager_object *o; const char *profile_name; - uint32_t profile_id = SPA_ID_INVALID; + uint32_t profile_index = SPA_ID_INVALID; struct selector sel; char buf[1024]; struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf)); @@ -4444,7 +4444,7 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag, if ((o = select_object(manager, &sel)) == NULL) return -ENOENT; - if ((profile_id = find_profile_id(o, profile_name)) == SPA_ID_INVALID) + if ((profile_index = find_profile_index(o, profile_name)) == SPA_ID_INVALID) return -ENOENT; if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X)) @@ -4457,7 +4457,7 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag, SPA_PARAM_Profile, 0, spa_pod_builder_add_object(&b, SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile, - SPA_PARAM_PROFILE_index, SPA_POD_Int(profile_id), + SPA_PARAM_PROFILE_index, SPA_POD_Int(profile_index), SPA_PARAM_PROFILE_save, SPA_POD_Bool(true))); return operation_new(client, tag);