mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: rename some id -> index
It's port_index and profile_index.
This commit is contained in:
		
							parent
							
								
									ec465966bc
								
							
						
					
					
						commit
						5a315d5351
					
				
					 3 changed files with 28 additions and 28 deletions
				
			
		| 
						 | 
					@ -157,7 +157,7 @@ uint32_t collect_profile_info(struct pw_manager_object *card, struct card_info *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (spa_pod_parse_object(p->param,
 | 
							if (spa_pod_parse_object(p->param,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamProfile, NULL,
 | 
									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_name,  SPA_POD_String(&pi->name),
 | 
				
			||||||
				SPA_PARAM_PROFILE_description,  SPA_POD_OPT_String(&pi->description),
 | 
									SPA_PARAM_PROFILE_description,  SPA_POD_OPT_String(&pi->description),
 | 
				
			||||||
				SPA_PARAM_PROFILE_priority,  SPA_POD_OPT_Int(&pi->priority),
 | 
									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)
 | 
							if (pi->description == NULL)
 | 
				
			||||||
			pi->description = pi->name;
 | 
								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;
 | 
								card_info->active_profile_name = pi->name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (classes != NULL) {
 | 
							if (classes != NULL) {
 | 
				
			||||||
| 
						 | 
					@ -198,12 +198,12 @@ uint32_t collect_profile_info(struct pw_manager_object *card, struct card_info *
 | 
				
			||||||
	return n;
 | 
						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;
 | 
						struct pw_manager_param *p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_for_each(p, &card->param_list, link) {
 | 
						spa_list_for_each(p, &card->param_list, link) {
 | 
				
			||||||
		uint32_t id;
 | 
							uint32_t index;
 | 
				
			||||||
		const char *test_name;
 | 
							const char *test_name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (p->id != SPA_PARAM_EnumProfile)
 | 
							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,
 | 
							if (spa_pod_parse_object(p->param,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamProfile, NULL,
 | 
									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)
 | 
									SPA_PARAM_PROFILE_name,  SPA_POD_String(&test_name)) < 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (spa_streq(test_name, name))
 | 
							if (spa_streq(test_name, name))
 | 
				
			||||||
			return id;
 | 
								return index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return SPA_ID_INVALID;
 | 
						return SPA_ID_INVALID;
 | 
				
			||||||
| 
						 | 
					@ -229,7 +229,7 @@ void collect_device_info(struct pw_manager_object *device, struct pw_manager_obj
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (card && !monitor) {
 | 
						if (card && !monitor) {
 | 
				
			||||||
		spa_list_for_each(p, &card->param_list, link) {
 | 
							spa_list_for_each(p, &card->param_list, link) {
 | 
				
			||||||
			uint32_t id, dev;
 | 
								uint32_t index, dev;
 | 
				
			||||||
			struct spa_pod *props;
 | 
								struct spa_pod *props;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (p->id != SPA_PARAM_Route)
 | 
								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,
 | 
								if (spa_pod_parse_object(p->param,
 | 
				
			||||||
					SPA_TYPE_OBJECT_ParamRoute, NULL,
 | 
										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_device,  SPA_POD_Int(&dev),
 | 
				
			||||||
					SPA_PARAM_ROUTE_props,  SPA_POD_OPT_Pod(&props)) < 0)
 | 
										SPA_PARAM_ROUTE_props,  SPA_POD_OPT_Pod(&props)) < 0)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			if (dev != dev_info->device)
 | 
								if (dev != dev_info->device)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			dev_info->active_port = id;
 | 
								dev_info->active_port = index;
 | 
				
			||||||
			if (props) {
 | 
								if (props) {
 | 
				
			||||||
				volume_parse_param(props, &dev_info->volume_info, monitor);
 | 
									volume_parse_param(props, &dev_info->volume_info, monitor);
 | 
				
			||||||
				dev_info->have_volume = true;
 | 
									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,
 | 
							if (spa_pod_parse_object(p->param,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamRoute, NULL,
 | 
									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_direction, SPA_POD_Id(&pi->direction),
 | 
				
			||||||
				SPA_PARAM_ROUTE_name,  SPA_POD_String(&pi->name),
 | 
									SPA_PARAM_ROUTE_name,  SPA_POD_String(&pi->name),
 | 
				
			||||||
				SPA_PARAM_ROUTE_description,  SPA_POD_OPT_String(&pi->description),
 | 
									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;
 | 
									continue;
 | 
				
			||||||
			if (!array_contains(pi->devices, pi->n_devices, dev_info->device))
 | 
								if (!array_contains(pi->devices, pi->n_devices, dev_info->device))
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			if (pi->id == dev_info->active_port)
 | 
								if (pi->index == dev_info->active_port)
 | 
				
			||||||
				dev_info->active_port_name = pi->name;
 | 
									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;
 | 
						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;
 | 
						struct pw_manager_param *p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_for_each(p, &card->param_list, link) {
 | 
						spa_list_for_each(p, &card->param_list, link) {
 | 
				
			||||||
		uint32_t id, dir;
 | 
							uint32_t index, dir;
 | 
				
			||||||
		const char *name;
 | 
							const char *name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (p->id != SPA_PARAM_EnumRoute)
 | 
							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,
 | 
							if (spa_pod_parse_object(p->param,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamRoute, NULL,
 | 
									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_direction, SPA_POD_Id(&dir),
 | 
				
			||||||
				SPA_PARAM_ROUTE_name, SPA_POD_String(&name)) < 0)
 | 
									SPA_PARAM_ROUTE_name, SPA_POD_String(&name)) < 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		if (dir != direction)
 | 
							if (dir != direction)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		if (spa_streq(name, port_name))
 | 
							if (spa_streq(name, port_name))
 | 
				
			||||||
			return id;
 | 
								return index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return SPA_ID_INVALID;
 | 
						return SPA_ID_INVALID;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,7 +103,7 @@ void collect_card_info(struct pw_manager_object *card, struct card_info *info);
 | 
				
			||||||
/* ========================================================================== */
 | 
					/* ========================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct profile_info {
 | 
					struct profile_info {
 | 
				
			||||||
	uint32_t id;
 | 
						uint32_t index;
 | 
				
			||||||
	const char *name;
 | 
						const char *name;
 | 
				
			||||||
	const char *description;
 | 
						const char *description;
 | 
				
			||||||
	uint32_t priority;
 | 
						uint32_t priority;
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ uint32_t collect_profile_info(struct pw_manager_object *card, struct card_info *
 | 
				
			||||||
/* ========================================================================== */
 | 
					/* ========================================================================== */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct port_info {
 | 
					struct port_info {
 | 
				
			||||||
	uint32_t id;
 | 
						uint32_t index;
 | 
				
			||||||
	uint32_t direction;
 | 
						uint32_t direction;
 | 
				
			||||||
	const char *name;
 | 
						const char *name;
 | 
				
			||||||
	const char *description;
 | 
						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);
 | 
					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_profile_index(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_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);
 | 
					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);
 | 
					bool collect_is_linked(struct pw_manager *m, uint32_t obj_id, enum pw_direction direction);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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_manager *manager = client->manager;
 | 
				
			||||||
	struct pw_node_info *info;
 | 
						struct pw_node_info *info;
 | 
				
			||||||
	uint32_t id, card_id = SPA_ID_INVALID, device_id = SPA_ID_INVALID;
 | 
						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;
 | 
						const char *name, *str, *port_name;
 | 
				
			||||||
	struct pw_manager_object *o, *card = NULL;
 | 
						struct pw_manager_object *o, *card = NULL;
 | 
				
			||||||
	int res;
 | 
						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)
 | 
						if (card == NULL || device_id == SPA_ID_INVALID)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	port_id = find_port_id(card, direction, port_name);
 | 
						port_index = find_port_index(card, direction, port_name);
 | 
				
			||||||
	if (port_id == SPA_ID_INVALID)
 | 
						if (port_index == SPA_ID_INVALID)
 | 
				
			||||||
		return -ENOENT;
 | 
							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 res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return operation_new(client, tag);
 | 
						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;
 | 
							res = 0;
 | 
				
			||||||
		for (j = 0; j < pi->n_devices; ++j) {
 | 
							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)
 | 
								if (res < 0)
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -3460,7 +3460,7 @@ static int fill_card_info(struct client *client, struct message *m,
 | 
				
			||||||
				const char *name = "off";
 | 
									const char *name = "off";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (j = 0; j < n_profiles; ++j) {
 | 
									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;
 | 
											name = profile_info[j].name;
 | 
				
			||||||
						break;
 | 
											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 *manager = client->manager;
 | 
				
			||||||
	struct pw_manager_object *o;
 | 
						struct pw_manager_object *o;
 | 
				
			||||||
	const char *profile_name;
 | 
						const char *profile_name;
 | 
				
			||||||
	uint32_t profile_id = SPA_ID_INVALID;
 | 
						uint32_t profile_index = SPA_ID_INVALID;
 | 
				
			||||||
	struct selector sel;
 | 
						struct selector sel;
 | 
				
			||||||
	char buf[1024];
 | 
						char buf[1024];
 | 
				
			||||||
	struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buf, sizeof(buf));
 | 
						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)
 | 
						if ((o = select_object(manager, &sel)) == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							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;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!SPA_FLAG_IS_SET(o->permissions, PW_PERM_W | PW_PERM_X))
 | 
						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_PARAM_Profile, 0,
 | 
				
			||||||
			spa_pod_builder_add_object(&b,
 | 
								spa_pod_builder_add_object(&b,
 | 
				
			||||||
				SPA_TYPE_OBJECT_ParamProfile, SPA_PARAM_Profile,
 | 
									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)));
 | 
									SPA_PARAM_PROFILE_save, SPA_POD_Bool(true)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return operation_new(client, tag);
 | 
						return operation_new(client, tag);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue