mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	tools: cleanup up printf
Make all tools output to stdout (pw-mon mostly) so that we can pipe the output around. Send errors to stderr. fprintf(stdout, ...) -> printf(...) setlinebuf for stdout so that pipe works better. See #2110
This commit is contained in:
		
							parent
							
								
									a16cd95593
								
							
						
					
					
						commit
						afc88a12e5
					
				
					 12 changed files with 349 additions and 334 deletions
				
			
		| 
						 | 
				
			
			@ -648,7 +648,7 @@ static void on_core_info(void *userdata, const struct pw_core_info *info)
 | 
			
		|||
	struct data *data = userdata;
 | 
			
		||||
 | 
			
		||||
	if (data->verbose)
 | 
			
		||||
		fprintf(stdout, "remote %"PRIu32" is named \"%s\"\n",
 | 
			
		||||
		printf("remote %"PRIu32" is named \"%s\"\n",
 | 
			
		||||
				info->id, info->name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -808,7 +808,7 @@ static void registry_event_global(void *userdata, uint32_t id,
 | 
			
		|||
					id, type, name, media_class, desc ? : "", prio);
 | 
			
		||||
 | 
			
		||||
			spa_dict_for_each(item, props) {
 | 
			
		||||
				fprintf(stdout, "\t\t%s = \"%s\"\n", item->key, item->value);
 | 
			
		||||
				printf("\t\t%s = \"%s\"\n", item->key, item->value);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1533,7 +1533,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			return EXIT_SUCCESS;
 | 
			
		||||
 | 
			
		||||
		case OPT_VERSION:
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				prog,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@
 | 
			
		|||
#define FNM_EXTMATCH 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define spa_debug(...) fprintf(stdout,__VA_ARGS__);fputc('\n', stdout)
 | 
			
		||||
#define spa_debug(fmt,...) printf(fmt, ## __VA_ARGS__)
 | 
			
		||||
 | 
			
		||||
#include <spa/utils/result.h>
 | 
			
		||||
#include <spa/utils/string.h>
 | 
			
		||||
| 
						 | 
				
			
			@ -157,15 +157,15 @@ static void print_properties(struct spa_dict *props, char mark, bool header)
 | 
			
		|||
	const struct spa_dict_item *item;
 | 
			
		||||
 | 
			
		||||
	if (header)
 | 
			
		||||
		fprintf(stdout, "%c\tproperties:\n", mark);
 | 
			
		||||
		printf("%c\tproperties:\n", mark);
 | 
			
		||||
	if (props == NULL || props->n_items == 0) {
 | 
			
		||||
		if (header)
 | 
			
		||||
			fprintf(stdout, "\t\tnone\n");
 | 
			
		||||
			printf("\t\tnone\n");
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	spa_dict_for_each(item, props) {
 | 
			
		||||
		fprintf(stdout, "%c\t\t%s = \"%s\"\n", mark, item->key, item->value);
 | 
			
		||||
		printf("%c\t\t%s = \"%s\"\n", mark, item->key, item->value);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -174,16 +174,16 @@ static void print_params(struct spa_param_info *params, uint32_t n_params, char
 | 
			
		|||
	uint32_t i;
 | 
			
		||||
 | 
			
		||||
	if (header)
 | 
			
		||||
		fprintf(stdout, "%c\tparams: (%u)\n", mark, n_params);
 | 
			
		||||
		printf("%c\tparams: (%u)\n", mark, n_params);
 | 
			
		||||
	if (params == NULL || n_params == 0) {
 | 
			
		||||
		if (header)
 | 
			
		||||
			fprintf(stdout, "\t\tnone\n");
 | 
			
		||||
			printf("\t\tnone\n");
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	for (i = 0; i < n_params; i++) {
 | 
			
		||||
		const struct spa_type_info *type_info = spa_type_param;
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%c\t  %d (%s) %c%c\n",
 | 
			
		||||
		printf("%c\t  %d (%s) %c%c\n",
 | 
			
		||||
				params[i].user > 0 ? mark : ' ', params[i].id,
 | 
			
		||||
				spa_debug_type_find_name(type_info, params[i].id),
 | 
			
		||||
				params[i].flags & SPA_PARAM_INFO_READ ? 'r' : '-',
 | 
			
		||||
| 
						 | 
				
			
			@ -257,9 +257,9 @@ static bool do_help(struct data *data, const char *cmd, char *args, char **error
 | 
			
		|||
{
 | 
			
		||||
	size_t i;
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "Available commands:\n");
 | 
			
		||||
	printf("Available commands:\n");
 | 
			
		||||
	for (i = 0; i < SPA_N_ELEMENTS(command_list); i++) {
 | 
			
		||||
		fprintf(stdout, "\t%-20.20s\t%s\n", command_list[i].name, command_list[i].description);
 | 
			
		||||
		printf("\t%-20.20s\t%s\n", command_list[i].name, command_list[i].description);
 | 
			
		||||
	}
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -284,7 +284,7 @@ static bool do_load_module(struct data *data, const char *cmd, char *args, char
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	id = pw_map_insert_new(&data->vars, module);
 | 
			
		||||
	fprintf(stdout, "%d = @module:%d\n", id, pw_global_get_id(pw_impl_module_get_global(module)));
 | 
			
		||||
	printf("%d = @module:%d\n", id, pw_global_get_id(pw_impl_module_get_global(module)));
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -295,7 +295,7 @@ static void on_core_info(void *_data, const struct pw_core_info *info)
 | 
			
		|||
	free(rd->name);
 | 
			
		||||
	rd->name = info->name ? strdup(info->name) : NULL;
 | 
			
		||||
	if (rd->data->interactive)
 | 
			
		||||
		fprintf(stdout, "remote %d is named '%s'\n", rd->id, rd->name);
 | 
			
		||||
		printf("remote %d is named '%s'\n", rd->id, rd->name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void set_prompt(struct remote_data *rd)
 | 
			
		||||
| 
						 | 
				
			
			@ -353,7 +353,7 @@ static int print_global(void *obj, void *data)
 | 
			
		|||
	if (filter && !global_matches(global, filter))
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "\tid %d, type %s/%d\n", global->id,
 | 
			
		||||
	printf("\tid %d, type %s/%d\n", global->id,
 | 
			
		||||
					global->type, global->version);
 | 
			
		||||
	if (global->properties)
 | 
			
		||||
		print_properties(&global->properties->dict, ' ', false);
 | 
			
		||||
| 
						 | 
				
			
			@ -383,7 +383,7 @@ static void registry_event_global(void *data, uint32_t id,
 | 
			
		|||
	global->properties = props ? pw_properties_new_dict(props) : NULL;
 | 
			
		||||
 | 
			
		||||
	if (rd->data->monitoring) {
 | 
			
		||||
		fprintf(stdout, "remote %d added global: ", rd->id);
 | 
			
		||||
		printf("remote %d added global: ", rd->id);
 | 
			
		||||
		print_global(global, NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -396,7 +396,7 @@ static void registry_event_global(void *data, uint32_t id,
 | 
			
		|||
	ret = bind_global(rd, global, &error);
 | 
			
		||||
	if (!ret) {
 | 
			
		||||
		if (rd->data->interactive)
 | 
			
		||||
			fprintf(stdout, "Error: \"%s\"\n", error);
 | 
			
		||||
			fprintf(stderr, "Error: \"%s\"\n", error);
 | 
			
		||||
		free(error);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -424,12 +424,12 @@ static void registry_event_global_remove(void *data, uint32_t id)
 | 
			
		|||
 | 
			
		||||
	global = pw_map_lookup(&rd->globals, id);
 | 
			
		||||
	if (global == NULL) {
 | 
			
		||||
		fprintf(stdout, "remote %d removed unknown global %d\n", rd->id, id);
 | 
			
		||||
		fprintf(stderr, "remote %d removed unknown global %d\n", rd->id, id);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (rd->data->monitoring) {
 | 
			
		||||
		fprintf(stdout, "remote %d removed global: ", rd->id);
 | 
			
		||||
		printf("remote %d removed global: ", rd->id);
 | 
			
		||||
		print_global(global, NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -536,7 +536,7 @@ static bool do_connect(struct data *data, const char *cmd, char *args, char **er
 | 
			
		|||
	spa_list_append(&data->remotes, &rd->link);
 | 
			
		||||
 | 
			
		||||
	if (rd->data->interactive)
 | 
			
		||||
		fprintf(stdout, "%d = @remote:%p\n", rd->id, rd->core);
 | 
			
		||||
		printf("%d = @remote:%p\n", rd->id, rd->core);
 | 
			
		||||
 | 
			
		||||
	data->current = rd;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -592,7 +592,7 @@ static bool do_list_remotes(struct data *data, const char *cmd, char *args, char
 | 
			
		|||
	struct remote_data *rd;
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(rd, &data->remotes, link)
 | 
			
		||||
		fprintf(stdout, "\t%d = @remote:%p '%s'\n", rd->id, rd->core, rd->name);
 | 
			
		||||
		printf("\t%d = @remote:%p '%s'\n", rd->id, rd->core, rd->name);
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -631,10 +631,10 @@ static void info_global(struct proxy_data *pd)
 | 
			
		|||
	if (global == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "\tid: %d\n", global->id);
 | 
			
		||||
	fprintf(stdout, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", global->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(global->permissions));
 | 
			
		||||
	fprintf(stdout, "\ttype: %s/%d\n", global->type, global->version);
 | 
			
		||||
	printf("\ttype: %s/%d\n", global->type, global->version);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void info_core(struct proxy_data *pd)
 | 
			
		||||
| 
						 | 
				
			
			@ -642,11 +642,11 @@ static void info_core(struct proxy_data *pd)
 | 
			
		|||
	struct pw_core_info *info = pd->info;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "\tcookie: %u\n", info->cookie);
 | 
			
		||||
	fprintf(stdout, "\tuser-name: \"%s\"\n", info->user_name);
 | 
			
		||||
	fprintf(stdout, "\thost-name: \"%s\"\n", info->host_name);
 | 
			
		||||
	fprintf(stdout, "\tversion: \"%s\"\n", info->version);
 | 
			
		||||
	fprintf(stdout, "\tname: \"%s\"\n", info->name);
 | 
			
		||||
	printf("\tcookie: %u\n", info->cookie);
 | 
			
		||||
	printf("\tuser-name: \"%s\"\n", info->user_name);
 | 
			
		||||
	printf("\thost-name: \"%s\"\n", info->host_name);
 | 
			
		||||
	printf("\tversion: \"%s\"\n", info->version);
 | 
			
		||||
	printf("\tname: \"%s\"\n", info->name);
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(PW_CORE_CHANGE_MASK_PROPS), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -656,9 +656,9 @@ static void info_module(struct proxy_data *pd)
 | 
			
		|||
	struct pw_module_info *info = pd->info;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "\tname: \"%s\"\n", info->name);
 | 
			
		||||
	fprintf(stdout, "\tfilename: \"%s\"\n", info->filename);
 | 
			
		||||
	fprintf(stdout, "\targs: \"%s\"\n", info->args);
 | 
			
		||||
	printf("\tname: \"%s\"\n", info->name);
 | 
			
		||||
	printf("\tfilename: \"%s\"\n", info->filename);
 | 
			
		||||
	printf("\targs: \"%s\"\n", info->args);
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(PW_MODULE_CHANGE_MASK_PROPS), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -668,16 +668,16 @@ static void info_node(struct proxy_data *pd)
 | 
			
		|||
	struct pw_node_info *info = pd->info;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "%c\tinput ports: %u/%u\n", MARK_CHANGE(PW_NODE_CHANGE_MASK_INPUT_PORTS),
 | 
			
		||||
	printf("%c\tinput ports: %u/%u\n", MARK_CHANGE(PW_NODE_CHANGE_MASK_INPUT_PORTS),
 | 
			
		||||
			info->n_input_ports, info->max_input_ports);
 | 
			
		||||
	fprintf(stdout, "%c\toutput ports: %u/%u\n", MARK_CHANGE(PW_NODE_CHANGE_MASK_OUTPUT_PORTS),
 | 
			
		||||
	printf("%c\toutput ports: %u/%u\n", MARK_CHANGE(PW_NODE_CHANGE_MASK_OUTPUT_PORTS),
 | 
			
		||||
			info->n_output_ports, info->max_output_ports);
 | 
			
		||||
	fprintf(stdout, "%c\tstate: \"%s\"", MARK_CHANGE(PW_NODE_CHANGE_MASK_STATE),
 | 
			
		||||
	printf("%c\tstate: \"%s\"", MARK_CHANGE(PW_NODE_CHANGE_MASK_STATE),
 | 
			
		||||
			pw_node_state_as_string(info->state));
 | 
			
		||||
	if (info->state == PW_NODE_STATE_ERROR && info->error)
 | 
			
		||||
		fprintf(stdout, " \"%s\"\n", info->error);
 | 
			
		||||
		printf(" \"%s\"\n", info->error);
 | 
			
		||||
	else
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(PW_NODE_CHANGE_MASK_PROPS), true);
 | 
			
		||||
	print_params(info->params, info->n_params, MARK_CHANGE(PW_NODE_CHANGE_MASK_PARAMS), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -688,7 +688,7 @@ static void info_port(struct proxy_data *pd)
 | 
			
		|||
	struct pw_port_info *info = pd->info;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "\tdirection: \"%s\"\n", pw_direction_as_string(info->direction));
 | 
			
		||||
	printf("\tdirection: \"%s\"\n", pw_direction_as_string(info->direction));
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(PW_PORT_CHANGE_MASK_PROPS), true);
 | 
			
		||||
	print_params(info->params, info->n_params, MARK_CHANGE(PW_PORT_CHANGE_MASK_PARAMS), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -699,8 +699,8 @@ static void info_factory(struct proxy_data *pd)
 | 
			
		|||
	struct pw_factory_info *info = pd->info;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "\tname: \"%s\"\n", info->name);
 | 
			
		||||
	fprintf(stdout, "\tobject-type: %s/%d\n", info->type, info->version);
 | 
			
		||||
	printf("\tname: \"%s\"\n", info->name);
 | 
			
		||||
	printf("\tobject-type: %s/%d\n", info->type, info->version);
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(PW_FACTORY_CHANGE_MASK_PROPS), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -719,22 +719,22 @@ static void info_link(struct proxy_data *pd)
 | 
			
		|||
	struct pw_link_info *info = pd->info;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "\toutput-node-id: %u\n", info->output_node_id);
 | 
			
		||||
	fprintf(stdout, "\toutput-port-id: %u\n", info->output_port_id);
 | 
			
		||||
	fprintf(stdout, "\tinput-node-id: %u\n", info->input_node_id);
 | 
			
		||||
	fprintf(stdout, "\tinput-port-id: %u\n", info->input_port_id);
 | 
			
		||||
	printf("\toutput-node-id: %u\n", info->output_node_id);
 | 
			
		||||
	printf("\toutput-port-id: %u\n", info->output_port_id);
 | 
			
		||||
	printf("\tinput-node-id: %u\n", info->input_node_id);
 | 
			
		||||
	printf("\tinput-port-id: %u\n", info->input_port_id);
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "%c\tstate: \"%s\"", MARK_CHANGE(PW_LINK_CHANGE_MASK_STATE),
 | 
			
		||||
	printf("%c\tstate: \"%s\"", MARK_CHANGE(PW_LINK_CHANGE_MASK_STATE),
 | 
			
		||||
			pw_link_state_as_string(info->state));
 | 
			
		||||
	if (info->state == PW_LINK_STATE_ERROR && info->error)
 | 
			
		||||
		printf(" \"%s\"\n", info->error);
 | 
			
		||||
	else
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	fprintf(stdout, "%c\tformat:\n", MARK_CHANGE(PW_LINK_CHANGE_MASK_FORMAT));
 | 
			
		||||
	printf("%c\tformat:\n", MARK_CHANGE(PW_LINK_CHANGE_MASK_FORMAT));
 | 
			
		||||
	if (info->format)
 | 
			
		||||
		spa_debug_pod(2, NULL, info->format);
 | 
			
		||||
	else
 | 
			
		||||
		fprintf(stdout, "\t\tnone\n");
 | 
			
		||||
		printf("\t\tnone\n");
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(PW_LINK_CHANGE_MASK_PROPS), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -765,8 +765,8 @@ static void info_endpoint(struct proxy_data *pd)
 | 
			
		|||
	const char *direction;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "\tname: %s\n", info->name);
 | 
			
		||||
	fprintf(stdout, "\tmedia-class: %s\n",  info->media_class);
 | 
			
		||||
	printf("\tname: %s\n", info->name);
 | 
			
		||||
	printf("\tmedia-class: %s\n",  info->media_class);
 | 
			
		||||
	switch(info->direction) {
 | 
			
		||||
	case PW_DIRECTION_OUTPUT:
 | 
			
		||||
		direction = "source";
 | 
			
		||||
| 
						 | 
				
			
			@ -778,10 +778,10 @@ static void info_endpoint(struct proxy_data *pd)
 | 
			
		|||
		direction = "invalid";
 | 
			
		||||
		break;
 | 
			
		||||
	}
 | 
			
		||||
	fprintf(stdout, "\tdirection: %s\n", direction);
 | 
			
		||||
	fprintf(stdout, "\tflags: 0x%x\n", info->flags);
 | 
			
		||||
	fprintf(stdout, "%c\tstreams: %u\n", MARK_CHANGE(0), info->n_streams);
 | 
			
		||||
	fprintf(stdout, "%c\tsession: %u\n", MARK_CHANGE(1), info->session_id);
 | 
			
		||||
	printf("\tdirection: %s\n", direction);
 | 
			
		||||
	printf("\tflags: 0x%x\n", info->flags);
 | 
			
		||||
	printf("%c\tstreams: %u\n", MARK_CHANGE(0), info->n_streams);
 | 
			
		||||
	printf("%c\tsession: %u\n", MARK_CHANGE(1), info->session_id);
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(2), true);
 | 
			
		||||
	print_params(info->params, info->n_params, MARK_CHANGE(3), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -792,9 +792,9 @@ static void info_endpoint_stream(struct proxy_data *pd)
 | 
			
		|||
	struct pw_endpoint_stream_info *info = pd->info;
 | 
			
		||||
 | 
			
		||||
	info_global(pd);
 | 
			
		||||
	fprintf(stdout, "\tid: %u\n", info->id);
 | 
			
		||||
	fprintf(stdout, "\tendpoint-id: %u\n", info->endpoint_id);
 | 
			
		||||
	fprintf(stdout, "\tname: %s\n", info->name);
 | 
			
		||||
	printf("\tid: %u\n", info->id);
 | 
			
		||||
	printf("\tendpoint-id: %u\n", info->endpoint_id);
 | 
			
		||||
	printf("\tname: %s\n", info->name);
 | 
			
		||||
	print_properties(info->props, MARK_CHANGE(1), true);
 | 
			
		||||
	print_params(info->params, info->n_params, MARK_CHANGE(2), true);
 | 
			
		||||
	info->change_mask = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -805,7 +805,7 @@ static void core_event_info(void *object, const struct pw_core_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d core %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d core %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_core_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -826,7 +826,7 @@ static void module_event_info(void *object, const struct pw_module_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d module %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d module %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_module_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -846,7 +846,7 @@ static void node_event_info(void *object, const struct pw_node_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d node %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d node %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_node_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -863,7 +863,7 @@ static void event_param(void *object, int seq, uint32_t id,
 | 
			
		|||
	struct remote_data *rd = data->rd;
 | 
			
		||||
 | 
			
		||||
	if (rd->data->interactive)
 | 
			
		||||
		fprintf(stdout, "remote %d object %d param %d index %d\n",
 | 
			
		||||
		printf("remote %d object %d param %d index %d\n",
 | 
			
		||||
				rd->id, data->global->id, id, index);
 | 
			
		||||
 | 
			
		||||
	spa_debug_pod(2, NULL, param);
 | 
			
		||||
| 
						 | 
				
			
			@ -881,7 +881,7 @@ static void port_event_info(void *object, const struct pw_port_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d port %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d port %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_port_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -902,7 +902,7 @@ static void factory_event_info(void *object, const struct pw_factory_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d factory %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d factory %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_factory_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -922,7 +922,7 @@ static void client_event_info(void *object, const struct pw_client_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d client %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d client %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_client_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -939,15 +939,15 @@ static void client_event_permissions(void *object, uint32_t index,
 | 
			
		|||
	struct remote_data *rd = data->rd;
 | 
			
		||||
	uint32_t i;
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "remote %d node %d index %d\n",
 | 
			
		||||
	printf("remote %d node %d index %d\n",
 | 
			
		||||
			rd->id, data->global->id, index);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < n_permissions; i++) {
 | 
			
		||||
		if (permissions[i].id == PW_ID_ANY)
 | 
			
		||||
			fprintf(stdout, "  default:");
 | 
			
		||||
			printf("  default:");
 | 
			
		||||
		else
 | 
			
		||||
			fprintf(stdout, "  %u:", permissions[i].id);
 | 
			
		||||
		fprintf(stdout, " "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			printf("  %u:", permissions[i].id);
 | 
			
		||||
		printf(" "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(permissions[i].permissions));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -963,7 +963,7 @@ static void link_event_info(void *object, const struct pw_link_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d link %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d link %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_link_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -984,7 +984,7 @@ static void device_event_info(void *object, const struct pw_device_info *info)
 | 
			
		|||
	struct proxy_data *pd = object;
 | 
			
		||||
	struct remote_data *rd = pd->rd;
 | 
			
		||||
	if (pd->info)
 | 
			
		||||
		fprintf(stdout, "remote %d device %d changed\n", rd->id, info->id);
 | 
			
		||||
		printf("remote %d device %d changed\n", rd->id, info->id);
 | 
			
		||||
	pd->info = pw_device_info_update(pd->info, info);
 | 
			
		||||
	if (pd->global == NULL)
 | 
			
		||||
		pd->global = pw_map_lookup(&rd->globals, info->id);
 | 
			
		||||
| 
						 | 
				
			
			@ -1431,7 +1431,7 @@ static bool do_create_device(struct data *data, const char *cmd, char *args, cha
 | 
			
		|||
	pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
 | 
			
		||||
 | 
			
		||||
	id = pw_map_insert_new(&data->vars, proxy);
 | 
			
		||||
	fprintf(stdout, "%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
 | 
			
		||||
	printf("%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1470,7 +1470,7 @@ static bool do_create_node(struct data *data, const char *cmd, char *args, char
 | 
			
		|||
        pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
 | 
			
		||||
 | 
			
		||||
	id = pw_map_insert_new(&data->vars, proxy);
 | 
			
		||||
	fprintf(stdout, "%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
 | 
			
		||||
	printf("%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1543,7 +1543,7 @@ static bool do_create_link(struct data *data, const char *cmd, char *args, char
 | 
			
		|||
        pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
 | 
			
		||||
 | 
			
		||||
	id = pw_map_insert_new(&data->vars, proxy);
 | 
			
		||||
	fprintf(stdout, "%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
 | 
			
		||||
	printf("%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1583,7 +1583,7 @@ static bool do_export_node(struct data *data, const char *cmd, char *args, char
 | 
			
		|||
	proxy = pw_core_export(rd->core, PW_TYPE_INTERFACE_Node, NULL, node, 0);
 | 
			
		||||
 | 
			
		||||
	id = pw_map_insert_new(&data->vars, proxy);
 | 
			
		||||
	fprintf(stdout, "%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
 | 
			
		||||
	printf("%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1736,7 +1736,7 @@ static bool do_permissions(struct data *data, const char *cmd, char *args, char
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	p = strtol(a[2], NULL, 0);
 | 
			
		||||
	fprintf(stderr, "setting permissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("setting permissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(p));
 | 
			
		||||
 | 
			
		||||
	permissions[0] = PW_PERMISSION_INIT(atoi(a[1]), p);
 | 
			
		||||
| 
						 | 
				
			
			@ -2131,7 +2131,7 @@ dump_properties(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	ind = INDENT(level + 2);
 | 
			
		||||
	spa_dict_for_each(item, props) {
 | 
			
		||||
		fprintf(stdout, "%s%s = \"%s\"",
 | 
			
		||||
		printf("%s%s = \"%s\"",
 | 
			
		||||
				ind, item->key, item->value);
 | 
			
		||||
 | 
			
		||||
		extra = NULL;
 | 
			
		||||
| 
						 | 
				
			
			@ -2154,9 +2154,9 @@ dump_properties(struct data *data, struct global *global,
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		if (extra)
 | 
			
		||||
			fprintf(stdout, " (\"%s\")", extra);
 | 
			
		||||
			printf(" (\"%s\")", extra);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2175,7 +2175,7 @@ dump_params(struct data *data, struct global *global,
 | 
			
		|||
	for (i = 0; i < n_params; i++) {
 | 
			
		||||
		const struct spa_type_info *type_info = spa_type_param;
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%s  %d (%s) %c%c\n", ind,
 | 
			
		||||
		printf("%s  %d (%s) %c%c\n", ind,
 | 
			
		||||
			params[i].id,
 | 
			
		||||
			spa_debug_type_find_name(type_info, params[i].id),
 | 
			
		||||
			params[i].flags & SPA_PARAM_INFO_READ ? 'r' : '-',
 | 
			
		||||
| 
						 | 
				
			
			@ -2192,16 +2192,16 @@ dump_global_common(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sid: %"PRIu32"\n", ind, global->id);
 | 
			
		||||
		fprintf(stdout, "%spermissions: "PW_PERMISSION_FORMAT"\n", ind,
 | 
			
		||||
		printf("%sid: %"PRIu32"\n", ind, global->id);
 | 
			
		||||
		printf("%spermissions: "PW_PERMISSION_FORMAT"\n", ind,
 | 
			
		||||
			PW_PERMISSION_ARGS(global->permissions));
 | 
			
		||||
		fprintf(stdout, "%stype: %s/%d\n", ind,
 | 
			
		||||
		printf("%stype: %s/%d\n", ind,
 | 
			
		||||
				global->type, global->version);
 | 
			
		||||
	} else {
 | 
			
		||||
		ind = INDENT(level);
 | 
			
		||||
		fprintf(stdout, "%s%"PRIu32":", ind, global->id);
 | 
			
		||||
		printf("%s%"PRIu32":", ind, global->id);
 | 
			
		||||
		if (!(flags & is_notype))
 | 
			
		||||
			fprintf(stdout, " %s", pw_interface_short(global->type));
 | 
			
		||||
			printf(" %s", pw_interface_short(global->type));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2221,17 +2221,17 @@ dump_core(struct data *data, struct global *global,
 | 
			
		|||
	info = pd->info;
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%scookie: %u\n", ind, info->cookie);
 | 
			
		||||
		fprintf(stdout, "%suser-name: \"%s\"\n", ind, info->user_name);
 | 
			
		||||
		fprintf(stdout, "%shost-name: \"%s\"\n", ind, info->host_name);
 | 
			
		||||
		fprintf(stdout, "%sversion: \"%s\"\n", ind, info->version);
 | 
			
		||||
		fprintf(stdout, "%sname: \"%s\"\n", ind, info->name);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%scookie: %u\n", ind, info->cookie);
 | 
			
		||||
		printf("%suser-name: \"%s\"\n", ind, info->user_name);
 | 
			
		||||
		printf("%shost-name: \"%s\"\n", ind, info->host_name);
 | 
			
		||||
		printf("%sversion: \"%s\"\n", ind, info->version);
 | 
			
		||||
		printf("%sname: \"%s\"\n", ind, info->name);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stdout, " u=\"%s\" h=\"%s\" v=\"%s\" n=\"%s\"",
 | 
			
		||||
		printf(" u=\"%s\" h=\"%s\" v=\"%s\" n=\"%s\"",
 | 
			
		||||
				info->user_name, info->host_name, info->version, info->name);
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			@ -2259,15 +2259,15 @@ dump_module(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sname: \"%s\"\n", ind, info->name);
 | 
			
		||||
		fprintf(stdout, "%sfilename: \"%s\"\n", ind, info->filename);
 | 
			
		||||
		fprintf(stdout, "%sargs: \"%s\"\n", ind, info->args);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sname: \"%s\"\n", ind, info->name);
 | 
			
		||||
		printf("%sfilename: \"%s\"\n", ind, info->filename);
 | 
			
		||||
		printf("%sargs: \"%s\"\n", ind, info->args);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		desc = spa_dict_lookup(info->props, PW_KEY_MODULE_DESCRIPTION);
 | 
			
		||||
		args = info->args && strcmp(info->args, "(null)") ? info->args : NULL;
 | 
			
		||||
		fprintf(stdout, " n=\"%s\" f=\"%s\"" "%s%s%s" "%s%s%s",
 | 
			
		||||
		printf(" n=\"%s\" f=\"%s\"" "%s%s%s" "%s%s%s",
 | 
			
		||||
				info->name, info->filename,
 | 
			
		||||
				args ? " a=\"" : "",
 | 
			
		||||
				args ? args : "",
 | 
			
		||||
| 
						 | 
				
			
			@ -2275,7 +2275,7 @@ dump_module(struct data *data, struct global *global,
 | 
			
		|||
				desc ? " d=\"" : "",
 | 
			
		||||
				desc ? desc : "",
 | 
			
		||||
				desc ? "\"" : "");
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!(flags & is_deep))
 | 
			
		||||
| 
						 | 
				
			
			@ -2284,7 +2284,7 @@ dump_module(struct data *data, struct global *global,
 | 
			
		|||
	factory_count = children_of(rd, global->id, PW_TYPE_INTERFACE_Factory, &factories);
 | 
			
		||||
	if (factory_count >= 0) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sfactories:\n", ind);
 | 
			
		||||
		printf("%sfactories:\n", ind);
 | 
			
		||||
		for (i = 0; i < factory_count; i++) {
 | 
			
		||||
			global_factory = obj_global(rd, factories[i]);
 | 
			
		||||
			if (!global_factory)
 | 
			
		||||
| 
						 | 
				
			
			@ -2320,9 +2320,9 @@ dump_device(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
		fprintf(stdout, "%sparams:\n", ind);
 | 
			
		||||
		printf("%sparams:\n", ind);
 | 
			
		||||
		dump_params(data, global, info->params, info->n_params, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		media_class = spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS);
 | 
			
		||||
| 
						 | 
				
			
			@ -2330,7 +2330,7 @@ dump_device(struct data *data, struct global *global,
 | 
			
		|||
		desc = spa_dict_lookup(info->props, PW_KEY_DEVICE_DESCRIPTION);
 | 
			
		||||
		api = spa_dict_lookup(info->props, PW_KEY_DEVICE_API);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%s%s%s" "%s%s%s" "%s%s%s" "%s%s%s",
 | 
			
		||||
		printf("%s%s%s" "%s%s%s" "%s%s%s" "%s%s%s",
 | 
			
		||||
				media_class ? " c=\"" : "",
 | 
			
		||||
				media_class ? media_class : "",
 | 
			
		||||
				media_class ? "\"" : "",
 | 
			
		||||
| 
						 | 
				
			
			@ -2350,7 +2350,7 @@ dump_device(struct data *data, struct global *global,
 | 
			
		|||
			alsa_path = spa_dict_lookup(info->props, SPA_KEY_API_ALSA_PATH);
 | 
			
		||||
			alsa_card_id = spa_dict_lookup(info->props, SPA_KEY_API_ALSA_CARD_ID);
 | 
			
		||||
 | 
			
		||||
			fprintf(stdout, "%s%s%s" "%s%s%s",
 | 
			
		||||
			printf("%s%s%s" "%s%s%s",
 | 
			
		||||
					alsa_path ? " p=\"" : "",
 | 
			
		||||
					alsa_path ? alsa_path : "",
 | 
			
		||||
					alsa_path ? "\"" : "",
 | 
			
		||||
| 
						 | 
				
			
			@ -2359,7 +2359,7 @@ dump_device(struct data *data, struct global *global,
 | 
			
		|||
					alsa_card_id ? "\"" : "");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!(flags & is_deep))
 | 
			
		||||
| 
						 | 
				
			
			@ -2368,7 +2368,7 @@ dump_device(struct data *data, struct global *global,
 | 
			
		|||
	node_count = children_of(rd, global->id, PW_TYPE_INTERFACE_Node, &nodes);
 | 
			
		||||
	if (node_count >= 0) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%snodes:\n", ind);
 | 
			
		||||
		printf("%snodes:\n", ind);
 | 
			
		||||
		for (i = 0; i < node_count; i++) {
 | 
			
		||||
			global_node = obj_global(rd, nodes[i]);
 | 
			
		||||
			if (!global_node)
 | 
			
		||||
| 
						 | 
				
			
			@ -2403,31 +2403,31 @@ dump_node(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sinput ports: %u/%u\n", ind, info->n_input_ports, info->max_input_ports);
 | 
			
		||||
		fprintf(stdout, "%soutput ports: %u/%u\n", ind, info->n_output_ports, info->max_output_ports);
 | 
			
		||||
		fprintf(stdout, "%sstate: \"%s\"", ind, pw_node_state_as_string(info->state));
 | 
			
		||||
		printf("%sinput ports: %u/%u\n", ind, info->n_input_ports, info->max_input_ports);
 | 
			
		||||
		printf("%soutput ports: %u/%u\n", ind, info->n_output_ports, info->max_output_ports);
 | 
			
		||||
		printf("%sstate: \"%s\"", ind, pw_node_state_as_string(info->state));
 | 
			
		||||
		if (info->state == PW_NODE_STATE_ERROR && info->error)
 | 
			
		||||
			fprintf(stdout, " \"%s\"\n", info->error);
 | 
			
		||||
			printf(" \"%s\"\n", info->error);
 | 
			
		||||
		else
 | 
			
		||||
			fprintf(stdout, "\n");
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
			printf("\n");
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
		fprintf(stdout, "%sparams:\n", ind);
 | 
			
		||||
		printf("%sparams:\n", ind);
 | 
			
		||||
		dump_params(data, global, info->params, info->n_params, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		name = spa_dict_lookup(info->props, PW_KEY_NODE_NAME);
 | 
			
		||||
		path = spa_dict_lookup(info->props, SPA_KEY_OBJECT_PATH);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, " s=\"%s\"", pw_node_state_as_string(info->state));
 | 
			
		||||
		printf(" s=\"%s\"", pw_node_state_as_string(info->state));
 | 
			
		||||
 | 
			
		||||
		if (info->max_input_ports) {
 | 
			
		||||
			fprintf(stdout, " i=%u/%u", info->n_input_ports, info->max_input_ports);
 | 
			
		||||
			printf(" i=%u/%u", info->n_input_ports, info->max_input_ports);
 | 
			
		||||
		}
 | 
			
		||||
		if (info->max_output_ports) {
 | 
			
		||||
			fprintf(stdout, " o=%u/%u", info->n_output_ports, info->max_output_ports);
 | 
			
		||||
			printf(" o=%u/%u", info->n_output_ports, info->max_output_ports);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%s%s%s" "%s%s%s",
 | 
			
		||||
		printf("%s%s%s" "%s%s%s",
 | 
			
		||||
				name ? " n=\"" : "",
 | 
			
		||||
				name ? name : "",
 | 
			
		||||
				name ? "\"" : "",
 | 
			
		||||
| 
						 | 
				
			
			@ -2435,7 +2435,7 @@ dump_node(struct data *data, struct global *global,
 | 
			
		|||
				path ? path : "",
 | 
			
		||||
				path ? "\"" : "");
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!(flags & is_deep))
 | 
			
		||||
| 
						 | 
				
			
			@ -2444,7 +2444,7 @@ dump_node(struct data *data, struct global *global,
 | 
			
		|||
	port_count = children_of(rd, global->id, PW_TYPE_INTERFACE_Port, &ports);
 | 
			
		||||
	if (port_count >= 0) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sports:\n", ind);
 | 
			
		||||
		printf("%sports:\n", ind);
 | 
			
		||||
		for (i = 0; i < port_count; i++) {
 | 
			
		||||
			global_port = obj_global(rd, ports[i]);
 | 
			
		||||
			if (!global_port)
 | 
			
		||||
| 
						 | 
				
			
			@ -2475,19 +2475,19 @@ dump_port(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sdirection: \"%s\"\n", ind,
 | 
			
		||||
		printf("%sdirection: \"%s\"\n", ind,
 | 
			
		||||
				pw_direction_as_string(info->direction));
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
		fprintf(stdout, "%sparams:\n", ind);
 | 
			
		||||
		printf("%sparams:\n", ind);
 | 
			
		||||
		dump_params(data, global, info->params, info->n_params, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stdout, " d=\"%s\"", pw_direction_as_string(info->direction));
 | 
			
		||||
		printf(" d=\"%s\"", pw_direction_as_string(info->direction));
 | 
			
		||||
 | 
			
		||||
		name = spa_dict_lookup(info->props, PW_KEY_PORT_NAME);
 | 
			
		||||
		format = spa_dict_lookup(info->props, PW_KEY_FORMAT_DSP);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%s%s%s" "%s%s%s",
 | 
			
		||||
		printf("%s%s%s" "%s%s%s",
 | 
			
		||||
				name ? " n=\"" : "",
 | 
			
		||||
				name ? name : "",
 | 
			
		||||
				name ? "\"" : "",
 | 
			
		||||
| 
						 | 
				
			
			@ -2495,7 +2495,7 @@ dump_port(struct data *data, struct global *global,
 | 
			
		|||
				format ? format : "",
 | 
			
		||||
				format ? "\"" : "");
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	(void)rd;
 | 
			
		||||
| 
						 | 
				
			
			@ -2522,21 +2522,21 @@ dump_factory(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sname: \"%s\"\n", ind, info->name);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sname: \"%s\"\n", ind, info->name);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stdout, " n=\"%s\"", info->name);
 | 
			
		||||
		printf(" n=\"%s\"", info->name);
 | 
			
		||||
 | 
			
		||||
		module_id = spa_dict_lookup(info->props, PW_KEY_MODULE_ID);
 | 
			
		||||
		module_name = module_id ? obj_lookup(rd, atoi(module_id), PW_KEY_MODULE_NAME) : NULL;
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%s%s%s",
 | 
			
		||||
		printf("%s%s%s",
 | 
			
		||||
				module_name ? " m=\"" : "",
 | 
			
		||||
				module_name ? module_name : "",
 | 
			
		||||
				module_name ? "\"" : "");
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
| 
						 | 
				
			
			@ -2561,13 +2561,13 @@ dump_client(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		app_name = spa_dict_lookup(info->props, PW_KEY_APP_NAME);
 | 
			
		||||
		app_pid = spa_dict_lookup(info->props, PW_KEY_APP_PROCESS_ID);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%s%s%s" "%s%s%s",
 | 
			
		||||
		printf("%s%s%s" "%s%s%s",
 | 
			
		||||
				app_name ? " ap=\"" : "",
 | 
			
		||||
				app_name ? app_name : "",
 | 
			
		||||
				app_name ? "\"" : "",
 | 
			
		||||
| 
						 | 
				
			
			@ -2575,7 +2575,7 @@ dump_client(struct data *data, struct global *global,
 | 
			
		|||
				app_pid ? app_pid : "",
 | 
			
		||||
				app_pid ? "\"" : "");
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	(void)rd;
 | 
			
		||||
| 
						 | 
				
			
			@ -2603,24 +2603,24 @@ dump_link(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%soutput-node-id: %u\n", ind, info->output_node_id);
 | 
			
		||||
		fprintf(stdout, "%soutput-port-id: %u\n", ind, info->output_port_id);
 | 
			
		||||
		fprintf(stdout, "%sinput-node-id: %u\n", ind, info->input_node_id);
 | 
			
		||||
		fprintf(stdout, "%sinput-port-id: %u\n", ind, info->input_port_id);
 | 
			
		||||
		printf("%soutput-node-id: %u\n", ind, info->output_node_id);
 | 
			
		||||
		printf("%soutput-port-id: %u\n", ind, info->output_port_id);
 | 
			
		||||
		printf("%sinput-node-id: %u\n", ind, info->input_node_id);
 | 
			
		||||
		printf("%sinput-port-id: %u\n", ind, info->input_port_id);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%sstate: \"%s\"", ind,
 | 
			
		||||
		printf("%sstate: \"%s\"", ind,
 | 
			
		||||
				pw_link_state_as_string(info->state));
 | 
			
		||||
		if (info->state == PW_LINK_STATE_ERROR && info->error)
 | 
			
		||||
			printf(" \"%s\"\n", info->error);
 | 
			
		||||
		else
 | 
			
		||||
			printf("\n");
 | 
			
		||||
		fprintf(stdout, "%sformat:\n", ind);
 | 
			
		||||
		printf("%sformat:\n", ind);
 | 
			
		||||
		if (info->format)
 | 
			
		||||
			spa_debug_pod(8 * (level + 1) + 2, NULL, info->format);
 | 
			
		||||
		else
 | 
			
		||||
			fprintf(stdout, "%s\tnone\n", ind);
 | 
			
		||||
			printf("%s\tnone\n", ind);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		out_node_name = obj_lookup(rd, info->output_node_id, PW_KEY_NODE_NAME);
 | 
			
		||||
| 
						 | 
				
			
			@ -2628,16 +2628,16 @@ dump_link(struct data *data, struct global *global,
 | 
			
		|||
		out_port_name = obj_lookup(rd, info->output_port_id, PW_KEY_PORT_NAME);
 | 
			
		||||
		in_port_name = obj_lookup(rd, info->input_port_id, PW_KEY_PORT_NAME);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, " s=\"%s\"", pw_link_state_as_string(info->state));
 | 
			
		||||
		printf(" s=\"%s\"", pw_link_state_as_string(info->state));
 | 
			
		||||
 | 
			
		||||
		if (out_node_name && out_port_name)
 | 
			
		||||
			fprintf(stdout, " on=\"%s\"" " op=\"%s\"",
 | 
			
		||||
			printf(" on=\"%s\"" " op=\"%s\"",
 | 
			
		||||
					out_node_name, out_port_name);
 | 
			
		||||
		if (in_node_name && in_port_name)
 | 
			
		||||
			fprintf(stdout, " in=\"%s\"" " ip=\"%s\"",
 | 
			
		||||
			printf(" in=\"%s\"" " ip=\"%s\"",
 | 
			
		||||
					in_node_name, in_port_name);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	(void)rd;
 | 
			
		||||
| 
						 | 
				
			
			@ -2663,12 +2663,12 @@ dump_session(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
		fprintf(stdout, "%sparams:\n", ind);
 | 
			
		||||
		printf("%sparams:\n", ind);
 | 
			
		||||
		dump_params(data, global, info->params, info->n_params, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	(void)rd;
 | 
			
		||||
| 
						 | 
				
			
			@ -2707,21 +2707,21 @@ dump_endpoint(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sname: %s\n", ind, info->name);
 | 
			
		||||
		fprintf(stdout, "%smedia-class: %s\n", ind, info->media_class);
 | 
			
		||||
		fprintf(stdout, "%sdirection: %s\n", ind, direction);
 | 
			
		||||
		fprintf(stdout, "%sflags: 0x%x\n", ind, info->flags);
 | 
			
		||||
		fprintf(stdout, "%sstreams: %u\n", ind, info->n_streams);
 | 
			
		||||
		fprintf(stdout, "%ssession: %u\n", ind, info->session_id);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sname: %s\n", ind, info->name);
 | 
			
		||||
		printf("%smedia-class: %s\n", ind, info->media_class);
 | 
			
		||||
		printf("%sdirection: %s\n", ind, direction);
 | 
			
		||||
		printf("%sflags: 0x%x\n", ind, info->flags);
 | 
			
		||||
		printf("%sstreams: %u\n", ind, info->n_streams);
 | 
			
		||||
		printf("%ssession: %u\n", ind, info->session_id);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
		fprintf(stdout, "%sparams:\n", ind);
 | 
			
		||||
		printf("%sparams:\n", ind);
 | 
			
		||||
		dump_params(data, global, info->params, info->n_params, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stdout, " n=\"%s\" c=\"%s\" d=\"%s\" s=%u si=%"PRIu32"",
 | 
			
		||||
		printf(" n=\"%s\" c=\"%s\" d=\"%s\" s=%u si=%"PRIu32"",
 | 
			
		||||
				info->name, info->media_class, direction,
 | 
			
		||||
				info->n_streams, info->session_id);
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	(void)rd;
 | 
			
		||||
| 
						 | 
				
			
			@ -2747,17 +2747,17 @@ dump_endpoint_stream(struct data *data, struct global *global,
 | 
			
		|||
 | 
			
		||||
	if (!(flags & is_short)) {
 | 
			
		||||
		ind = INDENT(level + 1);
 | 
			
		||||
		fprintf(stdout, "%sid: %u\n", ind, info->id);
 | 
			
		||||
		fprintf(stdout, "%sendpoint-id: %u\n", ind, info->endpoint_id);
 | 
			
		||||
		fprintf(stdout, "%sname: %s\n", ind, info->name);
 | 
			
		||||
		fprintf(stdout, "%sproperties:\n", ind);
 | 
			
		||||
		printf("%sid: %u\n", ind, info->id);
 | 
			
		||||
		printf("%sendpoint-id: %u\n", ind, info->endpoint_id);
 | 
			
		||||
		printf("%sname: %s\n", ind, info->name);
 | 
			
		||||
		printf("%sproperties:\n", ind);
 | 
			
		||||
		dump_properties(data, global, flags, level);
 | 
			
		||||
		fprintf(stdout, "%sparams:\n", ind);
 | 
			
		||||
		printf("%sparams:\n", ind);
 | 
			
		||||
		dump_params(data, global, info->params, info->n_params, flags, level);
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stdout, " n=\"%s\" i=%"PRIu32" ei=%"PRIu32"",
 | 
			
		||||
		printf(" n=\"%s\" i=%"PRIu32" ei=%"PRIu32"",
 | 
			
		||||
				info->name, info->id, info->endpoint_id);
 | 
			
		||||
		fprintf(stdout, "\n");
 | 
			
		||||
		printf("\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	(void)rd;
 | 
			
		||||
| 
						 | 
				
			
			@ -2964,7 +2964,7 @@ static void readline_process_line(char *line)
 | 
			
		|||
	if (line[0] != '\0') {
 | 
			
		||||
		add_history(line);
 | 
			
		||||
		if (!parse(d, line, &error)) {
 | 
			
		||||
			fprintf(stdout, "Error: \"%s\"\n", error);
 | 
			
		||||
			fprintf(stderr, "Error: \"%s\"\n", error);
 | 
			
		||||
			free(error);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -3045,9 +3045,9 @@ static void do_quit_on_signal(void *data, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(d->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(struct data *data, const char *name)
 | 
			
		||||
static void show_help(struct data *data, const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, _("%s [options] [command]\n"
 | 
			
		||||
	fprintf(error ? stderr : stdout, _("%s [options] [command]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -d, --daemon                          Start as daemon (Default false)\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -3074,15 +3074,17 @@ int main(int argc, char *argv[])
 | 
			
		|||
	};
 | 
			
		||||
	int c, i;
 | 
			
		||||
 | 
			
		||||
	setlinebuf(stdout);
 | 
			
		||||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVdr:", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -3096,7 +3098,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			opt_remote = optarg;
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -3133,7 +3135,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
	if (optind == argc) {
 | 
			
		||||
		data.interactive = true;
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "Welcome to PipeWire version %s. Type 'help' for usage.\n",
 | 
			
		||||
		printf("Welcome to PipeWire version %s. Type 'help' for usage.\n",
 | 
			
		||||
				pw_get_library_version());
 | 
			
		||||
 | 
			
		||||
		readline_init();
 | 
			
		||||
| 
						 | 
				
			
			@ -3155,7 +3157,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
		pw_main_loop_run(data.loop);
 | 
			
		||||
 | 
			
		||||
		if (!parse(&data, buf, &error)) {
 | 
			
		||||
			fprintf(stdout, "Error: \"%s\"\n", error);
 | 
			
		||||
			fprintf(stderr, "Error: \"%s\"\n", error);
 | 
			
		||||
			free(error);
 | 
			
		||||
		}
 | 
			
		||||
		if (!data.quit && data.current) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -760,9 +760,9 @@ static void do_quit(void *data, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(d->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(const char *name)
 | 
			
		||||
static void show_help(const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -a, --all                             Show all object types\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -801,10 +801,10 @@ int main(int argc, char *argv[])
 | 
			
		|||
	while ((c = getopt_long(argc, argv, "hVasdr:o:L9", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h' :
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V' :
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -840,7 +840,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			fprintf(stderr, "orthogonal edges enabled\n");
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1458,9 +1458,9 @@ static void do_quit(void *data, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(d->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(struct data *data, const char *name)
 | 
			
		||||
static void show_help(struct data *data, const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options] [<id>]\n"
 | 
			
		||||
	fprintf(error ? stderr : stdout, "%s [options] [<id>]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -r, --remote                          Remote daemon name\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -1492,14 +1492,15 @@ int main(int argc, char *argv[])
 | 
			
		|||
	data.out = stdout;
 | 
			
		||||
	if (isatty(fileno(data.out)) && getenv("NO_COLOR") == NULL)
 | 
			
		||||
		colors = true;
 | 
			
		||||
	setlinebuf(data.out);
 | 
			
		||||
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVr:mNC", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h' :
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V' :
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -1524,12 +1525,13 @@ int main(int argc, char *argv[])
 | 
			
		|||
			else if (!strcmp(optarg, "always"))
 | 
			
		||||
				colors = true;
 | 
			
		||||
			else {
 | 
			
		||||
				show_help(&data, argv[0]);
 | 
			
		||||
				fprintf(stderr, "Unknown color: %s\n", optarg);
 | 
			
		||||
				show_help(&data, argv[0], true);
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -179,15 +179,15 @@ static void print_port(struct data *data, const char *prefix, struct object *n,
 | 
			
		|||
		prefix2 = "     ";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "%s%s%s%s\n", data->prefix, prefix,
 | 
			
		||||
	printf("%s%s%s%s\n", data->prefix, prefix,
 | 
			
		||||
			id, port_name(buffer, sizeof(buffer), n, p));
 | 
			
		||||
	if (verbose) {
 | 
			
		||||
		port_path(buffer, sizeof(buffer), n, p);
 | 
			
		||||
		if (buffer[0] != '\0')
 | 
			
		||||
			fprintf(stdout, "%s  %s%s%s\n", data->prefix, prefix2, prefix, buffer);
 | 
			
		||||
			printf("%s  %s%s%s\n", data->prefix, prefix2, prefix, buffer);
 | 
			
		||||
		port_alias(buffer, sizeof(buffer), n, p);
 | 
			
		||||
		if (buffer[0] != '\0')
 | 
			
		||||
			fprintf(stdout, "%s  %s%s%s\n", data->prefix, prefix2, prefix, buffer);
 | 
			
		||||
			printf("%s  %s%s%s\n", data->prefix, prefix2, prefix, buffer);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -426,7 +426,7 @@ static int do_monitor_link(struct data *data, struct object *link)
 | 
			
		|||
	if (data->opt_id)
 | 
			
		||||
		snprintf(id, sizeof(id), "%4d ", link->id);
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "%s%s%s -> %s\n", data->prefix, id,
 | 
			
		||||
	printf("%s%s%s -> %s\n", data->prefix, id,
 | 
			
		||||
			port_name(buffer1, sizeof(buffer1), n1, p1),
 | 
			
		||||
			port_name(buffer2, sizeof(buffer2), n2, p2));
 | 
			
		||||
	return 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -552,9 +552,9 @@ static void do_quit(void *userdata, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(data->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(struct data *data, const char *name)
 | 
			
		||||
static void show_help(struct data *data, const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%1$s : PipeWire port and link manager.\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%1$s : PipeWire port and link manager.\n"
 | 
			
		||||
		"Generic: %1$s [options]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -602,6 +602,8 @@ int main(int argc, char *argv[])
 | 
			
		|||
	pw_init(&argc, &argv);
 | 
			
		||||
	spa_list_init(&data.objects);
 | 
			
		||||
 | 
			
		||||
	setlinebuf(stdout);
 | 
			
		||||
 | 
			
		||||
	data.props = pw_properties_new(NULL, NULL);
 | 
			
		||||
	if (data.props == NULL) {
 | 
			
		||||
		fprintf(stderr, "can't create properties: %m\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -611,10 +613,10 @@ int main(int argc, char *argv[])
 | 
			
		|||
	while ((c = getopt_long(argc, argv, "hVr:oilmIvLPp:d", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], NULL);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -655,12 +657,12 @@ int main(int argc, char *argv[])
 | 
			
		|||
			data.opt_mode |= MODE_DISCONNECT;
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (argc == 1)
 | 
			
		||||
		show_help(&data, argv[0]);
 | 
			
		||||
		show_help(&data, argv[0], true);
 | 
			
		||||
 | 
			
		||||
	if (data.opt_id && (data.opt_mode & MODE_LIST) == 0) {
 | 
			
		||||
		fprintf(stderr, "-I option needs one or more of -l, -i or -o\n");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -80,9 +80,9 @@ static const struct pw_impl_module_events module_events = {
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void show_help(struct data *data, const char *name)
 | 
			
		||||
static void show_help(struct data *data, const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -r, --remote                          Remote daemon name\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -142,10 +142,10 @@ int main(int argc, char *argv[])
 | 
			
		|||
	while ((c = getopt_long(argc, argv, "hVr:g:c:m:l:C:P:i:o:", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -180,7 +180,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			pw_properties_update_string(data.playback_props, optarg, strlen(optarg));
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,11 +70,11 @@ static int metadata_property(void *data, uint32_t id,
 | 
			
		|||
	if ((d->opt_id == SPA_ID_INVALID || d->opt_id == id) &&
 | 
			
		||||
	    (d->opt_key == NULL || spa_streq(d->opt_key, key))) {
 | 
			
		||||
		if (key == NULL) {
 | 
			
		||||
			fprintf(stdout, "remove: id:%u all keys\n", id);
 | 
			
		||||
			printf("remove: id:%u all keys\n", id);
 | 
			
		||||
		} else if (value == NULL) {
 | 
			
		||||
			fprintf(stdout, "remove: id:%u key:'%s'\n", id, key);
 | 
			
		||||
			printf("remove: id:%u key:'%s'\n", id, key);
 | 
			
		||||
		} else {
 | 
			
		||||
			fprintf(stdout, "update: id:%u key:'%s' value:'%s' type:'%s'\n", id, key, value, type);
 | 
			
		||||
			printf("update: id:%u key:'%s' value:'%s' type:'%s'\n", id, key, value, type);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -106,23 +106,23 @@ static void registry_event_global(void *data, uint32_t id, uint32_t permissions,
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fprintf(stdout, "Found \"%s\" metadata %d\n", d->opt_name, id);
 | 
			
		||||
	printf("Found \"%s\" metadata %d\n", d->opt_name, id);
 | 
			
		||||
	d->metadata = pw_registry_bind(d->registry,
 | 
			
		||||
			id, type, PW_VERSION_METADATA, 0);
 | 
			
		||||
 | 
			
		||||
	if (d->opt_delete) {
 | 
			
		||||
		if (d->opt_id != SPA_ID_INVALID) {
 | 
			
		||||
			if (d->opt_key != NULL)
 | 
			
		||||
				fprintf(stdout, "delete property: id:%u key:%s\n", d->opt_id, d->opt_key);
 | 
			
		||||
				printf("delete property: id:%u key:%s\n", d->opt_id, d->opt_key);
 | 
			
		||||
			else
 | 
			
		||||
				fprintf(stdout, "delete properties: id:%u\n", d->opt_id);
 | 
			
		||||
				printf("delete properties: id:%u\n", d->opt_id);
 | 
			
		||||
			pw_metadata_set_property(d->metadata, d->opt_id, d->opt_key, NULL, NULL);
 | 
			
		||||
		} else {
 | 
			
		||||
			fprintf(stdout, "delete all properties\n");
 | 
			
		||||
			printf("delete all properties\n");
 | 
			
		||||
			pw_metadata_clear(d->metadata);
 | 
			
		||||
		}
 | 
			
		||||
	} else if (d->opt_id != SPA_ID_INVALID && d->opt_key != NULL && d->opt_value != NULL) {
 | 
			
		||||
		fprintf(stdout, "set property: id:%u key:%s value:%s type:%s\n",
 | 
			
		||||
		printf("set property: id:%u key:%s value:%s type:%s\n",
 | 
			
		||||
				d->opt_id, d->opt_key, d->opt_value, d->opt_type);
 | 
			
		||||
		pw_metadata_set_property(d->metadata, d->opt_id, d->opt_key, d->opt_type, d->opt_value);
 | 
			
		||||
	} else {
 | 
			
		||||
| 
						 | 
				
			
			@ -170,9 +170,9 @@ static void do_quit(void *userdata, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(data->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(struct data *data, const char *name)
 | 
			
		||||
static void show_help(struct data *data, const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options] [ id [ key [ value [ type ] ] ] ]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options] [ id [ key [ value [ type ] ] ] ]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -r, --remote                          Remote daemon name\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -196,6 +196,8 @@ int main(int argc, char *argv[])
 | 
			
		|||
		{ NULL,	0, NULL, 0}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	setlinebuf(stdout);
 | 
			
		||||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	data.opt_name = "default";
 | 
			
		||||
| 
						 | 
				
			
			@ -203,10 +205,10 @@ int main(int argc, char *argv[])
 | 
			
		|||
	while ((c = getopt_long(argc, argv, "hVr:mdn:", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -226,7 +228,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			data.opt_name = optarg;
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(&data, argv[0]);
 | 
			
		||||
			show_help(&data, argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -113,7 +113,7 @@ static void on_process(void *userdata, struct spa_io_position *position)
 | 
			
		|||
		ev.data = SPA_POD_BODY(&c->value),
 | 
			
		||||
		ev.size = SPA_POD_BODY_SIZE(&c->value);
 | 
			
		||||
 | 
			
		||||
		fprintf(stdout, "%4d: ", c->offset);
 | 
			
		||||
		printf("%4d: ", c->offset);
 | 
			
		||||
		midi_file_dump_event(stdout, &ev);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -175,9 +175,9 @@ static int dump_filter(struct data *data)
 | 
			
		|||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(const char *name)
 | 
			
		||||
static void show_help(const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options] [FILE]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options] [FILE]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -r, --remote                          Remote daemon name\n",
 | 
			
		||||
| 
						 | 
				
			
			@ -197,13 +197,15 @@ int main(int argc, char *argv[])
 | 
			
		|||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	setlinebuf(stdout);
 | 
			
		||||
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVr:", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -214,7 +216,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			data.opt_remote = optarg;
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -48,10 +48,10 @@ static struct pprefix {
 | 
			
		|||
	{ .prefix = "*", .suffix = "" },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#define with_prefix(use_prefix_, stream_) \
 | 
			
		||||
   for (bool once_ = !!fprintf(stream_, "%s", (pprefix[!!(use_prefix_)]).prefix); \
 | 
			
		||||
#define with_prefix(use_prefix_) \
 | 
			
		||||
   for (bool once_ = !!printf("%s", (pprefix[!!(use_prefix_)]).prefix); \
 | 
			
		||||
	once_; \
 | 
			
		||||
	once_ = false, fprintf(stream_, "%s", (pprefix[!!(use_prefix_)]).suffix))
 | 
			
		||||
	once_ = false, printf("%s", (pprefix[!!(use_prefix_)]).suffix))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
struct param {
 | 
			
		||||
| 
						 | 
				
			
			@ -175,13 +175,13 @@ static void print_params(struct proxy_data *data, bool use_prefix)
 | 
			
		|||
{
 | 
			
		||||
	struct param *p;
 | 
			
		||||
 | 
			
		||||
	with_prefix(use_prefix, stderr) {
 | 
			
		||||
		fprintf(stderr, "\tparams:\n");
 | 
			
		||||
	with_prefix(use_prefix) {
 | 
			
		||||
		printf("\tparams:\n");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(p, &data->param_list, link) {
 | 
			
		||||
		with_prefix(p->changed, stderr) {
 | 
			
		||||
			fprintf(stderr, "\t  id:%u (%s)\n",
 | 
			
		||||
		with_prefix(p->changed) {
 | 
			
		||||
			printf("\t  id:%u (%s)\n",
 | 
			
		||||
				p->id,
 | 
			
		||||
				spa_debug_type_find_name(spa_type_param, p->id));
 | 
			
		||||
			if (spa_pod_is_object_type(p->param, SPA_TYPE_OBJECT_Format))
 | 
			
		||||
| 
						 | 
				
			
			@ -197,20 +197,20 @@ static void print_properties(const struct spa_dict *props, bool use_prefix)
 | 
			
		|||
{
 | 
			
		||||
	const struct spa_dict_item *item;
 | 
			
		||||
 | 
			
		||||
	with_prefix(use_prefix, stderr) {
 | 
			
		||||
		fprintf(stderr, "\tproperties:\n");
 | 
			
		||||
	with_prefix(use_prefix) {
 | 
			
		||||
		printf("\tproperties:\n");
 | 
			
		||||
		if (props == NULL || props->n_items == 0) {
 | 
			
		||||
			fprintf(stderr, "\t\tnone\n");
 | 
			
		||||
			printf("\t\tnone\n");
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	spa_dict_for_each(item, props) {
 | 
			
		||||
		with_prefix(use_prefix, stderr) {
 | 
			
		||||
		with_prefix(use_prefix) {
 | 
			
		||||
			if (item->value)
 | 
			
		||||
				fprintf(stderr, "\t\t%s = \"%s\"\n", item->key, item->value);
 | 
			
		||||
				printf("\t\t%s = \"%s\"\n", item->key, item->value);
 | 
			
		||||
			else
 | 
			
		||||
				fprintf(stderr, "\t\t%s = (null)\n", item->key);
 | 
			
		||||
				printf("\t\t%s = (null)\n", item->key);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -221,12 +221,12 @@ static void on_core_info(void *data, const struct pw_core_info *info)
 | 
			
		|||
{
 | 
			
		||||
	bool print_all = true, print_mark = true;
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\ttype: %s\n", PW_TYPE_INTERFACE_Core);
 | 
			
		||||
	fprintf(stderr, "\tcookie: %u\n", info->cookie);
 | 
			
		||||
	fprintf(stderr, "\tuser-name: \"%s\"\n", info->user_name);
 | 
			
		||||
	fprintf(stderr, "\thost-name: \"%s\"\n", info->host_name);
 | 
			
		||||
	fprintf(stderr, "\tversion: \"%s\"\n", info->version);
 | 
			
		||||
	fprintf(stderr, "\tname: \"%s\"\n", info->name);
 | 
			
		||||
	printf("\ttype: %s\n", PW_TYPE_INTERFACE_Core);
 | 
			
		||||
	printf("\tcookie: %u\n", info->cookie);
 | 
			
		||||
	printf("\tuser-name: \"%s\"\n", info->user_name);
 | 
			
		||||
	printf("\thost-name: \"%s\"\n", info->host_name);
 | 
			
		||||
	printf("\tversion: \"%s\"\n", info->version);
 | 
			
		||||
	printf("\tname: \"%s\"\n", info->name);
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		print_properties(info->props, MARK_CHANGE(PW_CORE_CHANGE_MASK_PROPS));
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -239,23 +239,23 @@ static void module_event_info(void *object, const struct pw_module_info *info)
 | 
			
		|||
 | 
			
		||||
	print_all = true;
 | 
			
		||||
        if (data->info == NULL) {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		print_mark = false;
 | 
			
		||||
	}
 | 
			
		||||
        else {
 | 
			
		||||
		fprintf(stderr, "changed:\n");
 | 
			
		||||
		printf("changed:\n");
 | 
			
		||||
		print_mark = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	info = data->info = pw_module_info_update(data->info, info);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tid: %d\n", data->id);
 | 
			
		||||
	fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", data->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(data->permissions));
 | 
			
		||||
	fprintf(stderr, "\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	fprintf(stderr, "\tname: \"%s\"\n", info->name);
 | 
			
		||||
	fprintf(stderr, "\tfilename: \"%s\"\n", info->filename);
 | 
			
		||||
	fprintf(stderr, "\targs: \"%s\"\n", info->args);
 | 
			
		||||
	printf("\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	printf("\tname: \"%s\"\n", info->name);
 | 
			
		||||
	printf("\tfilename: \"%s\"\n", info->filename);
 | 
			
		||||
	printf("\targs: \"%s\"\n", info->args);
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		print_properties(info->props, MARK_CHANGE(PW_MODULE_CHANGE_MASK_PROPS));
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -273,37 +273,37 @@ static void print_node(struct proxy_data *data)
 | 
			
		|||
 | 
			
		||||
	print_all = true;
 | 
			
		||||
        if (data->first) {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		print_mark = false;
 | 
			
		||||
		data->first = false;
 | 
			
		||||
	}
 | 
			
		||||
        else {
 | 
			
		||||
		fprintf(stderr, "changed:\n");
 | 
			
		||||
		printf("changed:\n");
 | 
			
		||||
		print_mark = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tid: %d\n", data->id);
 | 
			
		||||
	fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", data->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(data->permissions));
 | 
			
		||||
	fprintf(stderr, "\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	printf("\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		print_params(data, MARK_CHANGE(PW_NODE_CHANGE_MASK_PARAMS));
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_NODE_CHANGE_MASK_INPUT_PORTS), stderr) {
 | 
			
		||||
			fprintf(stderr, "\tinput ports: %u/%u\n",
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_NODE_CHANGE_MASK_INPUT_PORTS)) {
 | 
			
		||||
			printf("\tinput ports: %u/%u\n",
 | 
			
		||||
				info->n_input_ports, info->max_input_ports);
 | 
			
		||||
		}
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_NODE_CHANGE_MASK_OUTPUT_PORTS), stderr) {
 | 
			
		||||
			fprintf(stderr, "\toutput ports: %u/%u\n",
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_NODE_CHANGE_MASK_OUTPUT_PORTS)) {
 | 
			
		||||
			printf("\toutput ports: %u/%u\n",
 | 
			
		||||
				info->n_output_ports, info->max_output_ports);
 | 
			
		||||
		}
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_NODE_CHANGE_MASK_STATE), stderr) {
 | 
			
		||||
			fprintf(stderr, "\tstate: \"%s\"",
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_NODE_CHANGE_MASK_STATE)) {
 | 
			
		||||
			printf("\tstate: \"%s\"",
 | 
			
		||||
				pw_node_state_as_string(info->state));
 | 
			
		||||
		}
 | 
			
		||||
		if (info->state == PW_NODE_STATE_ERROR && info->error)
 | 
			
		||||
			fprintf(stderr, " \"%s\"\n", info->error);
 | 
			
		||||
			printf(" \"%s\"\n", info->error);
 | 
			
		||||
		else
 | 
			
		||||
			fprintf(stderr, "\n");
 | 
			
		||||
			printf("\n");
 | 
			
		||||
		print_properties(info->props, MARK_CHANGE(PW_NODE_CHANGE_MASK_PROPS));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -346,21 +346,21 @@ static void print_port(struct proxy_data *data)
 | 
			
		|||
 | 
			
		||||
	print_all = true;
 | 
			
		||||
        if (data->first) {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		print_mark = false;
 | 
			
		||||
		data->first = false;
 | 
			
		||||
	}
 | 
			
		||||
        else {
 | 
			
		||||
		fprintf(stderr, "changed:\n");
 | 
			
		||||
		printf("changed:\n");
 | 
			
		||||
		print_mark = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tid: %d\n", data->id);
 | 
			
		||||
	fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", data->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(data->permissions));
 | 
			
		||||
	fprintf(stderr, "\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	printf("\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tdirection: \"%s\"\n", pw_direction_as_string(info->direction));
 | 
			
		||||
	printf("\tdirection: \"%s\"\n", pw_direction_as_string(info->direction));
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		print_params(data, MARK_CHANGE(PW_PORT_CHANGE_MASK_PARAMS));
 | 
			
		||||
		print_properties(info->props, MARK_CHANGE(PW_PORT_CHANGE_MASK_PROPS));
 | 
			
		||||
| 
						 | 
				
			
			@ -405,23 +405,23 @@ static void factory_event_info(void *object, const struct pw_factory_info *info)
 | 
			
		|||
 | 
			
		||||
	print_all = true;
 | 
			
		||||
        if (data->info == NULL) {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		print_mark = false;
 | 
			
		||||
	}
 | 
			
		||||
        else {
 | 
			
		||||
		fprintf(stderr, "changed:\n");
 | 
			
		||||
		printf("changed:\n");
 | 
			
		||||
		print_mark = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
        info = data->info = pw_factory_info_update(data->info, info);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tid: %d\n", data->id);
 | 
			
		||||
	fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", data->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(data->permissions));
 | 
			
		||||
	fprintf(stderr, "\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	printf("\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tname: \"%s\"\n", info->name);
 | 
			
		||||
	fprintf(stderr, "\tobject-type: %s/%d\n", info->type, info->version);
 | 
			
		||||
	printf("\tname: \"%s\"\n", info->name);
 | 
			
		||||
	printf("\tobject-type: %s/%d\n", info->type, info->version);
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		print_properties(info->props, MARK_CHANGE(PW_FACTORY_CHANGE_MASK_PROPS));
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -439,20 +439,20 @@ static void client_event_info(void *object, const struct pw_client_info *info)
 | 
			
		|||
 | 
			
		||||
	print_all = true;
 | 
			
		||||
        if (data->info == NULL) {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		print_mark = false;
 | 
			
		||||
	}
 | 
			
		||||
        else {
 | 
			
		||||
		fprintf(stderr, "changed:\n");
 | 
			
		||||
		printf("changed:\n");
 | 
			
		||||
		print_mark = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
        info = data->info = pw_client_info_update(data->info, info);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tid: %d\n", data->id);
 | 
			
		||||
	fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", data->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(data->permissions));
 | 
			
		||||
	fprintf(stderr, "\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	printf("\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		print_properties(info->props, MARK_CHANGE(PW_CLIENT_CHANGE_MASK_PROPS));
 | 
			
		||||
| 
						 | 
				
			
			@ -471,40 +471,40 @@ static void link_event_info(void *object, const struct pw_link_info *info)
 | 
			
		|||
 | 
			
		||||
	print_all = true;
 | 
			
		||||
        if (data->info == NULL) {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		print_mark = false;
 | 
			
		||||
	}
 | 
			
		||||
        else {
 | 
			
		||||
		fprintf(stderr, "changed:\n");
 | 
			
		||||
		printf("changed:\n");
 | 
			
		||||
		print_mark = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
        info = data->info = pw_link_info_update(data->info, info);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tid: %d\n", data->id);
 | 
			
		||||
	fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", data->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(data->permissions));
 | 
			
		||||
	fprintf(stderr, "\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	printf("\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\toutput-node-id: %u\n", info->output_node_id);
 | 
			
		||||
	fprintf(stderr, "\toutput-port-id: %u\n", info->output_port_id);
 | 
			
		||||
	fprintf(stderr, "\tinput-node-id: %u\n", info->input_node_id);
 | 
			
		||||
	fprintf(stderr, "\tinput-port-id: %u\n", info->input_port_id);
 | 
			
		||||
	printf("\toutput-node-id: %u\n", info->output_node_id);
 | 
			
		||||
	printf("\toutput-port-id: %u\n", info->output_port_id);
 | 
			
		||||
	printf("\tinput-node-id: %u\n", info->input_node_id);
 | 
			
		||||
	printf("\tinput-port-id: %u\n", info->input_port_id);
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_LINK_CHANGE_MASK_STATE), stderr) {
 | 
			
		||||
			fprintf(stderr, "\tstate: \"%s\"",
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_LINK_CHANGE_MASK_STATE)) {
 | 
			
		||||
			printf("\tstate: \"%s\"",
 | 
			
		||||
				pw_link_state_as_string(info->state));
 | 
			
		||||
		}
 | 
			
		||||
		if (info->state == PW_LINK_STATE_ERROR && info->error)
 | 
			
		||||
			fprintf(stderr, " \"%s\"\n", info->error);
 | 
			
		||||
			printf(" \"%s\"\n", info->error);
 | 
			
		||||
		else
 | 
			
		||||
			fprintf(stderr, "\n");
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_LINK_CHANGE_MASK_FORMAT), stderr) {
 | 
			
		||||
			fprintf(stderr, "\tformat:\n");
 | 
			
		||||
			printf("\n");
 | 
			
		||||
		with_prefix(MARK_CHANGE(PW_LINK_CHANGE_MASK_FORMAT)) {
 | 
			
		||||
			printf("\tformat:\n");
 | 
			
		||||
			if (info->format)
 | 
			
		||||
				spa_debug_format(2, NULL, info->format);
 | 
			
		||||
			else
 | 
			
		||||
				fprintf(stderr, "\t\tnone\n");
 | 
			
		||||
				printf("\t\tnone\n");
 | 
			
		||||
		}
 | 
			
		||||
		print_properties(info->props, MARK_CHANGE(PW_LINK_CHANGE_MASK_PROPS));
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -522,19 +522,19 @@ static void print_device(struct proxy_data *data)
 | 
			
		|||
 | 
			
		||||
	print_all = true;
 | 
			
		||||
        if (data->first) {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		print_mark = false;
 | 
			
		||||
		data->first = false;
 | 
			
		||||
	}
 | 
			
		||||
        else {
 | 
			
		||||
		fprintf(stderr, "changed:\n");
 | 
			
		||||
		printf("changed:\n");
 | 
			
		||||
		print_mark = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\tid: %d\n", data->id);
 | 
			
		||||
	fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
	printf("\tid: %d\n", data->id);
 | 
			
		||||
	printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
			PW_PERMISSION_ARGS(data->permissions));
 | 
			
		||||
	fprintf(stderr, "\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
	printf("\ttype: %s (version %d)\n", data->type, data->version);
 | 
			
		||||
 | 
			
		||||
	if (print_all) {
 | 
			
		||||
		print_params(data, MARK_CHANGE(PW_DEVICE_CHANGE_MASK_PARAMS));
 | 
			
		||||
| 
						 | 
				
			
			@ -648,11 +648,11 @@ static void registry_event_global(void *data, uint32_t id,
 | 
			
		|||
		client_version = PW_VERSION_LINK;
 | 
			
		||||
		destroy = (pw_destroy_t) pw_link_info_free;
 | 
			
		||||
	} else {
 | 
			
		||||
		fprintf(stderr, "added:\n");
 | 
			
		||||
		fprintf(stderr, "\tid: %u\n", id);
 | 
			
		||||
		fprintf(stderr, "\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
		printf("added:\n");
 | 
			
		||||
		printf("\tid: %u\n", id);
 | 
			
		||||
		printf("\tpermissions: "PW_PERMISSION_FORMAT"\n",
 | 
			
		||||
				PW_PERMISSION_ARGS(permissions));
 | 
			
		||||
		fprintf(stderr, "\ttype: %s (version %d)\n", type, version);
 | 
			
		||||
		printf("\ttype: %s (version %d)\n", type, version);
 | 
			
		||||
		print_properties(props, false);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -701,8 +701,8 @@ static void registry_event_global_remove(void *object, uint32_t id)
 | 
			
		|||
	struct data *d = object;
 | 
			
		||||
	struct proxy_data *pd;
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "removed:\n");
 | 
			
		||||
	fprintf(stderr, "\tid: %u\n", id);
 | 
			
		||||
	printf("removed:\n");
 | 
			
		||||
	printf("\tid: %u\n", id);
 | 
			
		||||
 | 
			
		||||
	pd = find_proxy(d, id);
 | 
			
		||||
	if (pd == NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -741,9 +741,9 @@ static void do_quit(void *data, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(d->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(const char *name)
 | 
			
		||||
static void show_help(const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -r, --remote                          Remote daemon name\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -770,16 +770,18 @@ int main(int argc, char *argv[])
 | 
			
		|||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	setlinebuf(stdout);
 | 
			
		||||
 | 
			
		||||
	if (isatty(STDERR_FILENO) && getenv("NO_COLOR") == NULL)
 | 
			
		||||
		colors = true;
 | 
			
		||||
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVr:", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -801,12 +803,13 @@ int main(int argc, char *argv[])
 | 
			
		|||
			else if (!strcmp(optarg, "always"))
 | 
			
		||||
				colors = true;
 | 
			
		||||
			else {
 | 
			
		||||
				show_help(argv[0]);
 | 
			
		||||
				fprintf(stderr, "Invalid color: %s\n", optarg);
 | 
			
		||||
				show_help(argv[0], true);
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -131,7 +131,7 @@ static int process_driver_block(struct data *d, const struct spa_pod *pod, struc
 | 
			
		|||
 | 
			
		||||
	if (d->driver_id == 0) {
 | 
			
		||||
		d->driver_id = driver_id;
 | 
			
		||||
		fprintf(stderr, "logging driver %u\n", driver_id);
 | 
			
		||||
		printf("logging driver %u\n", driver_id);
 | 
			
		||||
	}
 | 
			
		||||
	else if (d->driver_id != driver_id)
 | 
			
		||||
		return -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -162,7 +162,7 @@ static int add_follower(struct data *d, uint32_t id, const char *name)
 | 
			
		|||
	strncpy(d->followers[idx].name, name, MAX_NAME);
 | 
			
		||||
	d->followers[idx].name[MAX_NAME-1] = '\0';
 | 
			
		||||
	d->followers[idx].id = id;
 | 
			
		||||
	fprintf(stderr, "logging follower %u (\"%s\")\n", id, name);
 | 
			
		||||
	printf("logging follower %u (\"%s\")\n", id, name);
 | 
			
		||||
 | 
			
		||||
	return idx;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +243,7 @@ static void dump_point(struct data *d, struct point *point)
 | 
			
		|||
		d->last_status = point->clock.nsec;
 | 
			
		||||
	}
 | 
			
		||||
	else if (point->clock.nsec - d->last_status > SPA_NSEC_PER_SEC) {
 | 
			
		||||
		fprintf(stderr, "logging %"PRIi64" samples  %"PRIi64" seconds [CPU %f %f %f]\r",
 | 
			
		||||
		printf("logging %"PRIi64" samples  %"PRIi64" seconds [CPU %f %f %f]\r",
 | 
			
		||||
				d->count, (int64_t) ((d->last_status - d->start_status) / SPA_NSEC_PER_SEC),
 | 
			
		||||
				point->cpu_load[0], point->cpu_load[1], point->cpu_load[2]);
 | 
			
		||||
		d->last_status = point->clock.nsec;
 | 
			
		||||
| 
						 | 
				
			
			@ -259,7 +259,7 @@ static void dump_scripts(struct data *d)
 | 
			
		|||
	if (d->driver_id == 0)
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "\ndumping scripts for %d followers\n", d->n_followers);
 | 
			
		||||
	printf("\ndumping scripts for %d followers\n", d->n_followers);
 | 
			
		||||
 | 
			
		||||
	out = fopen("Timing1.plot", "w");
 | 
			
		||||
	if (out == NULL) {
 | 
			
		||||
| 
						 | 
				
			
			@ -420,7 +420,7 @@ static void dump_scripts(struct data *d)
 | 
			
		|||
			"gnuplot Timing5.plot\n");
 | 
			
		||||
		fclose(out);
 | 
			
		||||
	}
 | 
			
		||||
	fprintf(stderr, "run 'sh generate_timings.sh' and load Timings.html in a browser\n");
 | 
			
		||||
	printf("run 'sh generate_timings.sh' and load Timings.html in a browser\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void profiler_profile(void *data, const struct spa_pod *pod)
 | 
			
		||||
| 
						 | 
				
			
			@ -487,7 +487,7 @@ static void registry_event_global(void *data, uint32_t id,
 | 
			
		|||
	if (proxy == NULL)
 | 
			
		||||
		goto error_proxy;
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "Attaching to Profiler id:%d\n", id);
 | 
			
		||||
	printf("Attaching to Profiler id:%d\n", id);
 | 
			
		||||
	d->profiler = proxy;
 | 
			
		||||
	pw_proxy_add_object_listener(proxy, &d->profiler_listener, &profiler_events, d);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -539,9 +539,9 @@ static void do_quit(void *data, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(d->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(const char *name)
 | 
			
		||||
static void show_help(const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -r, --remote                          Remote daemon name\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -570,10 +570,10 @@ int main(int argc, char *argv[])
 | 
			
		|||
	while ((c = getopt_long(argc, argv, "hVr:o:", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -587,7 +587,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			opt_remote = optarg;
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -628,7 +628,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fprintf(stderr, "Logging to %s\n", data.filename);
 | 
			
		||||
	printf("Logging to %s\n", data.filename);
 | 
			
		||||
 | 
			
		||||
	pw_core_add_listener(data.core,
 | 
			
		||||
				   &data.core_listener,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,24 +50,24 @@ struct impl {
 | 
			
		|||
 | 
			
		||||
static void reserve_acquired(void *data, struct rd_device *d)
 | 
			
		||||
{
 | 
			
		||||
	fprintf(stdout, "reserve acquired\n");
 | 
			
		||||
	printf("reserve acquired\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void reserve_release(void *data, struct rd_device *d, int forced)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
	fprintf(stdout, "reserve release\n");
 | 
			
		||||
	printf("reserve release\n");
 | 
			
		||||
	rd_device_complete_release(impl->device, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void reserve_busy(void *data, struct rd_device *d, const char *name, int32_t prio)
 | 
			
		||||
{
 | 
			
		||||
	fprintf(stdout, "reserve busy %s, prio %d\n", name, prio);
 | 
			
		||||
	printf("reserve busy %s, prio %d\n", name, prio);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void reserve_available(void *data, struct rd_device *d, const char *name)
 | 
			
		||||
{
 | 
			
		||||
	fprintf(stdout, "reserve available %s\n", name);
 | 
			
		||||
	printf("reserve available %s\n", name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct rd_device_callbacks reserve_callbacks = {
 | 
			
		||||
| 
						 | 
				
			
			@ -86,9 +86,9 @@ static void do_quit(void *data, int signal_number)
 | 
			
		|||
#define DEFAULT_APPNAME		"pw-reserve"
 | 
			
		||||
#define DEFAULT_PRIORITY	0
 | 
			
		||||
 | 
			
		||||
static void show_help(const char *name)
 | 
			
		||||
static void show_help(const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options]\n"
 | 
			
		||||
             "  -h, --help                            Show this help\n"
 | 
			
		||||
             "      --version                         Show version\n"
 | 
			
		||||
             "  -n, --name                            Name to reserve (Audio0, Midi0, Video0, ..)\n"
 | 
			
		||||
| 
						 | 
				
			
			@ -119,15 +119,17 @@ int main(int argc, char *argv[])
 | 
			
		|||
		{ NULL, 0, NULL, 0}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	setlinebuf(stdout);
 | 
			
		||||
 | 
			
		||||
	pw_init(&argc, &argv);
 | 
			
		||||
 | 
			
		||||
	while ((c = getopt_long(argc, argv, "hVn:a:p:m", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -147,7 +149,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			opt_monitor = true;
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			fprintf(stderr, "invalid option '%c'\n", c);
 | 
			
		||||
			show_help(argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -374,7 +374,7 @@ static void registry_event_global(void *data, uint32_t id,
 | 
			
		|||
		}
 | 
			
		||||
	} else if (spa_streq(type, PW_TYPE_INTERFACE_Profiler)) {
 | 
			
		||||
		if (d->profiler != NULL) {
 | 
			
		||||
			fprintf(stderr, "Ignoring profiler %d: already attached\n", id);
 | 
			
		||||
			printf("Ignoring profiler %d: already attached\n", id);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -443,9 +443,9 @@ static void do_quit(void *data, int signal_number)
 | 
			
		|||
	pw_main_loop_quit(d->loop);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void show_help(const char *name)
 | 
			
		||||
static void show_help(const char *name, bool error)
 | 
			
		||||
{
 | 
			
		||||
        fprintf(stdout, "%s [options]\n"
 | 
			
		||||
        fprintf(error ? stderr : stdout, "%s [options]\n"
 | 
			
		||||
		"  -h, --help                            Show this help\n"
 | 
			
		||||
		"      --version                         Show version\n"
 | 
			
		||||
		"  -r, --remote                          Remote daemon name\n",
 | 
			
		||||
| 
						 | 
				
			
			@ -506,10 +506,10 @@ int main(int argc, char *argv[])
 | 
			
		|||
	while ((c = getopt_long(argc, argv, "hVr:o:", long_options, NULL)) != -1) {
 | 
			
		||||
		switch (c) {
 | 
			
		||||
		case 'h':
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], false);
 | 
			
		||||
			return 0;
 | 
			
		||||
		case 'V':
 | 
			
		||||
			fprintf(stdout, "%s\n"
 | 
			
		||||
			printf("%s\n"
 | 
			
		||||
				"Compiled with libpipewire %s\n"
 | 
			
		||||
				"Linked with libpipewire %s\n",
 | 
			
		||||
				argv[0],
 | 
			
		||||
| 
						 | 
				
			
			@ -520,7 +520,7 @@ int main(int argc, char *argv[])
 | 
			
		|||
			opt_remote = optarg;
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			show_help(argv[0]);
 | 
			
		||||
			show_help(argv[0], true);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue