mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: use right prefix for object check
This commit is contained in:
		
							parent
							
								
									f8059be328
								
							
						
					
					
						commit
						b0a717c95e
					
				
					 2 changed files with 63 additions and 63 deletions
				
			
		| 
						 | 
					@ -22,17 +22,17 @@
 | 
				
			||||||
 * DEALINGS IN THE SOFTWARE.
 | 
					 * DEALINGS IN THE SOFTWARE.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_client(struct pw_manager_object *o)
 | 
					static bool object_is_client(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return strcmp(o->type, PW_TYPE_INTERFACE_Client) == 0;
 | 
						return strcmp(o->type, PW_TYPE_INTERFACE_Client) == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_module(struct pw_manager_object *o)
 | 
					static bool object_is_module(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return strcmp(o->type, PW_TYPE_INTERFACE_Module) == 0;
 | 
						return strcmp(o->type, PW_TYPE_INTERFACE_Module) == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_card(struct pw_manager_object *o)
 | 
					static bool object_is_card(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
| 
						 | 
					@ -42,17 +42,17 @@ static bool is_card(struct pw_manager_object *o)
 | 
				
			||||||
	    strcmp(str, "Audio/Device") == 0;
 | 
						    strcmp(str, "Audio/Device") == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_sink(struct pw_manager_object *o)
 | 
					static bool object_is_sink(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
	    strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
 | 
						    strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
 | 
				
			||||||
	    o->props != NULL &&
 | 
						    o->props != NULL &&
 | 
				
			||||||
	    (str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
 | 
						    (str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
 | 
				
			||||||
	    strcmp(str, "Audio/Sink") == 0;
 | 
						    (strcmp(str, "Audio/Sink") == 0 || strcmp(str, "Audio/Sink/Virtual") == 0);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_source(struct pw_manager_object *o)
 | 
					static bool object_is_source(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
| 
						 | 
					@ -62,12 +62,12 @@ static bool is_source(struct pw_manager_object *o)
 | 
				
			||||||
	    strcmp(str, "Audio/Source") == 0;
 | 
						    strcmp(str, "Audio/Source") == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_source_or_monitor(struct pw_manager_object *o)
 | 
					static bool object_is_source_or_monitor(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return is_source(o) || is_sink(o);
 | 
						return object_is_source(o) || object_is_sink(o);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_sink_input(struct pw_manager_object *o)
 | 
					static bool object_is_sink_input(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
| 
						 | 
					@ -77,7 +77,7 @@ static bool is_sink_input(struct pw_manager_object *o)
 | 
				
			||||||
	    strcmp(str, "Stream/Output/Audio") == 0;
 | 
						    strcmp(str, "Stream/Output/Audio") == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_source_output(struct pw_manager_object *o)
 | 
					static bool object_is_source_output(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	return
 | 
						return
 | 
				
			||||||
| 
						 | 
					@ -87,12 +87,12 @@ static bool is_source_output(struct pw_manager_object *o)
 | 
				
			||||||
	    strcmp(str, "Stream/Input/Audio") == 0;
 | 
						    strcmp(str, "Stream/Input/Audio") == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_recordable(struct pw_manager_object *o)
 | 
					static bool object_is_recordable(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return is_source(o) || is_sink(o) || is_sink_input(o);
 | 
						return object_is_source(o) || object_is_sink(o) || object_is_sink_input(o);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool is_link(struct pw_manager_object *o)
 | 
					static bool object_is_link(struct pw_manager_object *o)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return strcmp(o->type, PW_TYPE_INTERFACE_Link) == 0;
 | 
						return strcmp(o->type, PW_TYPE_INTERFACE_Link) == 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -154,7 +154,7 @@ static struct pw_manager_object *find_linked(struct pw_manager *m, uint32_t obj_
 | 
				
			||||||
	uint32_t in_node, out_node;
 | 
						uint32_t in_node, out_node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_for_each(o, &m->object_list, link) {
 | 
						spa_list_for_each(o, &m->object_list, link) {
 | 
				
			||||||
		if (o->props == NULL || !is_link(o))
 | 
							if (o->props == NULL || !object_is_link(o))
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((str = pw_properties_get(o->props, PW_KEY_LINK_OUTPUT_NODE)) == NULL)
 | 
							if ((str = pw_properties_get(o->props, PW_KEY_LINK_OUTPUT_NODE)) == NULL)
 | 
				
			||||||
| 
						 | 
					@ -165,12 +165,12 @@ static struct pw_manager_object *find_linked(struct pw_manager *m, uint32_t obj_
 | 
				
			||||||
		in_node = pw_properties_parse_int(str);
 | 
							in_node = pw_properties_parse_int(str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (direction == PW_DIRECTION_OUTPUT && obj_id == out_node) {
 | 
							if (direction == PW_DIRECTION_OUTPUT && obj_id == out_node) {
 | 
				
			||||||
			struct selector sel = { .id = in_node, .type = is_sink, };
 | 
								struct selector sel = { .id = in_node, .type = object_is_sink, };
 | 
				
			||||||
			if ((p = select_object(m, &sel)) != NULL)
 | 
								if ((p = select_object(m, &sel)) != NULL)
 | 
				
			||||||
				return p;
 | 
									return p;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (direction == PW_DIRECTION_INPUT && obj_id == in_node) {
 | 
							if (direction == PW_DIRECTION_INPUT && obj_id == in_node) {
 | 
				
			||||||
			struct selector sel = { .id = out_node, .type = is_recordable, };
 | 
								struct selector sel = { .id = out_node, .type = object_is_recordable, };
 | 
				
			||||||
			if ((p = select_object(m, &sel)) != NULL)
 | 
								if ((p = select_object(m, &sel)) != NULL)
 | 
				
			||||||
				return p;
 | 
									return p;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -657,33 +657,33 @@ static uint32_t get_event_and_id(struct client *client, struct pw_manager_object
 | 
				
			||||||
	uint32_t event = 0, res_id = o->id;
 | 
						uint32_t event = 0, res_id = o->id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (client->subscribed & SUBSCRIPTION_MASK_SINK &&
 | 
						if (client->subscribed & SUBSCRIPTION_MASK_SINK &&
 | 
				
			||||||
	    is_sink(o)) {
 | 
						    object_is_sink(o)) {
 | 
				
			||||||
		event = SUBSCRIPTION_EVENT_SINK;
 | 
							event = SUBSCRIPTION_EVENT_SINK;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (client->subscribed & SUBSCRIPTION_MASK_SOURCE &&
 | 
						else if (client->subscribed & SUBSCRIPTION_MASK_SOURCE &&
 | 
				
			||||||
	    is_source_or_monitor(o)) {
 | 
						    object_is_source_or_monitor(o)) {
 | 
				
			||||||
		if (!is_source(o))
 | 
							if (!object_is_source(o))
 | 
				
			||||||
			res_id |= MONITOR_FLAG;
 | 
								res_id |= MONITOR_FLAG;
 | 
				
			||||||
		event = SUBSCRIPTION_EVENT_SOURCE;
 | 
							event = SUBSCRIPTION_EVENT_SOURCE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (client->subscribed & SUBSCRIPTION_MASK_SINK_INPUT &&
 | 
						else if (client->subscribed & SUBSCRIPTION_MASK_SINK_INPUT &&
 | 
				
			||||||
	    is_sink_input(o)) {
 | 
						    object_is_sink_input(o)) {
 | 
				
			||||||
		event = SUBSCRIPTION_EVENT_SINK_INPUT;
 | 
							event = SUBSCRIPTION_EVENT_SINK_INPUT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (client->subscribed & SUBSCRIPTION_MASK_SOURCE_OUTPUT &&
 | 
						else if (client->subscribed & SUBSCRIPTION_MASK_SOURCE_OUTPUT &&
 | 
				
			||||||
	    is_source_output(o)) {
 | 
						    object_is_source_output(o)) {
 | 
				
			||||||
		event = SUBSCRIPTION_EVENT_SOURCE_OUTPUT;
 | 
							event = SUBSCRIPTION_EVENT_SOURCE_OUTPUT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (client->subscribed & SUBSCRIPTION_MASK_MODULE &&
 | 
						else if (client->subscribed & SUBSCRIPTION_MASK_MODULE &&
 | 
				
			||||||
	    is_module(o)) {
 | 
						    object_is_module(o)) {
 | 
				
			||||||
		event = SUBSCRIPTION_EVENT_MODULE;
 | 
							event = SUBSCRIPTION_EVENT_MODULE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (client->subscribed & SUBSCRIPTION_MASK_CLIENT &&
 | 
						else if (client->subscribed & SUBSCRIPTION_MASK_CLIENT &&
 | 
				
			||||||
	    is_client(o)) {
 | 
						    object_is_client(o)) {
 | 
				
			||||||
		event = SUBSCRIPTION_EVENT_CLIENT;
 | 
							event = SUBSCRIPTION_EVENT_CLIENT;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else if (client->subscribed & SUBSCRIPTION_MASK_CARD &&
 | 
						else if (client->subscribed & SUBSCRIPTION_MASK_CARD &&
 | 
				
			||||||
	    is_card(o)) {
 | 
						    object_is_card(o)) {
 | 
				
			||||||
		event = SUBSCRIPTION_EVENT_CARD;
 | 
							event = SUBSCRIPTION_EVENT_CARD;
 | 
				
			||||||
	} else
 | 
						} else
 | 
				
			||||||
		event = SPA_ID_INVALID;
 | 
							event = SPA_ID_INVALID;
 | 
				
			||||||
| 
						 | 
					@ -1047,7 +1047,7 @@ static int reply_create_playback_stream(struct stream *stream)
 | 
				
			||||||
		TAG_INVALID);
 | 
							TAG_INVALID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	peer = find_linked(manager, stream->id, stream->direction);
 | 
						peer = find_linked(manager, stream->id, stream->direction);
 | 
				
			||||||
	if (peer && is_sink(peer)) {
 | 
						if (peer && object_is_sink(peer)) {
 | 
				
			||||||
		peer_id = peer->id;
 | 
							peer_id = peer->id;
 | 
				
			||||||
		peer_name = pw_properties_get(peer->props, PW_KEY_NODE_NAME);
 | 
							peer_name = pw_properties_get(peer->props, PW_KEY_NODE_NAME);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					@ -1160,11 +1160,11 @@ static int reply_create_record_stream(struct stream *stream)
 | 
				
			||||||
		TAG_INVALID);
 | 
							TAG_INVALID);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	peer = find_linked(manager, stream->id, stream->direction);
 | 
						peer = find_linked(manager, stream->id, stream->direction);
 | 
				
			||||||
	if (peer && is_sink_input(peer))
 | 
						if (peer && object_is_sink_input(peer))
 | 
				
			||||||
		peer = find_linked(manager, peer->id, PW_DIRECTION_OUTPUT);
 | 
							peer = find_linked(manager, peer->id, PW_DIRECTION_OUTPUT);
 | 
				
			||||||
	if (peer && is_source_or_monitor(peer)) {
 | 
						if (peer && object_is_source_or_monitor(peer)) {
 | 
				
			||||||
		name = pw_properties_get(peer->props, PW_KEY_NODE_NAME);
 | 
							name = pw_properties_get(peer->props, PW_KEY_NODE_NAME);
 | 
				
			||||||
		if (!is_source(peer)) {
 | 
							if (!object_is_source(peer)) {
 | 
				
			||||||
			size_t len = (name ? strlen(name) : 5) + 10;
 | 
								size_t len = (name ? strlen(name) : 5) + 10;
 | 
				
			||||||
			peer_id = peer->id | MONITOR_FLAG;
 | 
								peer_id = peer->id | MONITOR_FLAG;
 | 
				
			||||||
			peer_name = tmp = alloca(len);
 | 
								peer_name = tmp = alloca(len);
 | 
				
			||||||
| 
						 | 
					@ -2650,9 +2650,9 @@ static int do_set_stream_volume(struct client *client, uint32_t command, uint32_
 | 
				
			||||||
		spa_zero(sel);
 | 
							spa_zero(sel);
 | 
				
			||||||
		sel.id = id;
 | 
							sel.id = id;
 | 
				
			||||||
		if (command == COMMAND_SET_SINK_INPUT_VOLUME)
 | 
							if (command == COMMAND_SET_SINK_INPUT_VOLUME)
 | 
				
			||||||
			sel.type = is_sink_input;
 | 
								sel.type = object_is_sink_input;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			sel.type = is_source_output;
 | 
								sel.type = object_is_source_output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		o = select_object(manager, &sel);
 | 
							o = select_object(manager, &sel);
 | 
				
			||||||
		if (o == NULL)
 | 
							if (o == NULL)
 | 
				
			||||||
| 
						 | 
					@ -2701,9 +2701,9 @@ static int do_set_stream_mute(struct client *client, uint32_t command, uint32_t
 | 
				
			||||||
		spa_zero(sel);
 | 
							spa_zero(sel);
 | 
				
			||||||
		sel.id = id;
 | 
							sel.id = id;
 | 
				
			||||||
		if (command == COMMAND_SET_SINK_INPUT_MUTE)
 | 
							if (command == COMMAND_SET_SINK_INPUT_MUTE)
 | 
				
			||||||
			sel.type = is_sink_input;
 | 
								sel.type = object_is_sink_input;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			sel.type = is_source_output;
 | 
								sel.type = object_is_source_output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		o = select_object(manager, &sel);
 | 
							o = select_object(manager, &sel);
 | 
				
			||||||
		if (o == NULL)
 | 
							if (o == NULL)
 | 
				
			||||||
| 
						 | 
					@ -2724,11 +2724,11 @@ static const char *get_default(struct client *client, bool sink)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(sel);
 | 
						spa_zero(sel);
 | 
				
			||||||
	if (sink) {
 | 
						if (sink) {
 | 
				
			||||||
		sel.type = is_sink;
 | 
							sel.type = object_is_sink;
 | 
				
			||||||
		sel.id = client->default_sink;
 | 
							sel.id = client->default_sink;
 | 
				
			||||||
		def = "@DEFAULT_SINK@";
 | 
							def = "@DEFAULT_SINK@";
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		sel.type = is_source;
 | 
							sel.type = object_is_source;
 | 
				
			||||||
		sel.id = client->default_source;
 | 
							sel.id = client->default_source;
 | 
				
			||||||
		def = "@DEFAULT_SOURCE@";
 | 
							def = "@DEFAULT_SOURCE@";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -2753,10 +2753,10 @@ static struct pw_manager_object *find_device(struct client *client,
 | 
				
			||||||
	sel.value = name;
 | 
						sel.value = name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (sink) {
 | 
						if (sink) {
 | 
				
			||||||
		sel.type = is_sink;
 | 
							sel.type = object_is_sink;
 | 
				
			||||||
		def = "@DEFAULT_SINK@";
 | 
							def = "@DEFAULT_SINK@";
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		sel.type = is_source;
 | 
							sel.type = object_is_source;
 | 
				
			||||||
		def = "@DEFAULT_SOURCE@";
 | 
							def = "@DEFAULT_SOURCE@";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (sel.value != NULL && strcmp(sel.value, def) == 0)
 | 
						if (sel.value != NULL && strcmp(sel.value, def) == 0)
 | 
				
			||||||
| 
						 | 
					@ -2807,7 +2807,7 @@ static int do_set_volume(struct client *client, uint32_t command, uint32_t tag,
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
				
			||||||
		dev_info.device = (uint32_t)atoi(str);
 | 
							dev_info.device = (uint32_t)atoi(str);
 | 
				
			||||||
	if (card_id != SPA_ID_INVALID) {
 | 
						if (card_id != SPA_ID_INVALID) {
 | 
				
			||||||
		struct selector sel = { .id = card_id, .type = is_card, };
 | 
							struct selector sel = { .id = card_id, .type = object_is_card, };
 | 
				
			||||||
		card = select_object(manager, &sel);
 | 
							card = select_object(manager, &sel);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	collect_device_info(o, card, &dev_info);
 | 
						collect_device_info(o, card, &dev_info);
 | 
				
			||||||
| 
						 | 
					@ -2866,7 +2866,7 @@ static int do_set_mute(struct client *client, uint32_t command, uint32_t tag, st
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
				
			||||||
		dev_info.device = (uint32_t)atoi(str);
 | 
							dev_info.device = (uint32_t)atoi(str);
 | 
				
			||||||
	if (card_id != SPA_ID_INVALID) {
 | 
						if (card_id != SPA_ID_INVALID) {
 | 
				
			||||||
		struct selector sel = { .id = card_id, .type = is_card, };
 | 
							struct selector sel = { .id = card_id, .type = object_is_card, };
 | 
				
			||||||
		card = select_object(manager, &sel);
 | 
							card = select_object(manager, &sel);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	collect_device_info(o, card, &dev_info);
 | 
						collect_device_info(o, card, &dev_info);
 | 
				
			||||||
| 
						 | 
					@ -2923,7 +2923,7 @@ static int do_set_port(struct client *client, uint32_t command, uint32_t tag, st
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
				
			||||||
		device_id = (uint32_t)atoi(str);
 | 
							device_id = (uint32_t)atoi(str);
 | 
				
			||||||
	if (card_id != SPA_ID_INVALID) {
 | 
						if (card_id != SPA_ID_INVALID) {
 | 
				
			||||||
		struct selector sel = { .id = card_id, .type = is_card, };
 | 
							struct selector sel = { .id = card_id, .type = object_is_card, };
 | 
				
			||||||
		card = select_object(manager, &sel);
 | 
							card = select_object(manager, &sel);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (card == NULL || device_id == SPA_ID_INVALID)
 | 
						if (card == NULL || device_id == SPA_ID_INVALID)
 | 
				
			||||||
| 
						 | 
					@ -3215,7 +3215,7 @@ static int fill_client_info(struct client *client, struct message *m,
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	uint32_t module_id = SPA_ID_INVALID;
 | 
						uint32_t module_id = SPA_ID_INVALID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_client(o) || info == NULL || info->props == NULL)
 | 
						if (!object_is_client(o) || info == NULL || info->props == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
				
			||||||
| 
						 | 
					@ -3240,7 +3240,7 @@ static int fill_module_info(struct client *client, struct message *m,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct pw_module_info *info = o->info;
 | 
						struct pw_module_info *info = o->info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_module(o) || info == NULL || info->props == NULL)
 | 
						if (!object_is_module(o) || info == NULL || info->props == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	message_put(m,
 | 
						message_put(m,
 | 
				
			||||||
| 
						 | 
					@ -3272,7 +3272,7 @@ static int fill_card_info(struct client *client, struct message *m,
 | 
				
			||||||
	struct card_info card_info = CARD_INFO_INIT;
 | 
						struct card_info card_info = CARD_INFO_INIT;
 | 
				
			||||||
	struct profile_info *profile_info;
 | 
						struct profile_info *profile_info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_card(o) || info == NULL || info->props == NULL)
 | 
						if (!object_is_card(o) || info == NULL || info->props == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
				
			||||||
| 
						 | 
					@ -3391,7 +3391,7 @@ static int fill_sink_info(struct client *client, struct message *m,
 | 
				
			||||||
	struct card_info card_info = CARD_INFO_INIT;
 | 
						struct card_info card_info = CARD_INFO_INIT;
 | 
				
			||||||
	struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_OUTPUT);
 | 
						struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_OUTPUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_sink(o) || info == NULL || info->props == NULL)
 | 
						if (!object_is_sink(o) || info == NULL || info->props == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((name = spa_dict_lookup(info->props, PW_KEY_NODE_NAME)) != NULL) {
 | 
						if ((name = spa_dict_lookup(info->props, PW_KEY_NODE_NAME)) != NULL) {
 | 
				
			||||||
| 
						 | 
					@ -3409,7 +3409,7 @@ static int fill_sink_info(struct client *client, struct message *m,
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, "card.profile.device")) != NULL)
 | 
				
			||||||
		dev_info.device = (uint32_t)atoi(str);
 | 
							dev_info.device = (uint32_t)atoi(str);
 | 
				
			||||||
	if (card_id != SPA_ID_INVALID) {
 | 
						if (card_id != SPA_ID_INVALID) {
 | 
				
			||||||
		struct selector sel = { .id = card_id, .type = is_card, };
 | 
							struct selector sel = { .id = card_id, .type = object_is_card, };
 | 
				
			||||||
		card = select_object(manager, &sel);
 | 
							card = select_object(manager, &sel);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (card)
 | 
						if (card)
 | 
				
			||||||
| 
						 | 
					@ -3523,8 +3523,8 @@ static int fill_source_info(struct client *client, struct message *m,
 | 
				
			||||||
	struct card_info card_info = CARD_INFO_INIT;
 | 
						struct card_info card_info = CARD_INFO_INIT;
 | 
				
			||||||
	struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_INPUT);
 | 
						struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_INPUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	is_monitor = is_sink(o);
 | 
						is_monitor = object_is_sink(o);
 | 
				
			||||||
	if ((!is_source(o) && !is_monitor) || info == NULL || info->props == NULL)
 | 
						if ((!object_is_source(o) && !is_monitor) || info == NULL || info->props == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((name = spa_dict_lookup(info->props, PW_KEY_NODE_NAME)) != NULL) {
 | 
						if ((name = spa_dict_lookup(info->props, PW_KEY_NODE_NAME)) != NULL) {
 | 
				
			||||||
| 
						 | 
					@ -3549,7 +3549,7 @@ static int fill_source_info(struct client *client, struct message *m,
 | 
				
			||||||
		dev_info.device = (uint32_t)atoi(str);
 | 
							dev_info.device = (uint32_t)atoi(str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (card_id != SPA_ID_INVALID) {
 | 
						if (card_id != SPA_ID_INVALID) {
 | 
				
			||||||
		struct selector sel = { .id = card_id, .type = is_card, };
 | 
							struct selector sel = { .id = card_id, .type = object_is_card, };
 | 
				
			||||||
		card = select_object(manager, &sel);
 | 
							card = select_object(manager, &sel);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (card)
 | 
						if (card)
 | 
				
			||||||
| 
						 | 
					@ -3657,7 +3657,7 @@ static int fill_sink_input_info(struct client *client, struct message *m,
 | 
				
			||||||
	uint32_t module_id = SPA_ID_INVALID, client_id = SPA_ID_INVALID;
 | 
						uint32_t module_id = SPA_ID_INVALID, client_id = SPA_ID_INVALID;
 | 
				
			||||||
	struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_OUTPUT);
 | 
						struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_OUTPUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_sink_input(o) || info == NULL || info->props == NULL)
 | 
						if (!object_is_sink_input(o) || info == NULL || info->props == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
				
			||||||
| 
						 | 
					@ -3727,7 +3727,7 @@ static int fill_source_output_info(struct client *client, struct message *m,
 | 
				
			||||||
	uint32_t peer_id;
 | 
						uint32_t peer_id;
 | 
				
			||||||
	struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_INPUT);
 | 
						struct device_info dev_info = DEVICE_INFO_INIT(PW_DIRECTION_INPUT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!is_source_output(o) || info == NULL || info->props == NULL)
 | 
						if (!object_is_source_output(o) || info == NULL || info->props == NULL)
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
						if ((str = spa_dict_lookup(info->props, PW_KEY_MODULE_ID)) != NULL)
 | 
				
			||||||
| 
						 | 
					@ -3743,9 +3743,9 @@ static int fill_source_output_info(struct client *client, struct message *m,
 | 
				
			||||||
		return -ENOENT;
 | 
							return -ENOENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	peer = find_linked(manager, o->id, PW_DIRECTION_INPUT);
 | 
						peer = find_linked(manager, o->id, PW_DIRECTION_INPUT);
 | 
				
			||||||
	if (peer && is_source_or_monitor(peer)) {
 | 
						if (peer && object_is_source_or_monitor(peer)) {
 | 
				
			||||||
		peer_id = peer->id;
 | 
							peer_id = peer->id;
 | 
				
			||||||
		if (!is_source(peer))
 | 
							if (!object_is_source(peer))
 | 
				
			||||||
			peer_id |= MONITOR_FLAG;
 | 
								peer_id |= MONITOR_FLAG;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		peer_id = SPA_ID_INVALID;
 | 
							peer_id = SPA_ID_INVALID;
 | 
				
			||||||
| 
						 | 
					@ -3807,36 +3807,36 @@ static int do_get_info(struct client *client, uint32_t command, uint32_t tag, st
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (command) {
 | 
						switch (command) {
 | 
				
			||||||
	case COMMAND_GET_CLIENT_INFO:
 | 
						case COMMAND_GET_CLIENT_INFO:
 | 
				
			||||||
		sel.type = is_client;
 | 
							sel.type = object_is_client;
 | 
				
			||||||
		fill_func = fill_client_info;
 | 
							fill_func = fill_client_info;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_GET_MODULE_INFO:
 | 
						case COMMAND_GET_MODULE_INFO:
 | 
				
			||||||
		sel.type = is_module;
 | 
							sel.type = object_is_module;
 | 
				
			||||||
		fill_func = fill_module_info;
 | 
							fill_func = fill_module_info;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_GET_CARD_INFO:
 | 
						case COMMAND_GET_CARD_INFO:
 | 
				
			||||||
		sel.type = is_card;
 | 
							sel.type = object_is_card;
 | 
				
			||||||
		sel.key = PW_KEY_DEVICE_NAME;
 | 
							sel.key = PW_KEY_DEVICE_NAME;
 | 
				
			||||||
		fill_func = fill_card_info;
 | 
							fill_func = fill_card_info;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_GET_SINK_INFO:
 | 
						case COMMAND_GET_SINK_INFO:
 | 
				
			||||||
		sel.type = is_sink;
 | 
							sel.type = object_is_sink;
 | 
				
			||||||
		sel.key = PW_KEY_NODE_NAME;
 | 
							sel.key = PW_KEY_NODE_NAME;
 | 
				
			||||||
		fill_func = fill_sink_info;
 | 
							fill_func = fill_sink_info;
 | 
				
			||||||
		def = "@DEFAULT_SINK@";
 | 
							def = "@DEFAULT_SINK@";
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_GET_SOURCE_INFO:
 | 
						case COMMAND_GET_SOURCE_INFO:
 | 
				
			||||||
		sel.type = is_source_or_monitor;
 | 
							sel.type = object_is_source_or_monitor;
 | 
				
			||||||
		sel.key = PW_KEY_NODE_NAME;
 | 
							sel.key = PW_KEY_NODE_NAME;
 | 
				
			||||||
		fill_func = fill_source_info;
 | 
							fill_func = fill_source_info;
 | 
				
			||||||
		def = "@DEFAULT_SOURCE@";
 | 
							def = "@DEFAULT_SOURCE@";
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_GET_SINK_INPUT_INFO:
 | 
						case COMMAND_GET_SINK_INPUT_INFO:
 | 
				
			||||||
		sel.type = is_sink_input;
 | 
							sel.type = object_is_sink_input;
 | 
				
			||||||
		fill_func = fill_sink_input_info;
 | 
							fill_func = fill_sink_input_info;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_GET_SOURCE_OUTPUT_INFO:
 | 
						case COMMAND_GET_SOURCE_OUTPUT_INFO:
 | 
				
			||||||
		sel.type = is_source_output;
 | 
							sel.type = object_is_source_output;
 | 
				
			||||||
		fill_func = fill_source_output_info;
 | 
							fill_func = fill_source_output_info;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -4186,7 +4186,7 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(sel);
 | 
						spa_zero(sel);
 | 
				
			||||||
	sel.key = PW_KEY_DEVICE_NAME;
 | 
						sel.key = PW_KEY_DEVICE_NAME;
 | 
				
			||||||
	sel.type = is_card;
 | 
						sel.type = object_is_card;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = message_get(m,
 | 
						if ((res = message_get(m,
 | 
				
			||||||
			TAG_U32, &sel.id,
 | 
								TAG_U32, &sel.id,
 | 
				
			||||||
| 
						 | 
					@ -4281,7 +4281,7 @@ static int do_move_stream(struct client *client, uint32_t command, uint32_t tag,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(sel);
 | 
						spa_zero(sel);
 | 
				
			||||||
	sel.id = id;
 | 
						sel.id = id;
 | 
				
			||||||
	sel.type = sink ? is_sink_input: is_source_output;
 | 
						sel.type = sink ? object_is_sink_input: object_is_source_output;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	o = select_object(manager, &sel);
 | 
						o = select_object(manager, &sel);
 | 
				
			||||||
	if (o == NULL)
 | 
						if (o == NULL)
 | 
				
			||||||
| 
						 | 
					@ -4320,13 +4320,13 @@ static int do_kill(struct client *client, uint32_t command, uint32_t tag, struct
 | 
				
			||||||
	sel.id = id;
 | 
						sel.id = id;
 | 
				
			||||||
	switch (command) {
 | 
						switch (command) {
 | 
				
			||||||
	case COMMAND_KILL_CLIENT:
 | 
						case COMMAND_KILL_CLIENT:
 | 
				
			||||||
		sel.type = is_client;
 | 
							sel.type = object_is_client;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_KILL_SINK_INPUT:
 | 
						case COMMAND_KILL_SINK_INPUT:
 | 
				
			||||||
		sel.type = is_sink_input;
 | 
							sel.type = object_is_sink_input;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case COMMAND_KILL_SOURCE_OUTPUT:
 | 
						case COMMAND_KILL_SOURCE_OUTPUT:
 | 
				
			||||||
		sel.type = is_source_output;
 | 
							sel.type = object_is_source_output;
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue