mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	pipewire: use the internal log topics
This commit is contained in:
		
							parent
							
								
									52bd80aaa4
								
							
						
					
					
						commit
						a6e66d9180
					
				
					 17 changed files with 370 additions and 332 deletions
				
			
		|  | @ -46,7 +46,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <pipewire/impl.h> | #include <pipewire/impl.h> | ||||||
| 
 | 
 | ||||||
| #define NAME "config" | PW_LOG_TOPIC_EXTERN(log_conf); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_conf | ||||||
| 
 | 
 | ||||||
| static int make_path(char *path, int size, const char *paths[]) | static int make_path(char *path, int size, const char *paths[]) | ||||||
| { | { | ||||||
|  | @ -306,7 +307,7 @@ int pw_conf_save_state(const char *prefix, const char *name, struct pw_propertie | ||||||
| 		goto error; | 		goto error; | ||||||
| 	} | 	} | ||||||
| 	res = 0; | 	res = 0; | ||||||
| 	pw_log_info(NAME" %p: saved state '%s%s'", conf, path, name); | 	pw_log_info("%p: saved state '%s%s'", conf, path, name); | ||||||
| error: | error: | ||||||
| 	close(sfd); | 	close(sfd); | ||||||
| 	return res; | 	return res; | ||||||
|  | @ -319,11 +320,11 @@ static int conf_load(const char *path, struct pw_properties *conf) | ||||||
| 	int fd; | 	int fd; | ||||||
| 
 | 
 | ||||||
| 	if ((fd = open(path,  O_CLOEXEC | O_RDONLY)) < 0)  { | 	if ((fd = open(path,  O_CLOEXEC | O_RDONLY)) < 0)  { | ||||||
| 		pw_log_warn(NAME" %p: error loading config '%s': %m", conf, path); | 		pw_log_warn("%p: error loading config '%s': %m", conf, path); | ||||||
| 		return -errno; | 		return -errno; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_info(NAME" %p: loading config '%s'", conf, path); | 	pw_log_info("%p: loading config '%s'", conf, path); | ||||||
| 	if (fstat(fd, &sbuf) < 0) | 	if (fstat(fd, &sbuf) < 0) | ||||||
| 		goto error_close; | 		goto error_close; | ||||||
| 	if ((data = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED) | 	if ((data = mmap(NULL, sbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED) | ||||||
|  | @ -346,12 +347,12 @@ int pw_conf_load_conf(const char *prefix, const char *name, struct pw_properties | ||||||
| 	char path[PATH_MAX]; | 	char path[PATH_MAX]; | ||||||
| 
 | 
 | ||||||
| 	if (name == NULL) { | 	if (name == NULL) { | ||||||
| 		pw_log_debug(NAME" %p: config name must not be NULL", conf); | 		pw_log_debug("%p: config name must not be NULL", conf); | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (get_config_path(path, sizeof(path), prefix, name) == 0) { | 	if (get_config_path(path, sizeof(path), prefix, name) == 0) { | ||||||
| 		pw_log_debug(NAME" %p: can't load config '%s': %m", conf, path); | 		pw_log_debug("%p: can't load config '%s': %m", conf, path); | ||||||
| 		return -ENOENT; | 		return -ENOENT; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -364,12 +365,12 @@ int pw_conf_load_state(const char *prefix, const char *name, struct pw_propertie | ||||||
| 	char path[PATH_MAX]; | 	char path[PATH_MAX]; | ||||||
| 
 | 
 | ||||||
| 	if (name == NULL) { | 	if (name == NULL) { | ||||||
| 		pw_log_debug(NAME" %p: config name must not be NULL", conf); | 		pw_log_debug("%p: config name must not be NULL", conf); | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (get_state_path(path, sizeof(path), prefix, name) == 0) { | 	if (get_state_path(path, sizeof(path), prefix, name) == 0) { | ||||||
| 		pw_log_debug(NAME" %p: can't load config '%s': %m", conf, path); | 		pw_log_debug("%p: can't load config '%s': %m", conf, path); | ||||||
| 		return -ENOENT; | 		return -ENOENT; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -405,18 +406,18 @@ static int load_module(struct pw_context *context, const char *key, const char * | ||||||
| { | { | ||||||
| 	if (pw_context_load_module(context, key, args, NULL) == NULL) { | 	if (pw_context_load_module(context, key, args, NULL) == NULL) { | ||||||
| 		if (errno == ENOENT && flags && strstr(flags, "ifexists") != NULL) { | 		if (errno == ENOENT && flags && strstr(flags, "ifexists") != NULL) { | ||||||
| 			pw_log_info(NAME" %p: skipping unavailable module %s", | 			pw_log_info("%p: skipping unavailable module %s", | ||||||
| 					context, key); | 					context, key); | ||||||
| 		} else if (flags == NULL || strstr(flags, "nofail") == NULL) { | 		} else if (flags == NULL || strstr(flags, "nofail") == NULL) { | ||||||
| 			pw_log_error(NAME" %p: could not load mandatory module \"%s\": %m", | 			pw_log_error("%p: could not load mandatory module \"%s\": %m", | ||||||
| 					context, key); | 					context, key); | ||||||
| 			return -errno; | 			return -errno; | ||||||
| 		} else { | 		} else { | ||||||
| 			pw_log_info(NAME" %p: could not load optional module \"%s\": %m", | 			pw_log_info("%p: could not load optional module \"%s\": %m", | ||||||
| 					context, key); | 					context, key); | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		pw_log_info(NAME" %p: loaded module %s", context, key); | 		pw_log_info("%p: loaded module %s", context, key); | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -49,7 +49,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <pipewire/extensions/protocol-native.h> | #include <pipewire/extensions/protocol-native.h> | ||||||
| 
 | 
 | ||||||
| #define NAME "context" | PW_LOG_TOPIC_EXTERN(log_context); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_context | ||||||
| 
 | 
 | ||||||
| #define DEFAULT_CLOCK_RATE			48000u | #define DEFAULT_CLOCK_RATE			48000u | ||||||
| #define DEFAULT_CLOCK_QUANTUM			1024u | #define DEFAULT_CLOCK_QUANTUM			1024u | ||||||
|  | @ -220,7 +221,7 @@ static int try_load_conf(struct pw_context *this, const char *conf_prefix, | ||||||
| 		return 0; | 		return 0; | ||||||
| 	if ((res = pw_conf_load_conf(conf_prefix, conf_name, conf)) < 0) { | 	if ((res = pw_conf_load_conf(conf_prefix, conf_name, conf)) < 0) { | ||||||
| 		bool skip_prefix = conf_prefix == NULL || conf_name[0] == '/'; | 		bool skip_prefix = conf_prefix == NULL || conf_name[0] == '/'; | ||||||
| 		pw_log_warn(NAME" %p: can't load config %s%s%s: %s", | 		pw_log_warn("%p: can't load config %s%s%s: %s", | ||||||
| 				this, | 				this, | ||||||
| 				skip_prefix ? "" : conf_prefix, | 				skip_prefix ? "" : conf_prefix, | ||||||
| 				skip_prefix ? "" : "/", | 				skip_prefix ? "" : "/", | ||||||
|  | @ -238,14 +239,14 @@ static int context_set_freewheel(struct pw_context *context, bool freewheel) | ||||||
| 		return -EIO; | 		return -EIO; | ||||||
| 
 | 
 | ||||||
| 	if (freewheel) { | 	if (freewheel) { | ||||||
| 		pw_log_info(NAME" %p: enter freewheel", context); | 		pw_log_info("%p: enter freewheel", context); | ||||||
| 		res = pw_thread_utils_drop_rt(thr); | 		res = pw_thread_utils_drop_rt(thr); | ||||||
| 	} else { | 	} else { | ||||||
| 		pw_log_info(NAME" %p: exit freewheel", context); | 		pw_log_info("%p: exit freewheel", context); | ||||||
| 		res = pw_thread_utils_acquire_rt(thr, 88); | 		res = pw_thread_utils_acquire_rt(thr, 88); | ||||||
| 	} | 	} | ||||||
| 	if (res < 0) | 	if (res < 0) | ||||||
| 		pw_log_info(NAME" %p: freewheel error:%s", context, spa_strerror(res)); | 		pw_log_info("%p: freewheel error:%s", context, spa_strerror(res)); | ||||||
| 
 | 
 | ||||||
| 	context->freewheeling = freewheel; | 	context->freewheeling = freewheel; | ||||||
| 
 | 
 | ||||||
|  | @ -314,7 +315,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, | ||||||
| 
 | 
 | ||||||
| 	this = &impl->this; | 	this = &impl->this; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new", this); | 	pw_log_debug("%p: new", this); | ||||||
| 
 | 
 | ||||||
| 	if (user_data_size > 0) | 	if (user_data_size > 0) | ||||||
| 		this->user_data = SPA_PTROFF(impl, sizeof(struct impl), void); | 		this->user_data = SPA_PTROFF(impl, sizeof(struct impl), void); | ||||||
|  | @ -369,7 +370,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, | ||||||
| 		if (try_load_conf(this, conf_prefix, conf_name, conf) < 0) { | 		if (try_load_conf(this, conf_prefix, conf_name, conf) < 0) { | ||||||
| 			conf_name = "client.conf"; | 			conf_name = "client.conf"; | ||||||
| 			if ((res = try_load_conf(this, conf_prefix, conf_name, conf)) < 0) { | 			if ((res = try_load_conf(this, conf_prefix, conf_name, conf)) < 0) { | ||||||
| 				pw_log_error(NAME" %p: can't load config %s: %s", | 				pw_log_error("%p: can't load config %s: %s", | ||||||
| 					this, conf_name, spa_strerror(res)); | 					this, conf_name, spa_strerror(res)); | ||||||
| 				goto error_free; | 				goto error_free; | ||||||
| 			} | 			} | ||||||
|  | @ -381,7 +382,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(conf, "context.properties")) != NULL) { | 	if ((str = pw_properties_get(conf, "context.properties")) != NULL) { | ||||||
| 		pw_properties_update_string(properties, str, strlen(str)); | 		pw_properties_update_string(properties, str, strlen(str)); | ||||||
| 		pw_log_info(NAME" %p: parsed context.properties section", this); | 		pw_log_info("%p: parsed context.properties section", this); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((str = getenv("PIPEWIRE_CORE"))) { | 	if ((str = getenv("PIPEWIRE_CORE"))) { | ||||||
|  | @ -405,9 +406,9 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, | ||||||
| 	if ((str = pw_properties_get(properties, "mem.mlock-all")) != NULL && | 	if ((str = pw_properties_get(properties, "mem.mlock-all")) != NULL && | ||||||
| 	    pw_properties_parse_bool(str)) { | 	    pw_properties_parse_bool(str)) { | ||||||
| 		if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) | 		if (mlockall(MCL_CURRENT | MCL_FUTURE) < 0) | ||||||
| 			pw_log_warn(NAME" %p: could not mlockall; %m", impl); | 			pw_log_warn("%p: could not mlockall; %m", impl); | ||||||
| 		else | 		else | ||||||
| 			pw_log_info(NAME" %p: mlockall succeeded", impl); | 			pw_log_info("%p: mlockall succeeded", impl); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	fill_defaults(this); | 	fill_defaults(this); | ||||||
|  | @ -456,7 +457,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, | ||||||
| 		if (impl->dbus_handle == NULL || | 		if (impl->dbus_handle == NULL || | ||||||
| 		    (res = spa_handle_get_interface(impl->dbus_handle, | 		    (res = spa_handle_get_interface(impl->dbus_handle, | ||||||
| 							SPA_TYPE_INTERFACE_DBus, &dbus_iface)) < 0) { | 							SPA_TYPE_INTERFACE_DBus, &dbus_iface)) < 0) { | ||||||
| 				pw_log_warn(NAME" %p: can't load dbus interface: %s", this, spa_strerror(res)); | 				pw_log_warn("%p: can't load dbus interface: %s", this, spa_strerror(res)); | ||||||
| 		} else { | 		} else { | ||||||
| 			this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DBus, dbus_iface); | 			this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DBus, dbus_iface); | ||||||
| 		} | 		} | ||||||
|  | @ -475,19 +476,19 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, | ||||||
| 
 | 
 | ||||||
| 	if ((res = pw_context_parse_conf_section(this, conf, "context.spa-libs")) < 0) | 	if ((res = pw_context_parse_conf_section(this, conf, "context.spa-libs")) < 0) | ||||||
| 		goto error_free; | 		goto error_free; | ||||||
| 	pw_log_info(NAME" %p: parsed %d context.spa-libs items", this, res); | 	pw_log_info("%p: parsed %d context.spa-libs items", this, res); | ||||||
| 	if ((res = pw_context_parse_conf_section(this, conf, "context.modules")) < 0) | 	if ((res = pw_context_parse_conf_section(this, conf, "context.modules")) < 0) | ||||||
| 		goto error_free; | 		goto error_free; | ||||||
| 	if (res > 0) | 	if (res > 0) | ||||||
| 		pw_log_info(NAME" %p: parsed %d context.modules items", this, res); | 		pw_log_info("%p: parsed %d context.modules items", this, res); | ||||||
| 	else | 	else | ||||||
| 		pw_log_warn(NAME "%p: no modules loaded from context.modules", this); | 		pw_log_warn("%p: no modules loaded from context.modules", this); | ||||||
| 	if ((res = pw_context_parse_conf_section(this, conf, "context.objects")) < 0) | 	if ((res = pw_context_parse_conf_section(this, conf, "context.objects")) < 0) | ||||||
| 		goto error_free; | 		goto error_free; | ||||||
| 	pw_log_info(NAME" %p: parsed %d context.objects items", this, res); | 	pw_log_info("%p: parsed %d context.objects items", this, res); | ||||||
| 	if ((res = pw_context_parse_conf_section(this, conf, "context.exec")) < 0) | 	if ((res = pw_context_parse_conf_section(this, conf, "context.exec")) < 0) | ||||||
| 		goto error_free; | 		goto error_free; | ||||||
| 	pw_log_info(NAME" %p: parsed %d context.exec items", this, res); | 	pw_log_info("%p: parsed %d context.exec items", this, res); | ||||||
| 
 | 
 | ||||||
| 	if ((res = pw_data_loop_start(this->data_loop_impl)) < 0) | 	if ((res = pw_data_loop_start(this->data_loop_impl)) < 0) | ||||||
| 		goto error_free; | 		goto error_free; | ||||||
|  | @ -496,7 +497,7 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop, | ||||||
| 
 | 
 | ||||||
| 	pw_settings_init(this); | 	pw_settings_init(this); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: created", this); | 	pw_log_debug("%p: created", this); | ||||||
| 
 | 
 | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
|  | @ -526,7 +527,7 @@ void pw_context_destroy(struct pw_context *context) | ||||||
| 	struct pw_impl_metadata *metadata; | 	struct pw_impl_metadata *metadata; | ||||||
| 	struct pw_impl_core *core_impl; | 	struct pw_impl_core *core_impl; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", context); | 	pw_log_debug("%p: destroy", context); | ||||||
| 	pw_context_emit_destroy(context); | 	pw_context_emit_destroy(context); | ||||||
| 
 | 
 | ||||||
| 	spa_list_consume(core, &context->core_list, link) | 	spa_list_consume(core, &context->core_list, link) | ||||||
|  | @ -559,7 +560,7 @@ void pw_context_destroy(struct pw_context *context) | ||||||
| 	spa_list_consume(core_impl, &context->core_impl_list, link) | 	spa_list_consume(core_impl, &context->core_impl_list, link) | ||||||
| 		pw_impl_core_destroy(core_impl); | 		pw_impl_core_destroy(core_impl); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free", context); | 	pw_log_debug("%p: free", context); | ||||||
| 	pw_context_emit_free(context); | 	pw_context_emit_free(context); | ||||||
| 
 | 
 | ||||||
| 	if (context->pool) | 	if (context->pool) | ||||||
|  | @ -653,7 +654,7 @@ int pw_context_update_properties(struct pw_context *context, const struct spa_di | ||||||
| 	int changed; | 	int changed; | ||||||
| 
 | 
 | ||||||
| 	changed = pw_properties_update(context->properties, dict); | 	changed = pw_properties_update(context->properties, dict); | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", context, changed); | 	pw_log_debug("%p: updated %d properties", context, changed); | ||||||
| 
 | 
 | ||||||
| 	return changed; | 	return changed; | ||||||
| } | } | ||||||
|  | @ -726,7 +727,7 @@ struct pw_impl_port *pw_context_find_port(struct pw_context *context, | ||||||
| 
 | 
 | ||||||
| 	have_id = id != PW_ID_ANY; | 	have_id = id != PW_ID_ANY; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: id:%u", context, id); | 	pw_log_debug("%p: id:%u", context, id); | ||||||
| 
 | 
 | ||||||
| 	spa_list_for_each(n, &context->node_list, link) { | 	spa_list_for_each(n, &context->node_list, link) { | ||||||
| 		if (n->global == NULL) | 		if (n->global == NULL) | ||||||
|  | @ -738,11 +739,11 @@ struct pw_impl_port *pw_context_find_port(struct pw_context *context, | ||||||
| 		if (!global_can_read(context, n->global)) | 		if (!global_can_read(context, n->global)) | ||||||
| 			continue; | 			continue; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: node id:%d", context, n->global->id); | 		pw_log_debug("%p: node id:%d", context, n->global->id); | ||||||
| 
 | 
 | ||||||
| 		if (have_id) { | 		if (have_id) { | ||||||
| 			if (n->global->id == id) { | 			if (n->global->id == id) { | ||||||
| 				pw_log_debug(NAME" %p: id:%u matches node %p", context, id, n); | 				pw_log_debug("%p: id:%u matches node %p", context, id, n); | ||||||
| 
 | 
 | ||||||
| 				best = | 				best = | ||||||
| 				    pw_impl_node_find_port(n, | 				    pw_impl_node_find_port(n, | ||||||
|  | @ -868,7 +869,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 	out_state = output->state; | 	out_state = output->state; | ||||||
| 	in_state = input->state; | 	in_state = input->state; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: finding best format %d %d", context, out_state, in_state); | 	pw_log_debug("%p: finding best format %d %d", context, out_state, in_state); | ||||||
| 
 | 
 | ||||||
| 	/* when a port is configured but the node is idle, we can reconfigure with a different format */ | 	/* when a port is configured but the node is idle, we can reconfigure with a different format */ | ||||||
| 	if (out_state > PW_IMPL_PORT_STATE_CONFIGURE && output->node->info.state == PW_NODE_STATE_IDLE) | 	if (out_state > PW_IMPL_PORT_STATE_CONFIGURE && output->node->info.state == PW_NODE_STATE_IDLE) | ||||||
|  | @ -876,7 +877,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 	if (in_state > PW_IMPL_PORT_STATE_CONFIGURE && input->node->info.state == PW_NODE_STATE_IDLE) | 	if (in_state > PW_IMPL_PORT_STATE_CONFIGURE && input->node->info.state == PW_NODE_STATE_IDLE) | ||||||
| 		in_state = PW_IMPL_PORT_STATE_CONFIGURE; | 		in_state = PW_IMPL_PORT_STATE_CONFIGURE; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: states %d %d", context, out_state, in_state); | 	pw_log_debug("%p: states %d %d", context, out_state, in_state); | ||||||
| 
 | 
 | ||||||
| 	if (in_state == PW_IMPL_PORT_STATE_CONFIGURE && out_state > PW_IMPL_PORT_STATE_CONFIGURE) { | 	if (in_state == PW_IMPL_PORT_STATE_CONFIGURE && out_state > PW_IMPL_PORT_STATE_CONFIGURE) { | ||||||
| 		/* only input needs format */ | 		/* only input needs format */ | ||||||
|  | @ -891,7 +892,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 				*error = spa_aprintf("no output formats"); | 				*error = spa_aprintf("no output formats"); | ||||||
| 			goto error; | 			goto error; | ||||||
| 		} | 		} | ||||||
| 		pw_log_debug(NAME" %p: Got output format:", context); | 		pw_log_debug("%p: Got output format:", context); | ||||||
| 		pw_log_format(SPA_LOG_LEVEL_DEBUG, filter); | 		pw_log_format(SPA_LOG_LEVEL_DEBUG, filter); | ||||||
| 
 | 
 | ||||||
| 		if ((res = spa_node_port_enum_params_sync(input->node->node, | 		if ((res = spa_node_port_enum_params_sync(input->node->node, | ||||||
|  | @ -899,7 +900,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 						     SPA_PARAM_EnumFormat, &iidx, | 						     SPA_PARAM_EnumFormat, &iidx, | ||||||
| 						     filter, format, builder)) <= 0) { | 						     filter, format, builder)) <= 0) { | ||||||
| 			if (res == -ENOENT || res == 0) { | 			if (res == -ENOENT || res == 0) { | ||||||
| 				pw_log_debug(NAME" %p: no input format filter, using output format: %s", | 				pw_log_debug("%p: no input format filter, using output format: %s", | ||||||
| 						context, spa_strerror(res)); | 						context, spa_strerror(res)); | ||||||
| 				*format = filter; | 				*format = filter; | ||||||
| 			} else { | 			} else { | ||||||
|  | @ -920,7 +921,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 				*error = spa_aprintf("no input format"); | 				*error = spa_aprintf("no input format"); | ||||||
| 			goto error; | 			goto error; | ||||||
| 		} | 		} | ||||||
| 		pw_log_debug(NAME" %p: Got input format:", context); | 		pw_log_debug("%p: Got input format:", context); | ||||||
| 		pw_log_format(SPA_LOG_LEVEL_DEBUG, filter); | 		pw_log_format(SPA_LOG_LEVEL_DEBUG, filter); | ||||||
| 
 | 
 | ||||||
| 		if ((res = spa_node_port_enum_params_sync(output->node->node, | 		if ((res = spa_node_port_enum_params_sync(output->node->node, | ||||||
|  | @ -928,7 +929,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 						     SPA_PARAM_EnumFormat, &oidx, | 						     SPA_PARAM_EnumFormat, &oidx, | ||||||
| 						     filter, format, builder)) <= 0) { | 						     filter, format, builder)) <= 0) { | ||||||
| 			if (res == -ENOENT || res == 0) { | 			if (res == -ENOENT || res == 0) { | ||||||
| 				pw_log_debug(NAME" %p: no output format filter, using input format: %s", | 				pw_log_debug("%p: no output format filter, using input format: %s", | ||||||
| 						context, spa_strerror(res)); | 						context, spa_strerror(res)); | ||||||
| 				*format = filter; | 				*format = filter; | ||||||
| 			} else { | 			} else { | ||||||
|  | @ -939,14 +940,14 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 	} else if (in_state == PW_IMPL_PORT_STATE_CONFIGURE && out_state == PW_IMPL_PORT_STATE_CONFIGURE) { | 	} else if (in_state == PW_IMPL_PORT_STATE_CONFIGURE && out_state == PW_IMPL_PORT_STATE_CONFIGURE) { | ||||||
| 	      again: | 	      again: | ||||||
| 		/* both ports need a format */ | 		/* both ports need a format */ | ||||||
| 		pw_log_debug(NAME" %p: do enum input %d", context, iidx); | 		pw_log_debug("%p: do enum input %d", context, iidx); | ||||||
| 		spa_pod_builder_init(&fb, fbuf, sizeof(fbuf)); | 		spa_pod_builder_init(&fb, fbuf, sizeof(fbuf)); | ||||||
| 		if ((res = spa_node_port_enum_params_sync(input->node->node, | 		if ((res = spa_node_port_enum_params_sync(input->node->node, | ||||||
| 						     input->direction, input->port_id, | 						     input->direction, input->port_id, | ||||||
| 						     SPA_PARAM_EnumFormat, &iidx, | 						     SPA_PARAM_EnumFormat, &iidx, | ||||||
| 						     NULL, &filter, &fb)) != 1) { | 						     NULL, &filter, &fb)) != 1) { | ||||||
| 			if (res == -ENOENT) { | 			if (res == -ENOENT) { | ||||||
| 				pw_log_debug(NAME" %p: no input filter", context); | 				pw_log_debug("%p: no input filter", context); | ||||||
| 				filter = NULL; | 				filter = NULL; | ||||||
| 			} else { | 			} else { | ||||||
| 				if (res < 0) | 				if (res < 0) | ||||||
|  | @ -956,7 +957,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 				goto error; | 				goto error; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		pw_log_debug(NAME" %p: enum output %d with filter: %p", context, oidx, filter); | 		pw_log_debug("%p: enum output %d with filter: %p", context, oidx, filter); | ||||||
| 		pw_log_format(SPA_LOG_LEVEL_DEBUG, filter); | 		pw_log_format(SPA_LOG_LEVEL_DEBUG, filter); | ||||||
| 
 | 
 | ||||||
| 		if ((res = spa_node_port_enum_params_sync(output->node->node, | 		if ((res = spa_node_port_enum_params_sync(output->node->node, | ||||||
|  | @ -971,7 +972,7 @@ int pw_context_find_format(struct pw_context *context, | ||||||
| 			goto error; | 			goto error; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: Got filtered:", context); | 		pw_log_debug("%p: Got filtered:", context); | ||||||
| 		pw_log_format(SPA_LOG_LEVEL_DEBUG, *format); | 		pw_log_format(SPA_LOG_LEVEL_DEBUG, *format); | ||||||
| 	} else { | 	} else { | ||||||
| 		res = -EBADF; | 		res = -EBADF; | ||||||
|  | @ -1114,11 +1115,11 @@ static void suspend_driver(struct pw_context *context, struct pw_impl_node *n) | ||||||
| 	spa_list_for_each(s, &n->follower_list, follower_link) { | 	spa_list_for_each(s, &n->follower_list, follower_link) { | ||||||
| 		if (s == n) | 		if (s == n) | ||||||
| 			continue; | 			continue; | ||||||
| 		pw_log_debug(NAME" %p: follower %p: '%s' suspend", | 		pw_log_debug("%p: follower %p: '%s' suspend", | ||||||
| 				context, s, s->name); | 				context, s, s->name); | ||||||
| 		pw_impl_node_set_state(s, PW_NODE_STATE_SUSPENDED); | 		pw_impl_node_set_state(s, PW_NODE_STATE_SUSPENDED); | ||||||
| 	} | 	} | ||||||
| 	pw_log_debug(NAME" %p: driver %p: '%s' suspend", | 	pw_log_debug("%p: driver %p: '%s' suspend", | ||||||
| 			context, n, n->name); | 			context, n, n->name); | ||||||
| 	pw_impl_node_set_state(n, PW_NODE_STATE_SUSPENDED); | 	pw_impl_node_set_state(n, PW_NODE_STATE_SUSPENDED); | ||||||
| } | } | ||||||
|  | @ -1150,7 +1151,7 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason) | ||||||
| 	uint32_t *rates, n_rates, def_rate; | 	uint32_t *rates, n_rates, def_rate; | ||||||
| 	bool freewheel = false, force_rate; | 	bool freewheel = false, force_rate; | ||||||
| 
 | 
 | ||||||
| 	pw_log_info(NAME" %p: busy:%d reason:%s", context, impl->recalc, reason); | 	pw_log_info("%p: busy:%d reason:%s", context, impl->recalc, reason); | ||||||
| 
 | 
 | ||||||
| 	if (impl->recalc) { | 	if (impl->recalc) { | ||||||
| 		impl->recalc_pending = true; | 		impl->recalc_pending = true; | ||||||
|  | @ -1189,7 +1190,7 @@ again: | ||||||
| 			continue; | 			continue; | ||||||
| 
 | 
 | ||||||
| 		spa_list_for_each(s, &n->follower_list, follower_link) { | 		spa_list_for_each(s, &n->follower_list, follower_link) { | ||||||
| 			pw_log_debug(NAME" %p: driver %p: follower %p %s: active:%d", | 			pw_log_debug("%p: driver %p: follower %p %s: active:%d", | ||||||
| 					context, n, s, s->name, s->active); | 					context, n, s, s->name, s->active); | ||||||
| 			if (s != n && s->active) { | 			if (s != n && s->active) { | ||||||
| 				/* if the driving node has active followers, it
 | 				/* if the driving node has active followers, it
 | ||||||
|  | @ -1220,7 +1221,7 @@ again: | ||||||
| 		if (!n->visited) { | 		if (!n->visited) { | ||||||
| 			struct pw_impl_node *t; | 			struct pw_impl_node *t; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: unassigned node %p: '%s' active:%d want_driver:%d target:%p", | 			pw_log_debug("%p: unassigned node %p: '%s' active:%d want_driver:%d target:%p", | ||||||
| 					context, n, n->name, n->active, n->want_driver, target); | 					context, n, n->name, n->active, n->want_driver, target); | ||||||
| 
 | 
 | ||||||
| 			t = n->want_driver ? target : NULL; | 			t = n->want_driver ? target : NULL; | ||||||
|  | @ -1338,13 +1339,13 @@ again: | ||||||
| 			n->rt.position->clock.duration = quantum; | 			n->rt.position->clock.duration = quantum; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: driving %p running:%d passive:%d quantum:%u '%s'", | 		pw_log_debug("%p: driving %p running:%d passive:%d quantum:%u '%s'", | ||||||
| 				context, n, running, n->passive, quantum, n->name); | 				context, n, running, n->passive, quantum, n->name); | ||||||
| 
 | 
 | ||||||
| 		spa_list_for_each(s, &n->follower_list, follower_link) { | 		spa_list_for_each(s, &n->follower_list, follower_link) { | ||||||
| 			if (s == n) | 			if (s == n) | ||||||
| 				continue; | 				continue; | ||||||
| 			pw_log_debug(NAME" %p: follower %p: active:%d '%s'", | 			pw_log_debug("%p: follower %p: active:%d '%s'", | ||||||
| 					context, s, s->active, s->name); | 					context, s, s->active, s->name); | ||||||
| 			ensure_state(s, running); | 			ensure_state(s, running); | ||||||
| 		} | 		} | ||||||
|  | @ -1373,13 +1374,13 @@ int pw_context_add_spa_lib(struct pw_context *context, | ||||||
| 	if ((err = regcomp(&entry->regex, factory_regexp, REG_EXTENDED | REG_NOSUB)) != 0) { | 	if ((err = regcomp(&entry->regex, factory_regexp, REG_EXTENDED | REG_NOSUB)) != 0) { | ||||||
| 		char errbuf[1024]; | 		char errbuf[1024]; | ||||||
| 		regerror(err, &entry->regex, errbuf, sizeof(errbuf)); | 		regerror(err, &entry->regex, errbuf, sizeof(errbuf)); | ||||||
| 		pw_log_error(NAME" %p: can compile regex: %s", context, errbuf); | 		pw_log_error("%p: can compile regex: %s", context, errbuf); | ||||||
| 		pw_array_remove(&context->factory_lib, entry); | 		pw_array_remove(&context->factory_lib, entry); | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	entry->lib = strdup(lib); | 	entry->lib = strdup(lib); | ||||||
| 	pw_log_debug(NAME" %p: map factory regex '%s' to '%s", context, | 	pw_log_debug("%p: map factory regex '%s' to '%s", context, | ||||||
| 			factory_regexp, lib); | 			factory_regexp, lib); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -1406,14 +1407,14 @@ struct spa_handle *pw_context_load_spa_handle(struct pw_context *context, | ||||||
| 	uint32_t n_support; | 	uint32_t n_support; | ||||||
| 	struct spa_handle *handle; | 	struct spa_handle *handle; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: load factory %s", context, factory_name); | 	pw_log_debug("%p: load factory %s", context, factory_name); | ||||||
| 
 | 
 | ||||||
| 	lib = pw_context_find_spa_lib(context, factory_name); | 	lib = pw_context_find_spa_lib(context, factory_name); | ||||||
| 	if (lib == NULL && info != NULL) | 	if (lib == NULL && info != NULL) | ||||||
| 		lib = spa_dict_lookup(info, SPA_KEY_LIBRARY_NAME); | 		lib = spa_dict_lookup(info, SPA_KEY_LIBRARY_NAME); | ||||||
| 	if (lib == NULL) { | 	if (lib == NULL) { | ||||||
| 		errno = ENOENT; | 		errno = ENOENT; | ||||||
| 		pw_log_warn(NAME" %p: no library for %s: %m", | 		pw_log_warn("%p: no library for %s: %m", | ||||||
| 				context, factory_name); | 				context, factory_name); | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -37,12 +37,13 @@ | ||||||
| 
 | 
 | ||||||
| #include "pipewire/extensions/protocol-native.h" | #include "pipewire/extensions/protocol-native.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "core" | PW_LOG_TOPIC_EXTERN(log_core); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_core | ||||||
| 
 | 
 | ||||||
| static void core_event_ping(void *data, uint32_t id, int seq) | static void core_event_ping(void *data, uint32_t id, int seq) | ||||||
| { | { | ||||||
| 	struct pw_core *this = data; | 	struct pw_core *this = data; | ||||||
| 	pw_log_debug(NAME" %p: object %u ping %u", this, id, seq); | 	pw_log_debug("%p: object %u ping %u", this, id, seq); | ||||||
| 	pw_core_pong(this->core, id, seq); | 	pw_core_pong(this->core, id, seq); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -51,7 +52,7 @@ static void core_event_done(void *data, uint32_t id, int seq) | ||||||
| 	struct pw_core *this = data; | 	struct pw_core *this = data; | ||||||
| 	struct pw_proxy *proxy; | 	struct pw_proxy *proxy; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: object %u done %d", this, id, seq); | 	pw_log_trace("%p: object %u done %d", this, id, seq); | ||||||
| 
 | 
 | ||||||
| 	proxy = pw_map_lookup(&this->objects, id); | 	proxy = pw_map_lookup(&this->objects, id); | ||||||
| 	if (proxy) | 	if (proxy) | ||||||
|  | @ -65,7 +66,7 @@ static void core_event_error(void *data, uint32_t id, int seq, int res, const ch | ||||||
| 
 | 
 | ||||||
| 	proxy = pw_map_lookup(&this->objects, id); | 	proxy = pw_map_lookup(&this->objects, id); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: proxy %p id:%u: bound:%d seq:%d res:%d (%s) msg:\"%s\"", | 	pw_log_debug("%p: proxy %p id:%u: bound:%d seq:%d res:%d (%s) msg:\"%s\"", | ||||||
| 			this, proxy, id, proxy ? proxy->bound_id : SPA_ID_INVALID, | 			this, proxy, id, proxy ? proxy->bound_id : SPA_ID_INVALID, | ||||||
| 			seq, res, spa_strerror(res), message); | 			seq, res, spa_strerror(res), message); | ||||||
| 	if (proxy) | 	if (proxy) | ||||||
|  | @ -77,7 +78,7 @@ static void core_event_remove_id(void *data, uint32_t id) | ||||||
| 	struct pw_core *this = data; | 	struct pw_core *this = data; | ||||||
| 	struct pw_proxy *proxy; | 	struct pw_proxy *proxy; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: object remove %u", this, id); | 	pw_log_debug("%p: object remove %u", this, id); | ||||||
| 	if ((proxy = pw_map_lookup(&this->objects, id)) != NULL) | 	if ((proxy = pw_map_lookup(&this->objects, id)) != NULL) | ||||||
| 		pw_proxy_remove(proxy); | 		pw_proxy_remove(proxy); | ||||||
| } | } | ||||||
|  | @ -87,7 +88,7 @@ static void core_event_bound_id(void *data, uint32_t id, uint32_t global_id) | ||||||
| 	struct pw_core *this = data; | 	struct pw_core *this = data; | ||||||
| 	struct pw_proxy *proxy; | 	struct pw_proxy *proxy; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: proxy id %u bound %u", this, id, global_id); | 	pw_log_debug("%p: proxy id %u bound %u", this, id, global_id); | ||||||
| 	if ((proxy = pw_map_lookup(&this->objects, id)) != NULL) { | 	if ((proxy = pw_map_lookup(&this->objects, id)) != NULL) { | ||||||
| 		pw_proxy_set_bound_id(proxy, global_id); | 		pw_proxy_set_bound_id(proxy, global_id); | ||||||
| 	} | 	} | ||||||
|  | @ -98,11 +99,11 @@ static void core_event_add_mem(void *data, uint32_t id, uint32_t type, int fd, u | ||||||
| 	struct pw_core *this = data; | 	struct pw_core *this = data; | ||||||
| 	struct pw_memblock *m; | 	struct pw_memblock *m; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: add mem %u type:%u fd:%d flags:%u", this, id, type, fd, flags); | 	pw_log_debug("%p: add mem %u type:%u fd:%d flags:%u", this, id, type, fd, flags); | ||||||
| 
 | 
 | ||||||
| 	m = pw_mempool_import(this->pool, flags, type, fd); | 	m = pw_mempool_import(this->pool, flags, type, fd); | ||||||
| 	if (m->id != id) { | 	if (m->id != id) { | ||||||
| 		pw_log_error(NAME" %p: invalid mem id %u, fd:%d expected %u", | 		pw_log_error("%p: invalid mem id %u, fd:%d expected %u", | ||||||
| 				this, id, fd, m->id); | 				this, id, fd, m->id); | ||||||
| 		pw_proxy_errorf(&this->proxy, -EINVAL, "invalid mem id %u, expected %u", id, m->id); | 		pw_proxy_errorf(&this->proxy, -EINVAL, "invalid mem id %u, expected %u", id, m->id); | ||||||
| 		pw_memblock_unref(m); | 		pw_memblock_unref(m); | ||||||
|  | @ -112,7 +113,7 @@ static void core_event_add_mem(void *data, uint32_t id, uint32_t type, int fd, u | ||||||
| static void core_event_remove_mem(void *data, uint32_t id) | static void core_event_remove_mem(void *data, uint32_t id) | ||||||
| { | { | ||||||
| 	struct pw_core *this = data; | 	struct pw_core *this = data; | ||||||
| 	pw_log_debug(NAME" %p: remove mem %u", this, id); | 	pw_log_debug("%p: remove mem %u", this, id); | ||||||
| 	pw_mempool_remove_id(this->pool, id); | 	pw_mempool_remove_id(this->pool, id); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -146,7 +147,7 @@ int pw_core_update_properties(struct pw_core *core, const struct spa_dict *dict) | ||||||
| 
 | 
 | ||||||
| 	changed = pw_properties_update(core->properties, dict); | 	changed = pw_properties_update(core->properties, dict); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", core, changed); | 	pw_log_debug("%p: updated %d properties", core, changed); | ||||||
| 
 | 
 | ||||||
| 	if (!changed) | 	if (!changed) | ||||||
| 		return 0; | 		return 0; | ||||||
|  | @ -186,7 +187,7 @@ static int destroy_proxy(void *object, void *data) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	if (object != core) { | 	if (object != core) { | ||||||
| 		pw_log_warn(NAME" %p: leaked proxy %p id:%d", core, p, p->id); | 		pw_log_warn("%p: leaked proxy %p id:%d", core, p, p->id); | ||||||
| 		p->core = NULL; | 		p->core = NULL; | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -203,7 +204,7 @@ static void proxy_core_removed(void *data) | ||||||
| 
 | 
 | ||||||
| 	core->removed = true; | 	core->removed = true; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: core proxy removed", core); | 	pw_log_debug("%p: core proxy removed", core); | ||||||
| 	spa_list_remove(&core->link); | 	spa_list_remove(&core->link); | ||||||
| 
 | 
 | ||||||
| 	spa_list_for_each_safe(stream, s2, &core->stream_list, link) | 	spa_list_for_each_safe(stream, s2, &core->stream_list, link) | ||||||
|  | @ -225,7 +226,7 @@ static void proxy_core_destroy(void *data) | ||||||
| 
 | 
 | ||||||
| 	core->destroyed = true; | 	core->destroyed = true; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: core proxy destroy", core); | 	pw_log_debug("%p: core proxy destroy", core); | ||||||
| 
 | 
 | ||||||
| 	spa_list_consume(stream, &core->stream_list, link) | 	spa_list_consume(stream, &core->stream_list, link) | ||||||
| 		pw_stream_destroy(stream); | 		pw_stream_destroy(stream); | ||||||
|  | @ -245,7 +246,7 @@ static void proxy_core_destroy(void *data) | ||||||
| 
 | 
 | ||||||
| 	pw_map_clear(&core->objects); | 	pw_map_clear(&core->objects); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free", core); | 	pw_log_debug("%p: free", core); | ||||||
| 	pw_properties_free(core->properties); | 	pw_properties_free(core->properties); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_remove(&core->core_listener); | 	spa_hook_remove(&core->core_listener); | ||||||
|  | @ -290,14 +291,14 @@ struct pw_proxy *pw_core_export(struct pw_core *core, | ||||||
| 		res = -errno; | 		res = -errno; | ||||||
| 		goto error_proxy_failed; | 		goto error_proxy_failed; | ||||||
| 	} | 	} | ||||||
| 	pw_log_debug(NAME" %p: export:%s proxy:%p", core, type, proxy); | 	pw_log_debug("%p: export:%s proxy:%p", core, type, proxy); | ||||||
| 	return proxy; | 	return proxy; | ||||||
| 
 | 
 | ||||||
| error_export_type: | error_export_type: | ||||||
| 	pw_log_error(NAME" %p: can't export type %s: %s", core, type, spa_strerror(res)); | 	pw_log_error("%p: can't export type %s: %s", core, type, spa_strerror(res)); | ||||||
| 	goto exit; | 	goto exit; | ||||||
| error_proxy_failed: | error_proxy_failed: | ||||||
| 	pw_log_error(NAME" %p: failed to create proxy: %s", core, spa_strerror(res)); | 	pw_log_error("%p: failed to create proxy: %s", core, spa_strerror(res)); | ||||||
| 	goto exit; | 	goto exit; | ||||||
| exit: | exit: | ||||||
| 	errno = -res; | 	errno = -res; | ||||||
|  | @ -317,7 +318,7 @@ static struct pw_core *core_new(struct pw_context *context, | ||||||
| 		res = -errno; | 		res = -errno; | ||||||
| 		goto exit_cleanup; | 		goto exit_cleanup; | ||||||
| 	} | 	} | ||||||
| 	pw_log_debug(NAME" %p: new", p); | 	pw_log_debug("%p: new", p); | ||||||
| 
 | 
 | ||||||
| 	if (properties == NULL) | 	if (properties == NULL) | ||||||
| 		properties = pw_properties_new(NULL, NULL); | 		properties = pw_properties_new(NULL, NULL); | ||||||
|  | @ -375,17 +376,17 @@ static struct pw_core *core_new(struct pw_context *context, | ||||||
| 
 | 
 | ||||||
| error_properties: | error_properties: | ||||||
| 	res = -errno; | 	res = -errno; | ||||||
| 	pw_log_error(NAME" %p: can't create properties: %m", p); | 	pw_log_error("%p: can't create properties: %m", p); | ||||||
| 	goto exit_free; | 	goto exit_free; | ||||||
| error_protocol: | error_protocol: | ||||||
| 	pw_log_error(NAME" %p: can't find protocol '%s': %s", p, protocol_name, spa_strerror(res)); | 	pw_log_error("%p: can't find protocol '%s': %s", p, protocol_name, spa_strerror(res)); | ||||||
| 	goto exit_free; | 	goto exit_free; | ||||||
| error_connection: | error_connection: | ||||||
| 	res = -errno; | 	res = -errno; | ||||||
| 	pw_log_error(NAME" %p: can't create new native protocol connection: %m", p); | 	pw_log_error("%p: can't create new native protocol connection: %m", p); | ||||||
| 	goto exit_free; | 	goto exit_free; | ||||||
| error_proxy: | error_proxy: | ||||||
| 	pw_log_error(NAME" %p: can't initialize proxy: %s", p, spa_strerror(res)); | 	pw_log_error("%p: can't initialize proxy: %s", p, spa_strerror(res)); | ||||||
| 	goto exit_free; | 	goto exit_free; | ||||||
| 
 | 
 | ||||||
| exit_free: | exit_free: | ||||||
|  | @ -408,7 +409,7 @@ pw_context_connect(struct pw_context *context, struct pw_properties *properties, | ||||||
| 	if (core == NULL) | 	if (core == NULL) | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: connect", core); | 	pw_log_debug("%p: connect", core); | ||||||
| 
 | 
 | ||||||
| 	if ((res = pw_protocol_client_connect(core->conn, | 	if ((res = pw_protocol_client_connect(core->conn, | ||||||
| 					&core->properties->dict, | 					&core->properties->dict, | ||||||
|  | @ -435,7 +436,7 @@ pw_context_connect_fd(struct pw_context *context, int fd, struct pw_properties * | ||||||
| 	if (core == NULL) | 	if (core == NULL) | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: connect fd:%d", core, fd); | 	pw_log_debug("%p: connect fd:%d", core, fd); | ||||||
| 
 | 
 | ||||||
| 	if ((res = pw_protocol_client_connect_fd(core->conn, fd, true)) < 0) | 	if ((res = pw_protocol_client_connect_fd(core->conn, fd, true)) < 0) | ||||||
| 		goto error_free; | 		goto error_free; | ||||||
|  | @ -467,14 +468,14 @@ SPA_EXPORT | ||||||
| int pw_core_steal_fd(struct pw_core *core) | int pw_core_steal_fd(struct pw_core *core) | ||||||
| { | { | ||||||
| 	int fd = pw_protocol_client_steal_fd(core->conn); | 	int fd = pw_protocol_client_steal_fd(core->conn); | ||||||
| 	pw_log_debug(NAME" %p: fd:%d", core, fd); | 	pw_log_debug("%p: fd:%d", core, fd); | ||||||
| 	return fd; | 	return fd; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| SPA_EXPORT | SPA_EXPORT | ||||||
| int pw_core_set_paused(struct pw_core *core, bool paused) | int pw_core_set_paused(struct pw_core *core, bool paused) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: state:%s", core, paused ? "pause" : "resume"); | 	pw_log_debug("%p: state:%s", core, paused ? "pause" : "resume"); | ||||||
| 	return pw_protocol_client_set_paused(core->conn, paused); | 	return pw_protocol_client_set_paused(core->conn, paused); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -487,7 +488,7 @@ struct pw_mempool * pw_core_get_mempool(struct pw_core *core) | ||||||
| SPA_EXPORT | SPA_EXPORT | ||||||
| int pw_core_disconnect(struct pw_core *core) | int pw_core_disconnect(struct pw_core *core) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: disconnect", core); | 	pw_log_debug("%p: disconnect", core); | ||||||
| 	pw_proxy_remove(&core->proxy); | 	pw_proxy_remove(&core->proxy); | ||||||
| 	pw_proxy_destroy(&core->proxy); | 	pw_proxy_destroy(&core->proxy); | ||||||
| 	return 0; | 	return 0; | ||||||
|  |  | ||||||
|  | @ -33,7 +33,8 @@ | ||||||
| #include <spa/debug/types.h> | #include <spa/debug/types.h> | ||||||
| #include <spa/utils/string.h> | #include <spa/utils/string.h> | ||||||
| 
 | 
 | ||||||
| #define NAME "global" | PW_LOG_TOPIC_EXTERN(log_global); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_global | ||||||
| 
 | 
 | ||||||
| /** \cond */ | /** \cond */ | ||||||
| struct impl { | struct impl { | ||||||
|  | @ -96,14 +97,14 @@ pw_global_new(struct pw_context *context, | ||||||
| 	this->id = pw_map_insert_new(&context->globals, this); | 	this->id = pw_map_insert_new(&context->globals, this); | ||||||
| 	if (this->id == SPA_ID_INVALID) { | 	if (this->id == SPA_ID_INVALID) { | ||||||
| 		res = -errno; | 		res = -errno; | ||||||
| 		pw_log_error(NAME" %p: can't allocate new id: %m", this); | 		pw_log_error("%p: can't allocate new id: %m", this); | ||||||
| 		goto error_free; | 		goto error_free; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	spa_list_init(&this->resource_list); | 	spa_list_init(&this->resource_list); | ||||||
| 	spa_hook_list_init(&this->listener_list); | 	spa_hook_list_init(&this->listener_list); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new %s %d", this, this->type, this->id); | 	pw_log_debug("%p: new %s %d", this, this->type, this->id); | ||||||
| 
 | 
 | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
|  | @ -145,7 +146,7 @@ int pw_global_register(struct pw_global *global) | ||||||
| 						    &global->properties->dict); | 						    &global->properties->dict); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: registered %u", global, global->id); | 	pw_log_debug("%p: registered %u", global, global->id); | ||||||
| 	pw_context_emit_global_added(context, global); | 	pw_context_emit_global_added(context, global); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -169,7 +170,7 @@ static int global_unregister(struct pw_global *global) | ||||||
| 	spa_list_remove(&global->link); | 	spa_list_remove(&global->link); | ||||||
| 	global->registered = false; | 	global->registered = false; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: unregistered %u", global, global->id); | 	pw_log_debug("%p: unregistered %u", global, global->id); | ||||||
| 	pw_context_emit_global_removed(context, global); | 	pw_context_emit_global_removed(context, global); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -230,7 +231,7 @@ SPA_EXPORT | ||||||
| int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource) | int pw_global_add_resource(struct pw_global *global, struct pw_resource *resource) | ||||||
| { | { | ||||||
| 	resource->global = global; | 	resource->global = global; | ||||||
| 	pw_log_debug(NAME" %p: resource %p id:%d global:%d", global, resource, | 	pw_log_debug("%p: resource %p id:%d global:%d", global, resource, | ||||||
| 			resource->id, global->id); | 			resource->id, global->id); | ||||||
| 	spa_list_append(&global->resource_list, &resource->link); | 	spa_list_append(&global->resource_list, &resource->link); | ||||||
| 	pw_resource_set_bound_id(resource, global->id); | 	pw_resource_set_bound_id(resource, global->id); | ||||||
|  | @ -302,7 +303,7 @@ error_bind: | ||||||
| 	goto error_exit; | 	goto error_exit; | ||||||
| 
 | 
 | ||||||
| error_exit: | error_exit: | ||||||
| 	pw_log_error(NAME" %p: can't bind global %u/%u: %d (%s)", global, id, | 	pw_log_error("%p: can't bind global %u/%u: %d (%s)", global, id, | ||||||
| 			version, res, spa_strerror(res)); | 			version, res, spa_strerror(res)); | ||||||
| 	pw_map_insert_at(&client->objects, id, NULL); | 	pw_map_insert_at(&client->objects, id, NULL); | ||||||
| 	if (client->core_resource) | 	if (client->core_resource) | ||||||
|  | @ -321,7 +322,7 @@ int pw_global_update_permissions(struct pw_global *global, struct pw_impl_client | ||||||
| 	do_hide = PW_PERM_IS_R(old_permissions) && !PW_PERM_IS_R(new_permissions); | 	do_hide = PW_PERM_IS_R(old_permissions) && !PW_PERM_IS_R(new_permissions); | ||||||
| 	do_show = !PW_PERM_IS_R(old_permissions) && PW_PERM_IS_R(new_permissions); | 	do_show = !PW_PERM_IS_R(old_permissions) && PW_PERM_IS_R(new_permissions); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: client %p permissions changed %d %08x -> %08x", | 	pw_log_debug("%p: client %p permissions changed %d %08x -> %08x", | ||||||
| 			global, client, global->id, old_permissions, new_permissions); | 			global, client, global->id, old_permissions, new_permissions); | ||||||
| 
 | 
 | ||||||
| 	pw_global_emit_permissions_changed(global, client, old_permissions, new_permissions); | 	pw_global_emit_permissions_changed(global, client, old_permissions, new_permissions); | ||||||
|  | @ -373,7 +374,7 @@ void pw_global_destroy(struct pw_global *global) | ||||||
| 
 | 
 | ||||||
| 	global->destroyed = true; | 	global->destroyed = true; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy %u", global, global->id); | 	pw_log_debug("%p: destroy %u", global, global->id); | ||||||
| 	pw_global_emit_destroy(global); | 	pw_global_emit_destroy(global); | ||||||
| 
 | 
 | ||||||
| 	spa_list_consume(resource, &global->resource_list, link) | 	spa_list_consume(resource, &global->resource_list, link) | ||||||
|  | @ -381,7 +382,7 @@ void pw_global_destroy(struct pw_global *global) | ||||||
| 
 | 
 | ||||||
| 	global_unregister(global); | 	global_unregister(global); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free", global); | 	pw_log_debug("%p: free", global); | ||||||
| 	pw_global_emit_free(global); | 	pw_global_emit_free(global); | ||||||
| 
 | 
 | ||||||
| 	pw_map_remove(&context->globals, global->id); | 	pw_map_remove(&context->globals, global->id); | ||||||
|  |  | ||||||
|  | @ -30,7 +30,8 @@ | ||||||
| #include "pipewire/impl.h" | #include "pipewire/impl.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "client" | PW_LOG_TOPIC_EXTERN(log_client); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_client | ||||||
| 
 | 
 | ||||||
| /** \cond */ | /** \cond */ | ||||||
| struct impl { | struct impl { | ||||||
|  | @ -130,7 +131,7 @@ static int client_error(void *object, uint32_t id, int res, const char *error) | ||||||
| 	struct pw_impl_client *client = data->client; | 	struct pw_impl_client *client = data->client; | ||||||
| 	struct error_data d = { id, res, error }; | 	struct error_data d = { id, res, error }; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: error for global %d", client, id); | 	pw_log_debug("%p: error for global %d", client, id); | ||||||
| 	pw_map_for_each(&client->objects, error_resource, &d); | 	pw_map_for_each(&client->objects, error_resource, &d); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -162,7 +163,7 @@ static int update_properties(struct pw_impl_client *client, const struct spa_dic | ||||||
| 			if (spa_strstartswith(dict->items[i].key, "pipewire.") && | 			if (spa_strstartswith(dict->items[i].key, "pipewire.") && | ||||||
| 			    (old = pw_properties_get(client->properties, dict->items[i].key)) != NULL && | 			    (old = pw_properties_get(client->properties, dict->items[i].key)) != NULL && | ||||||
| 			    (dict->items[i].value == NULL || !spa_streq(old, dict->items[i].value))) { | 			    (dict->items[i].value == NULL || !spa_streq(old, dict->items[i].value))) { | ||||||
| 				pw_log_warn(NAME" %p: refuse property update '%s' from '%s' to '%s'", | 				pw_log_warn("%p: refuse property update '%s' from '%s' to '%s'", | ||||||
| 						client, dict->items[i].key, old, | 						client, dict->items[i].key, old, | ||||||
| 						dict->items[i].value); | 						dict->items[i].value); | ||||||
| 				continue; | 				continue; | ||||||
|  | @ -175,7 +176,7 @@ static int update_properties(struct pw_impl_client *client, const struct spa_dic | ||||||
| 	} | 	} | ||||||
| 	client->info.props = &client->properties->dict; | 	client->info.props = &client->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", client, changed); | 	pw_log_debug("%p: updated %d properties", client, changed); | ||||||
| 
 | 
 | ||||||
| 	if (!changed) | 	if (!changed) | ||||||
| 		return 0; | 		return 0; | ||||||
|  | @ -312,7 +313,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 			&data->object_listener, | 			&data->object_listener, | ||||||
| 			&client_methods, data); | 			&client_methods, data); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 	pw_global_add_resource(global, resource); | 	pw_global_add_resource(global, resource); | ||||||
| 
 | 
 | ||||||
| 	if (resource->id == 1) | 	if (resource->id == 1) | ||||||
|  | @ -325,7 +326,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error_resource: | error_resource: | ||||||
| 	pw_log_error(NAME" %p: can't create client resource: %m", this); | 	pw_log_error("%p: can't create client resource: %m", this); | ||||||
| 	return -errno; | 	return -errno; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -334,7 +335,7 @@ static void pool_added(void *data, struct pw_memblock *block) | ||||||
| 	struct impl *impl = data; | 	struct impl *impl = data; | ||||||
| 	struct pw_impl_client *client = &impl->this; | 	struct pw_impl_client *client = &impl->this; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: added block %d", client, block->id); | 	pw_log_debug("%p: added block %d", client, block->id); | ||||||
| 	if (client->core_resource) { | 	if (client->core_resource) { | ||||||
| 		pw_core_resource_add_mem(client->core_resource, | 		pw_core_resource_add_mem(client->core_resource, | ||||||
| 				block->id, block->type, block->fd, | 				block->id, block->type, block->fd, | ||||||
|  | @ -346,7 +347,7 @@ static void pool_removed(void *data, struct pw_memblock *block) | ||||||
| { | { | ||||||
| 	struct impl *impl = data; | 	struct impl *impl = data; | ||||||
| 	struct pw_impl_client *client = &impl->this; | 	struct pw_impl_client *client = &impl->this; | ||||||
| 	pw_log_debug(NAME" %p: removed block %d", client, block->id); | 	pw_log_debug("%p: removed block %d", client, block->id); | ||||||
| 	if (client->core_resource) | 	if (client->core_resource) | ||||||
| 		pw_core_resource_remove_mem(client->core_resource, block->id); | 		pw_core_resource_remove_mem(client->core_resource, block->id); | ||||||
| } | } | ||||||
|  | @ -365,7 +366,7 @@ context_global_removed(void *data, struct pw_global *global) | ||||||
| 	struct pw_permission *p; | 	struct pw_permission *p; | ||||||
| 
 | 
 | ||||||
| 	p = find_permission(client, global->id); | 	p = find_permission(client, global->id); | ||||||
| 	pw_log_debug(NAME" %p: global %d removed, %p", client, global->id, p); | 	pw_log_debug("%p: global %d removed, %p", client, global->id, p); | ||||||
| 	if (p->id != PW_ID_ANY) | 	if (p->id != PW_ID_ANY) | ||||||
| 		p->permissions = PW_PERM_INVALID; | 		p->permissions = PW_PERM_INVALID; | ||||||
| } | } | ||||||
|  | @ -400,7 +401,7 @@ struct pw_impl_client *pw_context_create_client(struct pw_impl_core *core, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	this = &impl->this; | 	this = &impl->this; | ||||||
| 	pw_log_debug(NAME" %p: new", this); | 	pw_log_debug("%p: new", this); | ||||||
| 
 | 
 | ||||||
| 	this->context = core->context; | 	this->context = core->context; | ||||||
| 	this->core = core; | 	this->core = core; | ||||||
|  | @ -488,7 +489,7 @@ int pw_impl_client_register(struct pw_impl_client *client, | ||||||
| 	if (client->registered) | 	if (client->registered) | ||||||
| 		goto error_existed; | 		goto error_existed; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: register", client); | 	pw_log_debug("%p: register", client); | ||||||
| 
 | 
 | ||||||
| 	client->global = pw_global_new(context, | 	client->global = pw_global_new(context, | ||||||
| 				       PW_TYPE_INTERFACE_Client, | 				       PW_TYPE_INTERFACE_Client, | ||||||
|  | @ -578,7 +579,7 @@ void pw_impl_client_destroy(struct pw_impl_client *client) | ||||||
| { | { | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(client, struct impl, this); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", client); | 	pw_log_debug("%p: destroy", client); | ||||||
| 	pw_impl_client_emit_destroy(client); | 	pw_impl_client_emit_destroy(client); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_remove(&impl->context_listener); | 	spa_hook_remove(&impl->context_listener); | ||||||
|  | @ -593,7 +594,7 @@ void pw_impl_client_destroy(struct pw_impl_client *client) | ||||||
| 		pw_global_destroy(client->global); | 		pw_global_destroy(client->global); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free", impl); | 	pw_log_debug("%p: free", impl); | ||||||
| 	pw_impl_client_emit_free(client); | 	pw_impl_client_emit_free(client); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_clean(&client->listener_list); | 	spa_hook_list_clean(&client->listener_list); | ||||||
|  | @ -666,7 +667,7 @@ int pw_impl_client_update_permissions(struct pw_impl_client *client, | ||||||
| 			if (context->current_client == client) | 			if (context->current_client == client) | ||||||
| 				new_perm &= old_perm; | 				new_perm &= old_perm; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: set default permissions %08x -> %08x", | 			pw_log_debug("%p: set default permissions %08x -> %08x", | ||||||
| 					client, old_perm, new_perm); | 					client, old_perm, new_perm); | ||||||
| 
 | 
 | ||||||
| 			def->permissions = new_perm; | 			def->permissions = new_perm; | ||||||
|  | @ -685,12 +686,12 @@ int pw_impl_client_update_permissions(struct pw_impl_client *client, | ||||||
| 
 | 
 | ||||||
| 			global = pw_context_find_global(context, permissions[i].id); | 			global = pw_context_find_global(context, permissions[i].id); | ||||||
| 			if (global == NULL || global->id != permissions[i].id) { | 			if (global == NULL || global->id != permissions[i].id) { | ||||||
| 				pw_log_warn(NAME" %p: invalid global %d", client, permissions[i].id); | 				pw_log_warn("%p: invalid global %d", client, permissions[i].id); | ||||||
| 				continue; | 				continue; | ||||||
| 			} | 			} | ||||||
| 			p = ensure_permissions(client, permissions[i].id); | 			p = ensure_permissions(client, permissions[i].id); | ||||||
| 			if (p == NULL) { | 			if (p == NULL) { | ||||||
| 				pw_log_warn(NAME" %p: can't ensure permission: %m", client); | 				pw_log_warn("%p: can't ensure permission: %m", client); | ||||||
| 				return -errno; | 				return -errno; | ||||||
| 			} | 			} | ||||||
| 			if ((def = find_permission(client, PW_ID_ANY)) == NULL) | 			if ((def = find_permission(client, PW_ID_ANY)) == NULL) | ||||||
|  | @ -701,7 +702,7 @@ int pw_impl_client_update_permissions(struct pw_impl_client *client, | ||||||
| 			if (context->current_client == client) | 			if (context->current_client == client) | ||||||
| 				new_perm &= old_perm; | 				new_perm &= old_perm; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: set global %d permissions %08x -> %08x", | 			pw_log_debug("%p: set global %d permissions %08x -> %08x", | ||||||
| 					client, global->id, old_perm, new_perm); | 					client, global->id, old_perm, new_perm); | ||||||
| 
 | 
 | ||||||
| 			p->permissions = new_perm; | 			p->permissions = new_perm; | ||||||
|  | @ -716,7 +717,7 @@ SPA_EXPORT | ||||||
| void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy) | void pw_impl_client_set_busy(struct pw_impl_client *client, bool busy) | ||||||
| { | { | ||||||
| 	if (client->busy != busy) { | 	if (client->busy != busy) { | ||||||
| 		pw_log_debug(NAME" %p: busy %d", client, busy); | 		pw_log_debug("%p: busy %d", client, busy); | ||||||
| 		client->busy = busy; | 		client->busy = busy; | ||||||
| 		pw_impl_client_emit_busy_changed(client, busy); | 		pw_impl_client_emit_busy_changed(client, busy); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -69,7 +69,8 @@ ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) { | ||||||
| 
 | 
 | ||||||
| #include "pipewire/extensions/protocol-native.h" | #include "pipewire/extensions/protocol-native.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "impl-core" | PW_LOG_TOPIC_EXTERN(log_core); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_core | ||||||
| 
 | 
 | ||||||
| struct resource_data { | struct resource_data { | ||||||
| 	struct pw_resource *resource; | 	struct pw_resource *resource; | ||||||
|  | @ -202,7 +203,7 @@ static int core_hello(void *object, uint32_t version) | ||||||
| 	struct pw_impl_core *this = client->core; | 	struct pw_impl_core *this = client->core; | ||||||
| 	int res; | 	int res; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: hello %d from resource %p", context, version, resource); | 	pw_log_debug("%p: hello %d from resource %p", context, version, resource); | ||||||
| 	pw_map_for_each(&client->objects, destroy_resource, client); | 	pw_map_for_each(&client->objects, destroy_resource, client); | ||||||
| 
 | 
 | ||||||
| 	pw_mempool_clear(client->pool); | 	pw_mempool_clear(client->pool); | ||||||
|  | @ -221,7 +222,7 @@ static int core_hello(void *object, uint32_t version) | ||||||
| static int core_sync(void *object, uint32_t id, int seq) | static int core_sync(void *object, uint32_t id, int seq) | ||||||
| { | { | ||||||
| 	struct pw_resource *resource = object; | 	struct pw_resource *resource = object; | ||||||
| 	pw_log_trace(NAME" %p: sync %d for resource %d", resource->context, seq, id); | 	pw_log_trace("%p: sync %d for resource %d", resource->context, seq, id); | ||||||
| 	pw_core_resource_done(resource, id, seq); | 	pw_core_resource_done(resource, id, seq); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -232,7 +233,7 @@ static int core_pong(void *object, uint32_t id, int seq) | ||||||
| 	struct pw_impl_client *client = resource->client; | 	struct pw_impl_client *client = resource->client; | ||||||
| 	struct pw_resource *r; | 	struct pw_resource *r; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: pong %d for resource %d", resource->context, seq, id); | 	pw_log_debug("%p: pong %d for resource %d", resource->context, seq, id); | ||||||
| 
 | 
 | ||||||
| 	if ((r = pw_impl_client_find_resource(client, id)) == NULL) | 	if ((r = pw_impl_client_find_resource(client, id)) == NULL) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
|  | @ -247,7 +248,7 @@ static int core_error(void *object, uint32_t id, int seq, int res, const char *m | ||||||
| 	struct pw_impl_client *client = resource->client; | 	struct pw_impl_client *client = resource->client; | ||||||
| 	struct pw_resource *r; | 	struct pw_resource *r; | ||||||
| 
 | 
 | ||||||
| 	pw_log_error(NAME" %p: error %d for resource %d: %s", resource->context, res, id, message); | 	pw_log_error("%p: error %d for resource %d: %s", resource->context, res, id, message); | ||||||
| 
 | 
 | ||||||
| 	if ((r = pw_impl_client_find_resource(client, id)) == NULL) | 	if ((r = pw_impl_client_find_resource(client, id)) == NULL) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
|  | @ -362,18 +363,18 @@ core_create_object(void *object, | ||||||
| 
 | 
 | ||||||
| error_no_factory: | error_no_factory: | ||||||
| 	res = -ENOENT; | 	res = -ENOENT; | ||||||
| 	pw_log_debug(NAME" %p: can't find factory '%s'", context, factory_name); | 	pw_log_debug("%p: can't find factory '%s'", context, factory_name); | ||||||
| 	pw_resource_errorf_id(resource, new_id, res, "unknown factory name %s", factory_name); | 	pw_resource_errorf_id(resource, new_id, res, "unknown factory name %s", factory_name); | ||||||
| 	goto error_exit; | 	goto error_exit; | ||||||
| error_version: | error_version: | ||||||
| error_type: | error_type: | ||||||
| 	res = -EPROTO; | 	res = -EPROTO; | ||||||
| 	pw_log_debug(NAME" %p: invalid resource type/version", context); | 	pw_log_debug("%p: invalid resource type/version", context); | ||||||
| 	pw_resource_errorf_id(resource, new_id, res, "wrong resource type/version"); | 	pw_resource_errorf_id(resource, new_id, res, "wrong resource type/version"); | ||||||
| 	goto error_exit; | 	goto error_exit; | ||||||
| error_properties: | error_properties: | ||||||
| 	res = -errno; | 	res = -errno; | ||||||
| 	pw_log_debug(NAME" %p: can't create properties: %m", context); | 	pw_log_debug("%p: can't create properties: %m", context); | ||||||
| 	pw_resource_errorf_id(resource, new_id, res, "can't create properties: %s", spa_strerror(res)); | 	pw_resource_errorf_id(resource, new_id, res, "can't create properties: %s", spa_strerror(res)); | ||||||
| 	goto error_exit; | 	goto error_exit; | ||||||
| error_create_failed: | error_create_failed: | ||||||
|  | @ -392,7 +393,7 @@ static int core_destroy(void *object, void *proxy) | ||||||
| 	struct pw_impl_client *client = resource->client; | 	struct pw_impl_client *client = resource->client; | ||||||
| 	struct pw_impl_core *this = client->core; | 	struct pw_impl_core *this = client->core; | ||||||
| 	struct pw_resource *r = proxy; | 	struct pw_resource *r = proxy; | ||||||
| 	pw_log_debug(NAME" %p: destroy resource %p from client %p", this, r, client); | 	pw_log_debug("%p: destroy resource %p from client %p", this, r, client); | ||||||
| 	pw_resource_destroy(r); | 	pw_resource_destroy(r); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -458,7 +459,7 @@ struct pw_impl_core *pw_context_create_core(struct pw_context *context, | ||||||
| 	if (user_data_size > 0) | 	if (user_data_size > 0) | ||||||
| 		this->user_data = SPA_PTROFF(this, sizeof(*this), void); | 		this->user_data = SPA_PTROFF(this, sizeof(*this), void); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new %s", this, name); | 	pw_log_debug("%p: new %s", this, name); | ||||||
| 
 | 
 | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
|  | @ -478,7 +479,7 @@ struct pw_impl_core *pw_context_get_default_core(struct pw_context *context) | ||||||
| SPA_EXPORT | SPA_EXPORT | ||||||
| void pw_impl_core_destroy(struct pw_impl_core *core) | void pw_impl_core_destroy(struct pw_impl_core *core) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: destroy", core); | 	pw_log_debug("%p: destroy", core); | ||||||
| 	pw_impl_core_emit_destroy(core); | 	pw_impl_core_emit_destroy(core); | ||||||
| 
 | 
 | ||||||
| 	if (core->registered) | 	if (core->registered) | ||||||
|  | @ -490,7 +491,7 @@ void pw_impl_core_destroy(struct pw_impl_core *core) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_impl_core_emit_free(core); | 	pw_impl_core_emit_free(core); | ||||||
| 	pw_log_debug(NAME" %p: free", core); | 	pw_log_debug("%p: free", core); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_clean(&core->listener_list); | 	spa_hook_list_clean(&core->listener_list); | ||||||
| 
 | 
 | ||||||
|  | @ -554,12 +555,12 @@ global_bind(void *_data, | ||||||
| 		this->info.change_mask = 0; | 		this->info.change_mask = 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error: | error: | ||||||
| 	pw_log_error(NAME" %p: can't create resource: %m", this); | 	pw_log_error("%p: can't create resource: %m", this); | ||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -591,7 +592,7 @@ int pw_impl_core_update_properties(struct pw_impl_core *core, const struct spa_d | ||||||
| 	changed = pw_properties_update(core->properties, dict); | 	changed = pw_properties_update(core->properties, dict); | ||||||
| 	core->info.props = &core->properties->dict; | 	core->info.props = &core->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", core, changed); | 	pw_log_debug("%p: updated %d properties", core, changed); | ||||||
| 
 | 
 | ||||||
| 	if (!changed) | 	if (!changed) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
|  | @ -32,7 +32,8 @@ | ||||||
| #include "pipewire/impl.h" | #include "pipewire/impl.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "device" | PW_LOG_TOPIC_EXTERN(log_device); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_device | ||||||
| 
 | 
 | ||||||
| struct impl { | struct impl { | ||||||
| 	struct pw_impl_device this; | 	struct pw_impl_device this; | ||||||
|  | @ -133,7 +134,7 @@ static void check_properties(struct pw_impl_device *device) | ||||||
| 	    (device->name == NULL || !spa_streq(str, device->name))) { | 	    (device->name == NULL || !spa_streq(str, device->name))) { | ||||||
| 		free(device->name); | 		free(device->name); | ||||||
| 		device->name = strdup(str); | 		device->name = strdup(str); | ||||||
| 		pw_log_debug(NAME" %p: name '%s'", device, device->name); | 		pw_log_debug("%p: name '%s'", device, device->name); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -157,7 +158,7 @@ struct pw_impl_device *pw_context_create_device(struct pw_context *context, | ||||||
| 
 | 
 | ||||||
| 	this = &impl->this; | 	this = &impl->this; | ||||||
| 	this->name = strdup("device"); | 	this->name = strdup("device"); | ||||||
| 	pw_log_debug(NAME" %p: new", this); | 	pw_log_debug("%p: new", this); | ||||||
| 
 | 
 | ||||||
| 	if (properties == NULL) | 	if (properties == NULL) | ||||||
| 		properties = pw_properties_new(NULL, NULL); | 		properties = pw_properties_new(NULL, NULL); | ||||||
|  | @ -196,7 +197,7 @@ void pw_impl_device_destroy(struct pw_impl_device *device) | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(device, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(device, struct impl, this); | ||||||
| 	struct object_data *od; | 	struct object_data *od; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", device); | 	pw_log_debug("%p: destroy", device); | ||||||
| 	pw_impl_device_emit_destroy(device); | 	pw_impl_device_emit_destroy(device); | ||||||
| 
 | 
 | ||||||
| 	spa_list_consume(od, &device->object_list, link) | 	spa_list_consume(od, &device->object_list, link) | ||||||
|  | @ -212,7 +213,7 @@ void pw_impl_device_destroy(struct pw_impl_device *device) | ||||||
| 		spa_hook_remove(&device->global_listener); | 		spa_hook_remove(&device->global_listener); | ||||||
| 		pw_global_destroy(device->global); | 		pw_global_destroy(device->global); | ||||||
| 	} | 	} | ||||||
| 	pw_log_debug(NAME" %p: free", device); | 	pw_log_debug("%p: free", device); | ||||||
| 	pw_impl_device_emit_free(device); | 	pw_impl_device_emit_free(device); | ||||||
| 
 | 
 | ||||||
| 	pw_param_clear(&impl->param_list, SPA_ID_INVALID); | 	pw_param_clear(&impl->param_list, SPA_ID_INVALID); | ||||||
|  | @ -255,7 +256,7 @@ static void resource_pong(void *data, int seq) | ||||||
| { | { | ||||||
| 	struct resource_data *d = data; | 	struct resource_data *d = data; | ||||||
| 	struct pw_resource *resource = d->resource; | 	struct pw_resource *resource = d->resource; | ||||||
| 	pw_log_debug(NAME" %p: resource %p: got pong %d", d->device, | 	pw_log_debug("%p: resource %p: got pong %d", d->device, | ||||||
| 			resource, seq); | 			resource, seq); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -269,7 +270,7 @@ static void result_device_params(void *data, int seq, int res, uint32_t type, co | ||||||
| { | { | ||||||
| 	struct result_device_params_data *d = data; | 	struct result_device_params_data *d = data; | ||||||
| 	struct impl *impl = d->impl; | 	struct impl *impl = d->impl; | ||||||
| 	pw_log_debug(NAME" %p: type %d", impl, type); | 	pw_log_debug("%p: type %d", impl, type); | ||||||
| 
 | 
 | ||||||
| 	switch (type) { | 	switch (type) { | ||||||
| 	case SPA_RESULT_TYPE_DEVICE_PARAMS: | 	case SPA_RESULT_TYPE_DEVICE_PARAMS: | ||||||
|  | @ -277,7 +278,7 @@ static void result_device_params(void *data, int seq, int res, uint32_t type, co | ||||||
| 		const struct spa_result_device_params *r = result; | 		const struct spa_result_device_params *r = result; | ||||||
| 		d->callback(d->data, seq, r->id, r->index, r->next, r->param); | 		d->callback(d->data, seq, r->id, r->index, r->next, r->param); | ||||||
| 		if (d->cache) { | 		if (d->cache) { | ||||||
| 			pw_log_debug(NAME" %p: add param %d", impl, r->id); | 			pw_log_debug("%p: add param %d", impl, r->id); | ||||||
| 			if (d->count++ == 0) | 			if (d->count++ == 0) | ||||||
| 				pw_param_add(&impl->pending_list, r->id, NULL); | 				pw_param_add(&impl->pending_list, r->id, NULL); | ||||||
| 			pw_param_add(&impl->pending_list, r->id, r->param); | 			pw_param_add(&impl->pending_list, r->id, r->param); | ||||||
|  | @ -316,7 +317,7 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device, | ||||||
| 	if (max == 0) | 	if (max == 0) | ||||||
| 		max = UINT32_MAX; | 		max = UINT32_MAX; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: params id:%d (%s) index:%u max:%u cached:%d", device, param_id, | 	pw_log_debug("%p: params id:%d (%s) index:%u max:%u cached:%d", device, param_id, | ||||||
| 			spa_debug_type_find_name(spa_type_param, param_id), | 			spa_debug_type_find_name(spa_type_param, param_id), | ||||||
| 			index, max, pi->user); | 			index, max, pi->user); | ||||||
| 
 | 
 | ||||||
|  | @ -342,7 +343,7 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device, | ||||||
| 			if (spa_pod_filter(&b, &result.param, p->param, filter) != 0) | 			if (spa_pod_filter(&b, &result.param, p->param, filter) != 0) | ||||||
| 				continue; | 				continue; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME " %p: %d param %u", device, seq, result.index); | 			pw_log_debug("%p: %d param %u", device, seq, result.index); | ||||||
| 			result_device_params(&user_data, seq, 0, SPA_RESULT_TYPE_DEVICE_PARAMS, &result); | 			result_device_params(&user_data, seq, 0, SPA_RESULT_TYPE_DEVICE_PARAMS, &result); | ||||||
| 
 | 
 | ||||||
| 			if (++count == max) | 			if (++count == max) | ||||||
|  | @ -381,7 +382,7 @@ static void result_device_params_async(void *data, int seq, int res, uint32_t ty | ||||||
| { | { | ||||||
| 	struct resource_data *d = data; | 	struct resource_data *d = data; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: async result %d %d (%d/%d)", d->device, | 	pw_log_debug("%p: async result %d %d (%d/%d)", d->device, | ||||||
| 			res, seq, d->seq, d->end); | 			res, seq, d->seq, d->end); | ||||||
| 
 | 
 | ||||||
| 	if (seq == d->seq) | 	if (seq == d->seq) | ||||||
|  | @ -443,7 +444,7 @@ static int device_subscribe_params(void *object, uint32_t *ids, uint32_t n_ids) | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < n_ids; i++) { | 	for (i = 0; i < n_ids; i++) { | ||||||
| 		data->subscribe_ids[i] = ids[i]; | 		data->subscribe_ids[i] = ids[i]; | ||||||
| 		pw_log_debug(NAME" %p: resource %p subscribe param id:%d (%s)", | 		pw_log_debug("%p: resource %p subscribe param id:%d (%s)", | ||||||
| 				data->device, resource, ids[i], | 				data->device, resource, ids[i], | ||||||
| 				spa_debug_type_find_name(spa_type_param, ids[i])); | 				spa_debug_type_find_name(spa_type_param, ids[i])); | ||||||
| 		device_enum_params(data, 1, ids[i], 0, UINT32_MAX, NULL); | 		device_enum_params(data, 1, ids[i], 0, UINT32_MAX, NULL); | ||||||
|  | @ -455,7 +456,7 @@ static void result_device_done(void *data, int seq, int res, uint32_t type, cons | ||||||
| { | { | ||||||
| 	struct resource_data *d = data; | 	struct resource_data *d = data; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: async result %d %d (%d/%d)", d->device, | 	pw_log_debug("%p: async result %d %d (%d/%d)", d->device, | ||||||
| 			res, seq, d->seq, d->end); | 			res, seq, d->seq, d->end); | ||||||
| 
 | 
 | ||||||
| 	if (seq == d->end) | 	if (seq == d->end) | ||||||
|  | @ -523,7 +524,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 			&data->object_listener, | 			&data->object_listener, | ||||||
| 			&device_methods, data); | 			&device_methods, data); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 	pw_global_add_resource(global, resource); | 	pw_global_add_resource(global, resource); | ||||||
| 
 | 
 | ||||||
| 	this->info.change_mask = PW_DEVICE_CHANGE_MASK_ALL; | 	this->info.change_mask = PW_DEVICE_CHANGE_MASK_ALL; | ||||||
|  | @ -533,7 +534,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error_resource: | error_resource: | ||||||
| 	pw_log_error(NAME" %p: can't create device resource: %m", this); | 	pw_log_error("%p: can't create device resource: %m", this); | ||||||
| 	return -errno; | 	return -errno; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -658,7 +659,7 @@ static int update_properties(struct pw_impl_device *device, const struct spa_dic | ||||||
| 	changed = pw_properties_update_ignore(device->properties, dict, filter ? ignored : NULL); | 	changed = pw_properties_update_ignore(device->properties, dict, filter ? ignored : NULL); | ||||||
| 	device->info.props = &device->properties->dict; | 	device->info.props = &device->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", device, changed); | 	pw_log_debug("%p: updated %d properties", device, changed); | ||||||
| 
 | 
 | ||||||
| 	if (!changed) | 	if (!changed) | ||||||
| 		return 0; | 		return 0; | ||||||
|  | @ -690,7 +691,7 @@ static int notify_param(void *data, int seq, uint32_t id, | ||||||
| 		if (!resource_is_subscribed(resource, id)) | 		if (!resource_is_subscribed(resource, id)) | ||||||
| 			continue; | 			continue; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: resource %p notify param %d", device, resource, id); | 		pw_log_debug("%p: resource %p notify param %d", device, resource, id); | ||||||
| 		pw_device_resource_param(resource, seq, id, index, next, param); | 		pw_device_resource_param(resource, seq, id, index, next, param); | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -704,7 +705,7 @@ static void emit_params(struct pw_impl_device *device, uint32_t *changed_ids, ui | ||||||
| 	if (device->global == NULL) | 	if (device->global == NULL) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: emit %d params", device, n_changed_ids); | 	pw_log_debug("%p: emit %d params", device, n_changed_ids); | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < n_changed_ids; i++) { | 	for (i = 0; i < n_changed_ids; i++) { | ||||||
| 		struct pw_resource *resource; | 		struct pw_resource *resource; | ||||||
|  | @ -720,7 +721,7 @@ static void emit_params(struct pw_impl_device *device, uint32_t *changed_ids, ui | ||||||
| 
 | 
 | ||||||
| 		if ((res = pw_impl_device_for_each_param(device, 1, changed_ids[i], 0, UINT32_MAX, | 		if ((res = pw_impl_device_for_each_param(device, 1, changed_ids[i], 0, UINT32_MAX, | ||||||
| 					NULL, notify_param, device)) < 0) { | 					NULL, notify_param, device)) < 0) { | ||||||
| 			pw_log_error(NAME" %p: error %d (%s)", device, res, spa_strerror(res)); | 			pw_log_error("%p: error %d (%s)", device, res, spa_strerror(res)); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -730,7 +731,7 @@ static void device_info(void *data, const struct spa_device_info *info) | ||||||
| 	struct pw_impl_device *device = data; | 	struct pw_impl_device *device = data; | ||||||
| 	uint32_t changed_ids[MAX_PARAMS], n_changed_ids = 0; | 	uint32_t changed_ids[MAX_PARAMS], n_changed_ids = 0; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: flags:%08"PRIx64" change_mask:%08"PRIx64, | 	pw_log_debug("%p: flags:%08"PRIx64" change_mask:%08"PRIx64, | ||||||
| 			device, info->flags, info->change_mask); | 			device, info->flags, info->change_mask); | ||||||
| 
 | 
 | ||||||
| 	if (info->change_mask & SPA_DEVICE_CHANGE_MASK_PROPS) { | 	if (info->change_mask & SPA_DEVICE_CHANGE_MASK_PROPS) { | ||||||
|  | @ -745,7 +746,7 @@ static void device_info(void *data, const struct spa_device_info *info) | ||||||
| 		for (i = 0; i < device->info.n_params; i++) { | 		for (i = 0; i < device->info.n_params; i++) { | ||||||
| 			uint32_t id = info->params[i].id; | 			uint32_t id = info->params[i].id; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: param %d id:%d (%s) %08x:%08x", device, i, | 			pw_log_debug("%p: param %d id:%d (%s) %08x:%08x", device, i, | ||||||
| 					id, spa_debug_type_find_name(spa_type_param, id), | 					id, spa_debug_type_find_name(spa_type_param, id), | ||||||
| 					device->info.params[i].flags, info->params[i].flags); | 					device->info.params[i].flags, info->params[i].flags); | ||||||
| 
 | 
 | ||||||
|  | @ -753,7 +754,7 @@ static void device_info(void *data, const struct spa_device_info *info) | ||||||
| 			if (device->info.params[i].flags == info->params[i].flags) | 			if (device->info.params[i].flags == info->params[i].flags) | ||||||
| 				continue; | 				continue; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: update param %d", device, id); | 			pw_log_debug("%p: update param %d", device, id); | ||||||
| 			device->info.params[i] = info->params[i]; | 			device->info.params[i] = info->params[i]; | ||||||
| 			device->info.params[i].user = 0; | 			device->info.params[i].user = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -778,19 +779,19 @@ static void device_add_object(struct pw_impl_device *device, uint32_t id, | ||||||
| 	struct object_data *od = NULL; | 	struct object_data *od = NULL; | ||||||
| 
 | 
 | ||||||
| 	if (info->factory_name == NULL) { | 	if (info->factory_name == NULL) { | ||||||
| 		pw_log_debug(NAME" %p: missing factory name", device); | 		pw_log_debug("%p: missing factory name", device); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	handle = pw_context_load_spa_handle(context, info->factory_name, info->props); | 	handle = pw_context_load_spa_handle(context, info->factory_name, info->props); | ||||||
| 	if (handle == NULL) { | 	if (handle == NULL) { | ||||||
| 		pw_log_warn(NAME" %p: can't load handle %s: %m", | 		pw_log_warn("%p: can't load handle %s: %m", | ||||||
| 				device, info->factory_name); | 				device, info->factory_name); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) { | 	if ((res = spa_handle_get_interface(handle, info->type, &iface)) < 0) { | ||||||
| 		pw_log_error(NAME" %p: can't get %s interface: %s", device, info->type, | 		pw_log_error("%p: can't get %s interface: %s", device, info->type, | ||||||
| 				spa_strerror(res)); | 				spa_strerror(res)); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  | @ -818,7 +819,7 @@ static void device_add_object(struct pw_impl_device *device, uint32_t id, | ||||||
| 		pw_impl_device_add_listener(dev, &od->listener, &device_object_events, od); | 		pw_impl_device_add_listener(dev, &od->listener, &device_object_events, od); | ||||||
| 		pw_impl_device_set_implementation(dev, iface); | 		pw_impl_device_set_implementation(dev, iface); | ||||||
| 	} else { | 	} else { | ||||||
| 		pw_log_warn(NAME" %p: unknown type %s", device, info->type); | 		pw_log_warn("%p: unknown type %s", device, info->type); | ||||||
| 		pw_properties_free(props); | 		pw_properties_free(props); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -851,7 +852,7 @@ static void device_object_info(void *data, uint32_t id, | ||||||
| 	od = find_object(device, id); | 	od = find_object(device, id); | ||||||
| 
 | 
 | ||||||
| 	if (info == NULL) { | 	if (info == NULL) { | ||||||
| 		pw_log_debug(NAME" %p: remove node %d (%p)", device, id, od); | 		pw_log_debug("%p: remove node %d (%p)", device, id, od); | ||||||
| 		if (od) | 		if (od) | ||||||
| 			object_destroy(od); | 			object_destroy(od); | ||||||
| 	} | 	} | ||||||
|  | @ -873,10 +874,10 @@ static const struct spa_device_events device_events = { | ||||||
| SPA_EXPORT | SPA_EXPORT | ||||||
| int pw_impl_device_set_implementation(struct pw_impl_device *device, struct spa_device *spa_device) | int pw_impl_device_set_implementation(struct pw_impl_device *device, struct spa_device *spa_device) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: implementation %p", device, spa_device); | 	pw_log_debug("%p: implementation %p", device, spa_device); | ||||||
| 
 | 
 | ||||||
| 	if (device->device) { | 	if (device->device) { | ||||||
| 		pw_log_error(NAME" %p: implementation existed %p", | 		pw_log_error("%p: implementation existed %p", | ||||||
| 				device, device->device); | 				device, device->device); | ||||||
| 		return -EEXIST; | 		return -EEXIST; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -30,7 +30,8 @@ | ||||||
| #include "pipewire/impl.h" | #include "pipewire/impl.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "factory" | PW_LOG_TOPIC_EXTERN(log_factory); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_factory | ||||||
| 
 | 
 | ||||||
| #define pw_factory_resource_info(r,...) pw_resource_call(r,struct pw_factory_events,info,0,__VA_ARGS__) | #define pw_factory_resource_info(r,...) pw_resource_call(r,struct pw_factory_events,info,0,__VA_ARGS__) | ||||||
| 
 | 
 | ||||||
|  | @ -68,7 +69,7 @@ struct pw_impl_factory *pw_context_create_factory(struct pw_context *context, | ||||||
| 	if (user_data_size > 0) | 	if (user_data_size > 0) | ||||||
| 		this->user_data = SPA_PTROFF(this, sizeof(*this), void); | 		this->user_data = SPA_PTROFF(this, sizeof(*this), void); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new %s", this, name); | 	pw_log_debug("%p: new %s", this, name); | ||||||
| 
 | 
 | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
|  | @ -81,7 +82,7 @@ error_exit: | ||||||
| SPA_EXPORT | SPA_EXPORT | ||||||
| void pw_impl_factory_destroy(struct pw_impl_factory *factory) | void pw_impl_factory_destroy(struct pw_impl_factory *factory) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: destroy", factory); | 	pw_log_debug("%p: destroy", factory); | ||||||
| 	pw_impl_factory_emit_destroy(factory); | 	pw_impl_factory_emit_destroy(factory); | ||||||
| 
 | 
 | ||||||
| 	if (factory->registered) | 	if (factory->registered) | ||||||
|  | @ -93,7 +94,7 @@ void pw_impl_factory_destroy(struct pw_impl_factory *factory) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_impl_factory_emit_free(factory); | 	pw_impl_factory_emit_free(factory); | ||||||
| 	pw_log_debug(NAME" %p: free", factory); | 	pw_log_debug("%p: free", factory); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_clean(&factory->listener_list); | 	spa_hook_list_clean(&factory->listener_list); | ||||||
| 
 | 
 | ||||||
|  | @ -116,7 +117,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	if (resource == NULL) | 	if (resource == NULL) | ||||||
| 		goto error_resource; | 		goto error_resource; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 	pw_global_add_resource(global, resource); | 	pw_global_add_resource(global, resource); | ||||||
| 
 | 
 | ||||||
| 	this->info.change_mask = PW_FACTORY_CHANGE_MASK_ALL; | 	this->info.change_mask = PW_FACTORY_CHANGE_MASK_ALL; | ||||||
|  | @ -126,7 +127,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error_resource: | error_resource: | ||||||
| 	pw_log_error(NAME" %p: can't create factory resource: %m", this); | 	pw_log_error("%p: can't create factory resource: %m", this); | ||||||
| 	return -errno; | 	return -errno; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -158,7 +159,7 @@ int pw_impl_factory_update_properties(struct pw_impl_factory *factory, const str | ||||||
| 	changed = pw_properties_update(factory->properties, dict); | 	changed = pw_properties_update(factory->properties, dict); | ||||||
| 	factory->info.props = &factory->properties->dict; | 	factory->info.props = &factory->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", factory, changed); | 	pw_log_debug("%p: updated %d properties", factory, changed); | ||||||
| 
 | 
 | ||||||
| 	if (!changed) | 	if (!changed) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
|  | @ -32,7 +32,8 @@ | ||||||
| 
 | 
 | ||||||
| #include "pipewire/extensions/metadata.h" | #include "pipewire/extensions/metadata.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "metadata" | PW_LOG_TOPIC_EXTERN(log_metadata); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_metadata | ||||||
| 
 | 
 | ||||||
| #define pw_metadata_emit(hooks,method,version,...)			\ | #define pw_metadata_emit(hooks,method,version,...)			\ | ||||||
| 	spa_hook_list_call_simple(hooks, struct pw_metadata_events,	\ | 	spa_hook_list_call_simple(hooks, struct pw_metadata_events,	\ | ||||||
|  | @ -142,7 +143,7 @@ static int clear_subjects(struct metadata *this, struct pw_array *storage, uint3 | ||||||
| 		if (item == NULL) | 		if (item == NULL) | ||||||
| 			break; | 			break; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: remove id:%d key:%s", this, subject, item->key); | 		pw_log_debug("%p: remove id:%d key:%s", this, subject, item->key); | ||||||
| 
 | 
 | ||||||
| 		clear_item(item); | 		clear_item(item); | ||||||
| 		pw_array_remove(storage, item); | 		pw_array_remove(storage, item); | ||||||
|  | @ -180,7 +181,7 @@ static int impl_set_property(void *object, | ||||||
| 	struct item *item = NULL; | 	struct item *item = NULL; | ||||||
| 	int changed = 0; | 	int changed = 0; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: id:%d key:%s type:%s value:%s", this, subject, key, type, value); | 	pw_log_debug("%p: id:%d key:%s type:%s value:%s", this, subject, key, type, value); | ||||||
| 
 | 
 | ||||||
| 	if (key == NULL) | 	if (key == NULL) | ||||||
| 		return clear_subjects(this, &this->storage, subject); | 		return clear_subjects(this, &this->storage, subject); | ||||||
|  | @ -192,7 +193,7 @@ static int impl_set_property(void *object, | ||||||
| 			pw_array_remove(&this->storage, item); | 			pw_array_remove(&this->storage, item); | ||||||
| 			type = NULL; | 			type = NULL; | ||||||
| 			changed++; | 			changed++; | ||||||
| 			pw_log_info(NAME" %p: remove id:%d key:%s", this, | 			pw_log_info("%p: remove id:%d key:%s", this, | ||||||
| 					subject, key); | 					subject, key); | ||||||
| 		} | 		} | ||||||
| 	} else if (item == NULL) { | 	} else if (item == NULL) { | ||||||
|  | @ -201,14 +202,14 @@ static int impl_set_property(void *object, | ||||||
| 			return -errno; | 			return -errno; | ||||||
| 		set_item(item, subject, key, type, value); | 		set_item(item, subject, key, type, value); | ||||||
| 		changed++; | 		changed++; | ||||||
| 		pw_log_info(NAME" %p: add id:%d key:%s type:%s value:%s", this, | 		pw_log_info("%p: add id:%d key:%s type:%s value:%s", this, | ||||||
| 				subject, key, type, value); | 				subject, key, type, value); | ||||||
| 	} else { | 	} else { | ||||||
| 		if (type == NULL) | 		if (type == NULL) | ||||||
| 			type = item->type; | 			type = item->type; | ||||||
| 		changed = change_item(item, type, value); | 		changed = change_item(item, type, value); | ||||||
| 		if (changed) | 		if (changed) | ||||||
| 			pw_log_info(NAME" %p: change id:%d key:%s type:%s value:%s", this, | 			pw_log_info("%p: change id:%d key:%s type:%s value:%s", this, | ||||||
| 				subject, key, type, value); | 				subject, key, type, value); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -314,7 +315,7 @@ struct pw_impl_metadata *pw_context_create_metadata(struct pw_context *context, | ||||||
| 	if (user_data_size > 0) | 	if (user_data_size > 0) | ||||||
| 		this->user_data = SPA_PTROFF(this, sizeof(*this), void); | 		this->user_data = SPA_PTROFF(this, sizeof(*this), void); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new", this); | 	pw_log_debug("%p: new", this); | ||||||
| 
 | 
 | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
|  | @ -355,7 +356,7 @@ void pw_impl_metadata_destroy(struct pw_impl_metadata *metadata) | ||||||
| { | { | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(metadata, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(metadata, struct impl, this); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", metadata); | 	pw_log_debug("%p: destroy", metadata); | ||||||
| 	pw_impl_metadata_emit_destroy(metadata); | 	pw_impl_metadata_emit_destroy(metadata); | ||||||
| 
 | 
 | ||||||
| 	if (metadata->registered) | 	if (metadata->registered) | ||||||
|  | @ -367,7 +368,7 @@ void pw_impl_metadata_destroy(struct pw_impl_metadata *metadata) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_impl_metadata_emit_free(metadata); | 	pw_impl_metadata_emit_free(metadata); | ||||||
| 	pw_log_debug(NAME" %p: free", metadata); | 	pw_log_debug("%p: free", metadata); | ||||||
| 
 | 
 | ||||||
| 	metadata_reset(&impl->def); | 	metadata_reset(&impl->def); | ||||||
| 
 | 
 | ||||||
|  | @ -474,7 +475,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
|         data->impl = this; |         data->impl = this; | ||||||
|         data->resource = resource; |         data->resource = resource; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 	pw_global_add_resource(global, resource); | 	pw_global_add_resource(global, resource); | ||||||
| 
 | 
 | ||||||
| 	/* listen for when the resource goes away */ | 	/* listen for when the resource goes away */ | ||||||
|  | @ -495,7 +496,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error_resource: | error_resource: | ||||||
| 	pw_log_error(NAME" %p: can't create metadata resource: %m", this); | 	pw_log_error("%p: can't create metadata resource: %m", this); | ||||||
| 	return -errno; | 	return -errno; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -37,7 +37,8 @@ | ||||||
| #include "pipewire/impl.h" | #include "pipewire/impl.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "module" | PW_LOG_TOPIC_EXTERN(log_module); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_module | ||||||
| 
 | 
 | ||||||
| /** \cond */ | /** \cond */ | ||||||
| struct impl { | struct impl { | ||||||
|  | @ -118,7 +119,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	if (resource == NULL) | 	if (resource == NULL) | ||||||
| 		goto error_resource; | 		goto error_resource; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 	pw_global_add_resource(global, resource); | 	pw_global_add_resource(global, resource); | ||||||
| 
 | 
 | ||||||
| 	this->info.change_mask = PW_MODULE_CHANGE_MASK_ALL; | 	this->info.change_mask = PW_MODULE_CHANGE_MASK_ALL; | ||||||
|  | @ -128,7 +129,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error_resource: | error_resource: | ||||||
| 	pw_log_error(NAME" %p: can't create module resource: %m", this); | 	pw_log_error("%p: can't create module resource: %m", this); | ||||||
| 	return -errno; | 	return -errno; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -256,7 +257,7 @@ pw_context_load_module(struct pw_context *context, | ||||||
| 
 | 
 | ||||||
| 	pw_impl_module_emit_registered(this); | 	pw_impl_module_emit_registered(this); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: loaded module: %s", this, this->info.name); | 	pw_log_debug("%p: loaded module: %s", this, this->info.name); | ||||||
| 
 | 
 | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
|  | @ -306,7 +307,7 @@ void pw_impl_module_destroy(struct pw_impl_module *module) | ||||||
| { | { | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", module); | 	pw_log_debug("%p: destroy", module); | ||||||
| 	pw_impl_module_emit_destroy(module); | 	pw_impl_module_emit_destroy(module); | ||||||
| 
 | 
 | ||||||
| 	if (module->global) { | 	if (module->global) { | ||||||
|  | @ -315,7 +316,7 @@ void pw_impl_module_destroy(struct pw_impl_module *module) | ||||||
| 		pw_global_destroy(module->global); | 		pw_global_destroy(module->global); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free", module); | 	pw_log_debug("%p: free", module); | ||||||
| 	pw_impl_module_emit_free(module); | 	pw_impl_module_emit_free(module); | ||||||
| 	free((char *) module->info.name); | 	free((char *) module->info.name); | ||||||
| 	free((char *) module->info.filename); | 	free((char *) module->info.filename); | ||||||
|  | @ -326,7 +327,7 @@ void pw_impl_module_destroy(struct pw_impl_module *module) | ||||||
| 	spa_hook_list_clean(&module->listener_list); | 	spa_hook_list_clean(&module->listener_list); | ||||||
| 
 | 
 | ||||||
| 	if (!pw_in_valgrind() && dlclose(impl->hnd) != 0) | 	if (!pw_in_valgrind() && dlclose(impl->hnd) != 0) | ||||||
| 		pw_log_warn(NAME" %p: dlclose failed: %s", module, dlerror()); | 		pw_log_warn("%p: dlclose failed: %s", module, dlerror()); | ||||||
| 	free(impl); | 	free(impl); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -358,7 +359,7 @@ int pw_impl_module_update_properties(struct pw_impl_module *module, const struct | ||||||
| 	changed = pw_properties_update(module->properties, dict); | 	changed = pw_properties_update(module->properties, dict); | ||||||
| 	module->info.props = &module->properties->dict; | 	module->info.props = &module->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", module, changed); | 	pw_log_debug("%p: updated %d properties", module, changed); | ||||||
| 
 | 
 | ||||||
| 	if (!changed) | 	if (!changed) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
|  | @ -39,7 +39,8 @@ | ||||||
| #include "pipewire/impl-node.h" | #include "pipewire/impl-node.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| 
 | 
 | ||||||
| #define NAME "node" | PW_LOG_TOPIC_EXTERN(log_node); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_node | ||||||
| 
 | 
 | ||||||
| #define DEFAULT_SYNC_TIMEOUT  ((uint64_t)(5 * SPA_NSEC_PER_SEC)) | #define DEFAULT_SYNC_TIMEOUT  ((uint64_t)(5 * SPA_NSEC_PER_SEC)) | ||||||
| 
 | 
 | ||||||
|  | @ -89,7 +90,7 @@ static void node_deactivate(struct pw_impl_node *this) | ||||||
| 	struct pw_impl_port *port; | 	struct pw_impl_port *port; | ||||||
| 	struct pw_impl_link *link; | 	struct pw_impl_link *link; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: deactivate", this); | 	pw_log_debug("%p: deactivate", this); | ||||||
| 	spa_list_for_each(port, &this->input_ports, link) { | 	spa_list_for_each(port, &this->input_ports, link) { | ||||||
| 		spa_list_for_each(link, &port->links, input_link) | 		spa_list_for_each(link, &port->links, input_link) | ||||||
| 			pw_impl_link_deactivate(link); | 			pw_impl_link_deactivate(link); | ||||||
|  | @ -108,7 +109,7 @@ static void add_node(struct pw_impl_node *this, struct pw_impl_node *driver) | ||||||
| 	if (this->exported) | 	if (this->exported) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: add to driver %p %p %p", this, driver, | 	pw_log_trace("%p: add to driver %p %p %p", this, driver, | ||||||
| 			driver->rt.activation, this->rt.activation); | 			driver->rt.activation, this->rt.activation); | ||||||
| 
 | 
 | ||||||
| 	/* signal the driver */ | 	/* signal the driver */ | ||||||
|  | @ -130,7 +131,7 @@ static void add_node(struct pw_impl_node *this, struct pw_impl_node *driver) | ||||||
| 			dstate->required++; | 			dstate->required++; | ||||||
| 			t->active = true; | 			t->active = true; | ||||||
| 		} | 		} | ||||||
| 		pw_log_trace(NAME" %p: driver state:%p pending:%d/%d, node state:%p pending:%d/%d", | 		pw_log_trace("%p: driver state:%p pending:%d/%d, node state:%p pending:%d/%d", | ||||||
| 				this, dstate, dstate->pending, dstate->required, | 				this, dstate, dstate->pending, dstate->required, | ||||||
| 				nstate, nstate->pending, nstate->required); | 				nstate, nstate->pending, nstate->required); | ||||||
| 	} | 	} | ||||||
|  | @ -144,7 +145,7 @@ static void remove_node(struct pw_impl_node *this) | ||||||
| 	if (this->exported) | 	if (this->exported) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: remove from driver %p %p %p", | 	pw_log_trace("%p: remove from driver %p %p %p", | ||||||
| 			this, this->rt.driver_target.data, | 			this, this->rt.driver_target.data, | ||||||
| 			this->rt.driver_target.activation, this->rt.activation); | 			this->rt.driver_target.activation, this->rt.activation); | ||||||
| 
 | 
 | ||||||
|  | @ -162,7 +163,7 @@ static void remove_node(struct pw_impl_node *this) | ||||||
| 			dstate->required--; | 			dstate->required--; | ||||||
| 			t->active = false; | 			t->active = false; | ||||||
| 		} | 		} | ||||||
| 		pw_log_trace(NAME" %p: driver state:%p pending:%d/%d, node state:%p pending:%d/%d", | 		pw_log_trace("%p: driver state:%p pending:%d/%d, node state:%p pending:%d/%d", | ||||||
| 				this, dstate, dstate->pending, dstate->required, | 				this, dstate, dstate->pending, dstate->required, | ||||||
| 				nstate, nstate->pending, nstate->required); | 				nstate, nstate->pending, nstate->required); | ||||||
| 	} | 	} | ||||||
|  | @ -188,7 +189,7 @@ static int pause_node(struct pw_impl_node *this) | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(this, struct impl, this); | ||||||
| 	int res = 0; | 	int res = 0; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: pause node state:%s pending:%s pause-on-idle:%d", this, | 	pw_log_debug("%p: pause node state:%s pending:%s pause-on-idle:%d", this, | ||||||
| 			pw_node_state_as_string(this->info.state), | 			pw_node_state_as_string(this->info.state), | ||||||
| 			pw_node_state_as_string(impl->pending), | 			pw_node_state_as_string(impl->pending), | ||||||
| 			impl->pause_on_idle); | 			impl->pause_on_idle); | ||||||
|  | @ -203,7 +204,7 @@ static int pause_node(struct pw_impl_node *this) | ||||||
| 	res = spa_node_send_command(this->node, | 	res = spa_node_send_command(this->node, | ||||||
| 				    &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Pause)); | 				    &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Pause)); | ||||||
| 	if (res < 0) | 	if (res < 0) | ||||||
| 		pw_log_debug(NAME" %p: pause node error %s", this, spa_strerror(res)); | 		pw_log_debug("%p: pause node error %s", this, spa_strerror(res)); | ||||||
| 
 | 
 | ||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
|  | @ -216,7 +217,7 @@ static int start_node(struct pw_impl_node *this) | ||||||
| 	if (impl->pending >= PW_NODE_STATE_RUNNING) | 	if (impl->pending >= PW_NODE_STATE_RUNNING) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: start node", this); | 	pw_log_debug("%p: start node", this); | ||||||
| 
 | 
 | ||||||
| 	if (!(this->driving && this->driver)) { | 	if (!(this->driving && this->driver)) { | ||||||
| 		impl->pending_play = true; | 		impl->pending_play = true; | ||||||
|  | @ -269,7 +270,7 @@ static int notify_param(void *data, int seq, uint32_t id, | ||||||
| 		if (!resource_is_subscribed(resource, id)) | 		if (!resource_is_subscribed(resource, id)) | ||||||
| 			continue; | 			continue; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: resource %p notify param %d", node, resource, id); | 		pw_log_debug("%p: resource %p notify param %d", node, resource, id); | ||||||
| 		pw_node_resource_param(resource, seq, id, index, next, param); | 		pw_node_resource_param(resource, seq, id, index, next, param); | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -283,7 +284,7 @@ static void emit_params(struct pw_impl_node *node, uint32_t *changed_ids, uint32 | ||||||
| 	if (node->global == NULL) | 	if (node->global == NULL) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: emit %d params", node, n_changed_ids); | 	pw_log_debug("%p: emit %d params", node, n_changed_ids); | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < n_changed_ids; i++) { | 	for (i = 0; i < n_changed_ids; i++) { | ||||||
| 		struct pw_resource *resource; | 		struct pw_resource *resource; | ||||||
|  | @ -299,7 +300,7 @@ static void emit_params(struct pw_impl_node *node, uint32_t *changed_ids, uint32 | ||||||
| 
 | 
 | ||||||
| 		if ((res = pw_impl_node_for_each_param(node, 1, changed_ids[i], 0, UINT32_MAX, | 		if ((res = pw_impl_node_for_each_param(node, 1, changed_ids[i], 0, UINT32_MAX, | ||||||
| 					NULL, notify_param, node)) < 0) { | 					NULL, notify_param, node)) < 0) { | ||||||
| 			pw_log_error(NAME" %p: error %d (%s)", node, res, spa_strerror(res)); | 			pw_log_error("%p: error %d (%s)", node, res, spa_strerror(res)); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -345,7 +346,7 @@ static void node_update_state(struct pw_impl_node *node, enum pw_node_state stat | ||||||
| 	node->info.state = state; | 	node->info.state = state; | ||||||
| 	impl->pending = state; | 	impl->pending = state; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: (%s) %s -> %s (%s)", node, node->name, | 	pw_log_debug("%p: (%s) %s -> %s (%s)", node, node->name, | ||||||
| 		     pw_node_state_as_string(old), pw_node_state_as_string(state), error); | 		     pw_node_state_as_string(old), pw_node_state_as_string(state), error); | ||||||
| 
 | 
 | ||||||
| 	if (old == state) | 	if (old == state) | ||||||
|  | @ -375,7 +376,7 @@ static int suspend_node(struct pw_impl_node *this) | ||||||
| 	int res = 0; | 	int res = 0; | ||||||
| 	struct pw_impl_port *p; | 	struct pw_impl_port *p; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: suspend node state:%s", this, | 	pw_log_debug("%p: suspend node state:%s", this, | ||||||
| 			pw_node_state_as_string(this->info.state)); | 			pw_node_state_as_string(this->info.state)); | ||||||
| 
 | 
 | ||||||
| 	if (this->info.state > 0 && this->info.state <= PW_NODE_STATE_SUSPENDED) | 	if (this->info.state > 0 && this->info.state <= PW_NODE_STATE_SUSPENDED) | ||||||
|  | @ -385,7 +386,7 @@ static int suspend_node(struct pw_impl_node *this) | ||||||
| 
 | 
 | ||||||
| 	spa_list_for_each(p, &this->input_ports, link) { | 	spa_list_for_each(p, &this->input_ports, link) { | ||||||
| 		if ((res = pw_impl_port_set_param(p, SPA_PARAM_Format, 0, NULL)) < 0) | 		if ((res = pw_impl_port_set_param(p, SPA_PARAM_Format, 0, NULL)) < 0) | ||||||
| 			pw_log_warn(NAME" %p: error unset format input: %s", | 			pw_log_warn("%p: error unset format input: %s", | ||||||
| 					this, spa_strerror(res)); | 					this, spa_strerror(res)); | ||||||
| 		/* force CONFIGURE in case of async */ | 		/* force CONFIGURE in case of async */ | ||||||
| 		p->state = PW_IMPL_PORT_STATE_CONFIGURE; | 		p->state = PW_IMPL_PORT_STATE_CONFIGURE; | ||||||
|  | @ -393,7 +394,7 @@ static int suspend_node(struct pw_impl_node *this) | ||||||
| 
 | 
 | ||||||
| 	spa_list_for_each(p, &this->output_ports, link) { | 	spa_list_for_each(p, &this->output_ports, link) { | ||||||
| 		if ((res = pw_impl_port_set_param(p, SPA_PARAM_Format, 0, NULL)) < 0) | 		if ((res = pw_impl_port_set_param(p, SPA_PARAM_Format, 0, NULL)) < 0) | ||||||
| 			pw_log_warn(NAME" %p: error unset format output: %s", | 			pw_log_warn("%p: error unset format output: %s", | ||||||
| 					this, spa_strerror(res)); | 					this, spa_strerror(res)); | ||||||
| 		/* force CONFIGURE in case of async */ | 		/* force CONFIGURE in case of async */ | ||||||
| 		p->state = PW_IMPL_PORT_STATE_CONFIGURE; | 		p->state = PW_IMPL_PORT_STATE_CONFIGURE; | ||||||
|  | @ -405,7 +406,7 @@ static int suspend_node(struct pw_impl_node *this) | ||||||
| 		res = spa_node_send_command(this->node, | 		res = spa_node_send_command(this->node, | ||||||
| 				    &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Pause)); | 				    &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Pause)); | ||||||
| 	if (res < 0 && res != -EIO) | 	if (res < 0 && res != -EIO) | ||||||
| 		pw_log_warn(NAME" %p: suspend node error %s", this, spa_strerror(res)); | 		pw_log_warn("%p: suspend node error %s", this, spa_strerror(res)); | ||||||
| 
 | 
 | ||||||
| 	node_update_state(this, PW_NODE_STATE_SUSPENDED, 0, NULL); | 	node_update_state(this, PW_NODE_STATE_SUSPENDED, 0, NULL); | ||||||
| 
 | 
 | ||||||
|  | @ -423,7 +424,7 @@ static int reply_param(void *data, int seq, uint32_t id, | ||||||
| 		uint32_t index, uint32_t next, struct spa_pod *param) | 		uint32_t index, uint32_t next, struct spa_pod *param) | ||||||
| { | { | ||||||
| 	struct resource_data *d = data; | 	struct resource_data *d = data; | ||||||
| 	pw_log_debug(NAME" %p: resource %p reply param %d", d->node, d->resource, seq); | 	pw_log_debug("%p: resource %p reply param %d", d->node, d->resource, seq); | ||||||
| 	pw_node_resource_param(d->resource, seq, id, index, next, param); | 	pw_node_resource_param(d->resource, seq, id, index, next, param); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -436,7 +437,7 @@ static int node_enum_params(void *object, int seq, uint32_t id, | ||||||
| 	struct pw_impl_node *node = data->node; | 	struct pw_impl_node *node = data->node; | ||||||
| 	int res; | 	int res; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: resource %p enum params seq:%d id:%d (%s) index:%u num:%u", | 	pw_log_debug("%p: resource %p enum params seq:%d id:%d (%s) index:%u num:%u", | ||||||
| 			node, resource, seq, id, | 			node, resource, seq, id, | ||||||
| 			spa_debug_type_find_name(spa_type_param, id), index, num); | 			spa_debug_type_find_name(spa_type_param, id), index, num); | ||||||
| 
 | 
 | ||||||
|  | @ -460,7 +461,7 @@ static int node_subscribe_params(void *object, uint32_t *ids, uint32_t n_ids) | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < n_ids; i++) { | 	for (i = 0; i < n_ids; i++) { | ||||||
| 		data->subscribe_ids[i] = ids[i]; | 		data->subscribe_ids[i] = ids[i]; | ||||||
| 		pw_log_debug(NAME" %p: resource %p subscribe param id:%d (%s)", | 		pw_log_debug("%p: resource %p subscribe param id:%d (%s)", | ||||||
| 				data->node, resource, ids[i], | 				data->node, resource, ids[i], | ||||||
| 				spa_debug_type_find_name(spa_type_param, ids[i])); | 				spa_debug_type_find_name(spa_type_param, ids[i])); | ||||||
| 		node_enum_params(data, 1, ids[i], 0, UINT32_MAX, NULL); | 		node_enum_params(data, 1, ids[i], 0, UINT32_MAX, NULL); | ||||||
|  | @ -481,7 +482,7 @@ static void result_node_sync(void *data, int seq, int res, uint32_t type, const | ||||||
| { | { | ||||||
| 	struct resource_data *d = data; | 	struct resource_data *d = data; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: sync result %d %d (%d/%d)", d->node, res, seq, d->seq, d->end); | 	pw_log_debug("%p: sync result %d %d (%d/%d)", d->node, res, seq, d->seq, d->end); | ||||||
| 	if (seq == d->end) | 	if (seq == d->end) | ||||||
| 		remove_busy_resource(d); | 		remove_busy_resource(d); | ||||||
| } | } | ||||||
|  | @ -499,7 +500,7 @@ static int node_set_param(void *object, uint32_t id, uint32_t flags, | ||||||
| 		.result = result_node_sync, | 		.result = result_node_sync, | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: resource %p set param id:%d (%s) %08x", node, resource, | 	pw_log_debug("%p: resource %p set param id:%d (%s) %08x", node, resource, | ||||||
| 			id, spa_debug_type_find_name(spa_type_param, id), flags); | 			id, spa_debug_type_find_name(spa_type_param, id), flags); | ||||||
| 
 | 
 | ||||||
| 	res = spa_node_set_param(node->node, id, flags, param); | 	res = spa_node_set_param(node->node, id, flags, param); | ||||||
|  | @ -556,7 +557,7 @@ static void resource_pong(void *data, int seq) | ||||||
| { | { | ||||||
| 	struct resource_data *d = data; | 	struct resource_data *d = data; | ||||||
| 	struct pw_resource *resource = d->resource; | 	struct pw_resource *resource = d->resource; | ||||||
| 	pw_log_debug(NAME" %p: resource %p: got pong %d", d->node, | 	pw_log_debug("%p: resource %p: got pong %d", d->node, | ||||||
| 			resource, seq); | 			resource, seq); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -591,7 +592,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 			&data->object_listener, | 			&data->object_listener, | ||||||
| 			&node_methods, data); | 			&node_methods, data); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 	pw_global_add_resource(global, resource); | 	pw_global_add_resource(global, resource); | ||||||
| 
 | 
 | ||||||
| 	this->info.change_mask = PW_NODE_CHANGE_MASK_ALL; | 	this->info.change_mask = PW_NODE_CHANGE_MASK_ALL; | ||||||
|  | @ -601,7 +602,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error_resource: | error_resource: | ||||||
| 	pw_log_error(NAME" %p: can't create node resource: %m", this); | 	pw_log_error("%p: can't create node resource: %m", this); | ||||||
| 	return -errno; | 	return -errno; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -631,22 +632,22 @@ static inline void insert_driver(struct pw_context *context, struct pw_impl_node | ||||||
| 
 | 
 | ||||||
| static void update_io(struct pw_impl_node *node) | static void update_io(struct pw_impl_node *node) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: id:%d", node, node->info.id); | 	pw_log_debug("%p: id:%d", node, node->info.id); | ||||||
| 
 | 
 | ||||||
| 	if (spa_node_set_io(node->node, | 	if (spa_node_set_io(node->node, | ||||||
| 			    SPA_IO_Position, | 			    SPA_IO_Position, | ||||||
| 			    &node->rt.activation->position, | 			    &node->rt.activation->position, | ||||||
| 			    sizeof(struct spa_io_position)) >= 0) { | 			    sizeof(struct spa_io_position)) >= 0) { | ||||||
| 		pw_log_debug(NAME" %p: set position %p", node, &node->rt.activation->position); | 		pw_log_debug("%p: set position %p", node, &node->rt.activation->position); | ||||||
| 		node->rt.position = &node->rt.activation->position; | 		node->rt.position = &node->rt.activation->position; | ||||||
| 	} else if (node->driver) { | 	} else if (node->driver) { | ||||||
| 		pw_log_warn(NAME" %p: can't set position on driver", node); | 		pw_log_warn("%p: can't set position on driver", node); | ||||||
| 	} | 	} | ||||||
| 	if (spa_node_set_io(node->node, | 	if (spa_node_set_io(node->node, | ||||||
| 			    SPA_IO_Clock, | 			    SPA_IO_Clock, | ||||||
| 			    &node->rt.activation->position.clock, | 			    &node->rt.activation->position.clock, | ||||||
| 			    sizeof(struct spa_io_clock)) >= 0) { | 			    sizeof(struct spa_io_clock)) >= 0) { | ||||||
| 		pw_log_debug(NAME" %p: set clock %p", node, &node->rt.activation->position.clock); | 		pw_log_debug("%p: set clock %p", node, &node->rt.activation->position.clock); | ||||||
| 		node->rt.clock = &node->rt.activation->position.clock; | 		node->rt.clock = &node->rt.activation->position.clock; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -678,7 +679,7 @@ int pw_impl_node_register(struct pw_impl_node *this, | ||||||
| 	struct pw_context *context = this->context; | 	struct pw_context *context = this->context; | ||||||
| 	struct pw_impl_port *port; | 	struct pw_impl_port *port; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: register", this); | 	pw_log_debug("%p: register", this); | ||||||
| 
 | 
 | ||||||
| 	if (this->registered) | 	if (this->registered) | ||||||
| 		goto error_existed; | 		goto error_existed; | ||||||
|  | @ -731,7 +732,7 @@ error_existed: | ||||||
| SPA_EXPORT | SPA_EXPORT | ||||||
| int pw_impl_node_initialized(struct pw_impl_node *this) | int pw_impl_node_initialized(struct pw_impl_node *this) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p initialized", this); | 	pw_log_debug("%p initialized", this); | ||||||
| 	pw_impl_node_emit_initialized(this); | 	pw_impl_node_emit_initialized(this); | ||||||
| 	node_update_state(this, PW_NODE_STATE_SUSPENDED, 0, NULL); | 	node_update_state(this, PW_NODE_STATE_SUSPENDED, 0, NULL); | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -746,16 +747,16 @@ do_move_nodes(struct spa_loop *loop, | ||||||
| 	struct pw_impl_node *node = &impl->this; | 	struct pw_impl_node *node = &impl->this; | ||||||
| 	int res; | 	int res; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: driver:%p->%p", node, node->driver_node, driver); | 	pw_log_trace("%p: driver:%p->%p", node, node->driver_node, driver); | ||||||
| 
 | 
 | ||||||
| 	if ((res = spa_node_set_io(node->node, | 	if ((res = spa_node_set_io(node->node, | ||||||
| 		    SPA_IO_Position, | 		    SPA_IO_Position, | ||||||
| 		    &driver->rt.activation->position, | 		    &driver->rt.activation->position, | ||||||
| 		    sizeof(struct spa_io_position))) < 0) { | 		    sizeof(struct spa_io_position))) < 0) { | ||||||
| 		pw_log_debug(NAME" %p: set position: %s", node, spa_strerror(res)); | 		pw_log_debug("%p: set position: %s", node, spa_strerror(res)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: set position %p", node, &driver->rt.activation->position); | 	pw_log_trace("%p: set position %p", node, &driver->rt.activation->position); | ||||||
| 	node->rt.position = &driver->rt.activation->position; | 	node->rt.position = &driver->rt.activation->position; | ||||||
| 
 | 
 | ||||||
| 	if (node->source.loop != NULL) { | 	if (node->source.loop != NULL) { | ||||||
|  | @ -800,7 +801,7 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv | ||||||
| 	} | 	} | ||||||
| 	node->driving = node->driver && driver == node; | 	node->driving = node->driver && driver == node; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: driver %p driving:%u", node, | 	pw_log_debug("%p: driver %p driving:%u", node, | ||||||
| 		driver, node->driving); | 		driver, node->driving); | ||||||
| 	pw_log_info("(%s-%u) -> change driver (%s-%d -> %s-%d)", | 	pw_log_info("(%s-%u) -> change driver (%s-%d -> %s-%d)", | ||||||
| 			node->name, node->info.id, | 			node->name, node->info.id, | ||||||
|  | @ -827,14 +828,14 @@ static void check_properties(struct pw_impl_node *node) | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(node->properties, PW_KEY_PRIORITY_DRIVER))) { | 	if ((str = pw_properties_get(node->properties, PW_KEY_PRIORITY_DRIVER))) { | ||||||
| 		node->priority_driver = pw_properties_parse_int(str); | 		node->priority_driver = pw_properties_parse_int(str); | ||||||
| 		pw_log_debug(NAME" %p: priority driver %d", node, node->priority_driver); | 		pw_log_debug("%p: priority driver %d", node, node->priority_driver); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(node->properties, PW_KEY_NODE_NAME)) && | 	if ((str = pw_properties_get(node->properties, PW_KEY_NODE_NAME)) && | ||||||
| 	    (node->name == NULL || !spa_streq(node->name, str))) { | 	    (node->name == NULL || !spa_streq(node->name, str))) { | ||||||
| 		free(node->name); | 		free(node->name); | ||||||
| 		node->name = strdup(str); | 		node->name = strdup(str); | ||||||
| 		pw_log_debug(NAME" %p: name '%s'", node, node->name); | 		pw_log_debug("%p: name '%s'", node, node->name); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	str = pw_properties_get(node->properties, PW_KEY_NODE_PAUSE_ON_IDLE); | 	str = pw_properties_get(node->properties, PW_KEY_NODE_PAUSE_ON_IDLE); | ||||||
|  | @ -850,7 +851,7 @@ static void check_properties(struct pw_impl_node *node) | ||||||
| 	driver = str ? pw_properties_parse_bool(str) : false; | 	driver = str ? pw_properties_parse_bool(str) : false; | ||||||
| 
 | 
 | ||||||
| 	if (node->driver != driver) { | 	if (node->driver != driver) { | ||||||
| 		pw_log_debug(NAME" %p: driver %d -> %d", node, node->driver, driver); | 		pw_log_debug("%p: driver %d -> %d", node, node->driver, driver); | ||||||
| 		node->driver = driver; | 		node->driver = driver; | ||||||
| 		if (node->registered) { | 		if (node->registered) { | ||||||
| 			if (driver) | 			if (driver) | ||||||
|  | @ -866,7 +867,7 @@ static void check_properties(struct pw_impl_node *node) | ||||||
| 		str = ""; | 		str = ""; | ||||||
| 
 | 
 | ||||||
| 	if (!spa_streq(str, node->group)) { | 	if (!spa_streq(str, node->group)) { | ||||||
| 		pw_log_info(NAME" %p: group '%s'->'%s'", node, node->group, str); | 		pw_log_info("%p: group '%s'->'%s'", node, node->group, str); | ||||||
| 		snprintf(node->group, sizeof(node->group), "%s", str); | 		snprintf(node->group, sizeof(node->group), "%s", str); | ||||||
| 		node->freewheel = spa_streq(node->group, "pipewire.freewheel"); | 		node->freewheel = spa_streq(node->group, "pipewire.freewheel"); | ||||||
| 		recalc_reason = "group changed"; | 		recalc_reason = "group changed"; | ||||||
|  | @ -920,7 +921,7 @@ static void check_properties(struct pw_impl_node *node) | ||||||
| 	str = pw_properties_get(node->properties, PW_KEY_NODE_LOCK_RATE); | 	str = pw_properties_get(node->properties, PW_KEY_NODE_LOCK_RATE); | ||||||
| 	node->lock_rate = str ? pw_properties_parse_bool(str) : false; | 	node->lock_rate = str ? pw_properties_parse_bool(str) : false; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: driver:%d recalc:%s active:%d", node, node->driver, | 	pw_log_debug("%p: driver:%d recalc:%s active:%d", node, node->driver, | ||||||
| 			recalc_reason, node->active); | 			recalc_reason, node->active); | ||||||
| 
 | 
 | ||||||
| 	if (recalc_reason != NULL && node->active) | 	if (recalc_reason != NULL && node->active) | ||||||
|  | @ -986,13 +987,13 @@ static inline int resume_node(struct pw_impl_node *this, int status) | ||||||
| 	activation->status = PW_NODE_ACTIVATION_FINISHED; | 	activation->status = PW_NODE_ACTIVATION_FINISHED; | ||||||
| 	activation->finish_time = nsec; | 	activation->finish_time = nsec; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace_fp(NAME" %p: trigger peers %"PRIu64, this, nsec); | 	pw_log_trace_fp("%p: trigger peers %"PRIu64, this, nsec); | ||||||
| 
 | 
 | ||||||
| 	spa_list_for_each(t, &this->rt.target_list, link) { | 	spa_list_for_each(t, &this->rt.target_list, link) { | ||||||
| 		struct pw_node_activation *a = t->activation; | 		struct pw_node_activation *a = t->activation; | ||||||
| 		struct pw_node_activation_state *state = &a->state[0]; | 		struct pw_node_activation_state *state = &a->state[0]; | ||||||
| 
 | 
 | ||||||
| 		pw_log_trace_fp(NAME" %p: state:%p pending:%d/%d", t->node, state, | 		pw_log_trace_fp("%p: state:%p pending:%d/%d", t->node, state, | ||||||
|                                 state->pending, state->required); |                                 state->pending, state->required); | ||||||
| 
 | 
 | ||||||
| 		if (pw_node_activation_state_dec(state, 1)) { | 		if (pw_node_activation_state_dec(state, 1)) { | ||||||
|  | @ -1029,7 +1030,7 @@ static inline int process_node(void *data) | ||||||
| 	a->status = PW_NODE_ACTIVATION_AWAKE; | 	a->status = PW_NODE_ACTIVATION_AWAKE; | ||||||
| 	a->awake_time = SPA_TIMESPEC_TO_NSEC(&ts); | 	a->awake_time = SPA_TIMESPEC_TO_NSEC(&ts); | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace_fp(NAME" %p: process %"PRIu64, this, a->awake_time); | 	pw_log_trace_fp("%p: process %"PRIu64, this, a->awake_time); | ||||||
| 
 | 
 | ||||||
| 	/* when transport sync is not supported, just clear the flag */ | 	/* when transport sync is not supported, just clear the flag */ | ||||||
| 	if (!this->transport_sync) | 	if (!this->transport_sync) | ||||||
|  | @ -1055,7 +1056,7 @@ static inline int process_node(void *data) | ||||||
| 		/* calculate CPU time */ | 		/* calculate CPU time */ | ||||||
| 		calculate_stats(this, a); | 		calculate_stats(this, a); | ||||||
| 
 | 
 | ||||||
| 		pw_log_trace_fp(NAME" %p: graph completed wait:%"PRIu64" run:%"PRIu64 | 		pw_log_trace_fp("%p: graph completed wait:%"PRIu64" run:%"PRIu64 | ||||||
| 				" busy:%"PRIu64" period:%"PRIu64" cpu:%f:%f:%f", this, | 				" busy:%"PRIu64" period:%"PRIu64" cpu:%f:%f:%f", this, | ||||||
| 				a->awake_time - a->signal_time, | 				a->awake_time - a->signal_time, | ||||||
| 				a->finish_time - a->awake_time, | 				a->finish_time - a->awake_time, | ||||||
|  | @ -1066,7 +1067,7 @@ static inline int process_node(void *data) | ||||||
| 		pw_context_driver_emit_complete(this->context, this); | 		pw_context_driver_emit_complete(this->context, this); | ||||||
| 
 | 
 | ||||||
| 	} else if (status == SPA_STATUS_OK) { | 	} else if (status == SPA_STATUS_OK) { | ||||||
| 		pw_log_trace_fp(NAME" %p: async continue", this); | 		pw_log_trace_fp("%p: async continue", this); | ||||||
| 	} else { | 	} else { | ||||||
| 		resume_node(this, status); | 		resume_node(this, status); | ||||||
| 	} | 	} | ||||||
|  | @ -1082,7 +1083,7 @@ static void node_on_fd_events(struct spa_source *source) | ||||||
| 	struct spa_system *data_system = this->context->data_system; | 	struct spa_system *data_system = this->context->data_system; | ||||||
| 
 | 
 | ||||||
| 	if (SPA_UNLIKELY(source->rmask & (SPA_IO_ERR | SPA_IO_HUP))) { | 	if (SPA_UNLIKELY(source->rmask & (SPA_IO_ERR | SPA_IO_HUP))) { | ||||||
| 		pw_log_warn(NAME" %p: got socket error %08x", this, source->rmask); | 		pw_log_warn("%p: got socket error %08x", this, source->rmask); | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1090,12 +1091,12 @@ static void node_on_fd_events(struct spa_source *source) | ||||||
| 		uint64_t cmd; | 		uint64_t cmd; | ||||||
| 
 | 
 | ||||||
| 		if (SPA_UNLIKELY(spa_system_eventfd_read(data_system, this->source.fd, &cmd) < 0)) | 		if (SPA_UNLIKELY(spa_system_eventfd_read(data_system, this->source.fd, &cmd) < 0)) | ||||||
| 			pw_log_warn(NAME" %p: read failed %m", this); | 			pw_log_warn("%p: read failed %m", this); | ||||||
| 		else if (SPA_UNLIKELY(cmd > 1)) | 		else if (SPA_UNLIKELY(cmd > 1)) | ||||||
| 			pw_log_info("(%s-%u) client missed %"PRIu64" wakeups", | 			pw_log_info("(%s-%u) client missed %"PRIu64" wakeups", | ||||||
| 				this->name, this->info.id, cmd - 1); | 				this->name, this->info.id, cmd - 1); | ||||||
| 
 | 
 | ||||||
| 		pw_log_trace_fp(NAME" %p: got process", this); | 		pw_log_trace_fp("%p: got process", this); | ||||||
| 		this->rt.target.signal(this->rt.target.data); | 		this->rt.target.signal(this->rt.target.data); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -1165,7 +1166,7 @@ struct pw_impl_node *pw_context_create_node(struct pw_context *context, | ||||||
| 	if ((res = spa_system_eventfd_create(data_system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK)) < 0) | 	if ((res = spa_system_eventfd_create(data_system, SPA_FD_CLOEXEC | SPA_FD_NONBLOCK)) < 0) | ||||||
| 		goto error_clean; | 		goto error_clean; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new fd:%d", this, res); | 	pw_log_debug("%p: new fd:%d", this, res); | ||||||
| 
 | 
 | ||||||
| 	this->source.fd = res; | 	this->source.fd = res; | ||||||
| 	this->source.func = node_on_fd_events; | 	this->source.func = node_on_fd_events; | ||||||
|  | @ -1291,7 +1292,7 @@ static int update_properties(struct pw_impl_node *node, const struct spa_dict *d | ||||||
| 	changed = pw_properties_update_ignore(node->properties, dict, filter ? ignored : NULL); | 	changed = pw_properties_update_ignore(node->properties, dict, filter ? ignored : NULL); | ||||||
| 	node->info.props = &node->properties->dict; | 	node->info.props = &node->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: updated %d properties", node, changed); | 	pw_log_debug("%p: updated %d properties", node, changed); | ||||||
| 
 | 
 | ||||||
| 	if (changed) { | 	if (changed) { | ||||||
| 		check_properties(node); | 		check_properties(node); | ||||||
|  | @ -1317,14 +1318,14 @@ static void node_info(void *data, const struct spa_node_info *info) | ||||||
| 	node->info.max_input_ports = info->max_input_ports; | 	node->info.max_input_ports = info->max_input_ports; | ||||||
| 	node->info.max_output_ports = info->max_output_ports; | 	node->info.max_output_ports = info->max_output_ports; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: flags:%08"PRIx64" change_mask:%08"PRIx64" max_in:%u max_out:%u", | 	pw_log_debug("%p: flags:%08"PRIx64" change_mask:%08"PRIx64" max_in:%u max_out:%u", | ||||||
| 			node, info->flags, info->change_mask, info->max_input_ports, | 			node, info->flags, info->change_mask, info->max_input_ports, | ||||||
| 			info->max_output_ports); | 			info->max_output_ports); | ||||||
| 
 | 
 | ||||||
| 	if (info->change_mask & SPA_NODE_CHANGE_MASK_FLAGS) { | 	if (info->change_mask & SPA_NODE_CHANGE_MASK_FLAGS) { | ||||||
| 		if (node->spa_flags != info->flags) { | 		if (node->spa_flags != info->flags) { | ||||||
| 			flags_changed = node->spa_flags != 0; | 			flags_changed = node->spa_flags != 0; | ||||||
| 			pw_log_debug(NAME" %p: flags %"PRIu64"->%"PRIu64, node, node->spa_flags, info->flags); | 			pw_log_debug("%p: flags %"PRIu64"->%"PRIu64, node, node->spa_flags, info->flags); | ||||||
| 			node->spa_flags = info->flags; | 			node->spa_flags = info->flags; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | @ -1340,7 +1341,7 @@ static void node_info(void *data, const struct spa_node_info *info) | ||||||
| 		for (i = 0; i < node->info.n_params; i++) { | 		for (i = 0; i < node->info.n_params; i++) { | ||||||
| 			uint32_t id = info->params[i].id; | 			uint32_t id = info->params[i].id; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: param %d id:%d (%s) %08x:%08x", node, i, | 			pw_log_debug("%p: param %d id:%d (%s) %08x:%08x", node, i, | ||||||
| 					id, spa_debug_type_find_name(spa_type_param, id), | 					id, spa_debug_type_find_name(spa_type_param, id), | ||||||
| 					node->info.params[i].flags, info->params[i].flags); | 					node->info.params[i].flags, info->params[i].flags); | ||||||
| 
 | 
 | ||||||
|  | @ -1348,7 +1349,7 @@ static void node_info(void *data, const struct spa_node_info *info) | ||||||
| 			if (node->info.params[i].flags == info->params[i].flags) | 			if (node->info.params[i].flags == info->params[i].flags) | ||||||
| 				continue; | 				continue; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: update param %d", node, id); | 			pw_log_debug("%p: update param %d", node, id); | ||||||
| 			node->info.params[i] = info->params[i]; | 			node->info.params[i] = info->params[i]; | ||||||
| 			node->info.params[i].user = 0; | 			node->info.params[i].user = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -1373,27 +1374,27 @@ static void node_port_info(void *data, enum spa_direction direction, uint32_t po | ||||||
| 
 | 
 | ||||||
| 	if (info == NULL) { | 	if (info == NULL) { | ||||||
| 		if (port) { | 		if (port) { | ||||||
| 			pw_log_debug(NAME" %p: %s port %d removed", node, | 			pw_log_debug("%p: %s port %d removed", node, | ||||||
| 					pw_direction_as_string(direction), port_id); | 					pw_direction_as_string(direction), port_id); | ||||||
| 			pw_impl_port_destroy(port); | 			pw_impl_port_destroy(port); | ||||||
| 		} else { | 		} else { | ||||||
| 			pw_log_warn(NAME" %p: %s port %d unknown", node, | 			pw_log_warn("%p: %s port %d unknown", node, | ||||||
| 					pw_direction_as_string(direction), port_id); | 					pw_direction_as_string(direction), port_id); | ||||||
| 		} | 		} | ||||||
| 	} else if (port) { | 	} else if (port) { | ||||||
| 		pw_log_debug(NAME" %p: %s port %d changed", node, | 		pw_log_debug("%p: %s port %d changed", node, | ||||||
| 				pw_direction_as_string(direction), port_id); | 				pw_direction_as_string(direction), port_id); | ||||||
| 		pw_impl_port_update_info(port, info); | 		pw_impl_port_update_info(port, info); | ||||||
| 	} else { | 	} else { | ||||||
| 		int res; | 		int res; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: %s port %d added", node, | 		pw_log_debug("%p: %s port %d added", node, | ||||||
| 				pw_direction_as_string(direction), port_id); | 				pw_direction_as_string(direction), port_id); | ||||||
| 
 | 
 | ||||||
| 		if ((port = pw_context_create_port(node->context, direction, port_id, info, | 		if ((port = pw_context_create_port(node->context, direction, port_id, info, | ||||||
| 					node->port_user_data_size))) { | 					node->port_user_data_size))) { | ||||||
| 			if ((res = pw_impl_port_add(port, node)) < 0) { | 			if ((res = pw_impl_port_add(port, node)) < 0) { | ||||||
| 				pw_log_error(NAME" %p: can't add port %p: %d, %s", | 				pw_log_error("%p: can't add port %p: %d, %s", | ||||||
| 						node, port, res, spa_strerror(res)); | 						node, port, res, spa_strerror(res)); | ||||||
| 				pw_impl_port_destroy(port); | 				pw_impl_port_destroy(port); | ||||||
| 			} | 			} | ||||||
|  | @ -1406,7 +1407,7 @@ static void node_result(void *data, int seq, int res, uint32_t type, const void | ||||||
| 	struct pw_impl_node *node = data; | 	struct pw_impl_node *node = data; | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: result seq:%d res:%d type:%u", node, seq, res, type); | 	pw_log_trace("%p: result seq:%d res:%d type:%u", node, seq, res, type); | ||||||
| 	if (res < 0) | 	if (res < 0) | ||||||
| 		impl->last_error = res; | 		impl->last_error = res; | ||||||
| 
 | 
 | ||||||
|  | @ -1421,7 +1422,7 @@ static void node_event(void *data, const struct spa_event *event) | ||||||
| 	struct pw_impl_node *node = data; | 	struct pw_impl_node *node = data; | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: event %d", node, SPA_EVENT_TYPE(event)); | 	pw_log_trace("%p: event %d", node, SPA_EVENT_TYPE(event)); | ||||||
| 
 | 
 | ||||||
| 	switch (SPA_NODE_EVENT_ID(event)) { | 	switch (SPA_NODE_EVENT_ID(event)) { | ||||||
| 	case SPA_NODE_EVENT_Error: | 	case SPA_NODE_EVENT_Error: | ||||||
|  | @ -1461,7 +1462,7 @@ static int check_updates(struct pw_impl_node *node, uint32_t *reposition_owner) | ||||||
| 	*reposition_owner = ATOMIC_XCHG(a->reposition_owner, 0); | 	*reposition_owner = ATOMIC_XCHG(a->reposition_owner, 0); | ||||||
| 
 | 
 | ||||||
| 	if (SPA_UNLIKELY(command != PW_NODE_ACTIVATION_COMMAND_NONE)) { | 	if (SPA_UNLIKELY(command != PW_NODE_ACTIVATION_COMMAND_NONE)) { | ||||||
| 		pw_log_debug(NAME" %p: update command:%u", node, command); | 		pw_log_debug("%p: update command:%u", node, command); | ||||||
| 		switch (command) { | 		switch (command) { | ||||||
| 		case PW_NODE_ACTIVATION_COMMAND_STOP: | 		case PW_NODE_ACTIVATION_COMMAND_STOP: | ||||||
| 			a->position.state = SPA_IO_POSITION_STATE_STOPPED; | 			a->position.state = SPA_IO_POSITION_STATE_STOPPED; | ||||||
|  | @ -1487,7 +1488,7 @@ static void do_reposition(struct pw_impl_node *driver, struct pw_impl_node *node | ||||||
| 	src = &node->rt.activation->reposition; | 	src = &node->rt.activation->reposition; | ||||||
| 	dst = &a->position.segments[0]; | 	dst = &a->position.segments[0]; | ||||||
| 
 | 
 | ||||||
| 	pw_log_info(NAME" %p: update position:%"PRIu64, node, src->position); | 	pw_log_info("%p: update position:%"PRIu64, node, src->position); | ||||||
| 
 | 
 | ||||||
| 	dst->version = src->version; | 	dst->version = src->version; | ||||||
| 	dst->flags = src->flags; | 	dst->flags = src->flags; | ||||||
|  | @ -1539,7 +1540,7 @@ static int node_ready(void *data, int status) | ||||||
| 	struct pw_node_target *t; | 	struct pw_node_target *t; | ||||||
| 	struct pw_impl_port *p; | 	struct pw_impl_port *p; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace_fp(NAME" %p: ready driver:%d exported:%d %p status:%d", node, | 	pw_log_trace_fp("%p: ready driver:%d exported:%d %p status:%d", node, | ||||||
| 			node->driver, node->exported, driver, status); | 			node->driver, node->exported, driver, status); | ||||||
| 
 | 
 | ||||||
| 	if (SPA_UNLIKELY(node == driver)) { | 	if (SPA_UNLIKELY(node == driver)) { | ||||||
|  | @ -1683,10 +1684,10 @@ int pw_impl_node_set_implementation(struct pw_impl_node *node, | ||||||
| { | { | ||||||
| 	int res; | 	int res; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: implementation %p", node, spa_node); | 	pw_log_debug("%p: implementation %p", node, spa_node); | ||||||
| 
 | 
 | ||||||
| 	if (node->node) { | 	if (node->node) { | ||||||
| 		pw_log_error(NAME" %p: implementation existed %p", node, node->node); | 		pw_log_error("%p: implementation existed %p", node, node->node); | ||||||
| 		return -EEXIST; | 		return -EEXIST; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1732,14 +1733,14 @@ void pw_impl_node_destroy(struct pw_impl_node *node) | ||||||
| 	active = node->active; | 	active = node->active; | ||||||
| 	node->active = false; | 	node->active = false; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", impl); | 	pw_log_debug("%p: destroy", impl); | ||||||
| 	pw_log_info("(%s-%u) destroy", node->name, node->info.id); | 	pw_log_info("(%s-%u) destroy", node->name, node->info.id); | ||||||
| 
 | 
 | ||||||
| 	suspend_node(node); | 	suspend_node(node); | ||||||
| 
 | 
 | ||||||
| 	pw_impl_node_emit_destroy(node); | 	pw_impl_node_emit_destroy(node); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: driver node %p", impl, node->driver_node); | 	pw_log_debug("%p: driver node %p", impl, node->driver_node); | ||||||
| 	had_driver = node != node->driver_node; | 	had_driver = node != node->driver_node; | ||||||
| 
 | 
 | ||||||
| 	/* remove ourself as a follower from the driver node */ | 	/* remove ourself as a follower from the driver node */ | ||||||
|  | @ -1747,7 +1748,7 @@ void pw_impl_node_destroy(struct pw_impl_node *node) | ||||||
| 	remove_segment_owner(node->driver_node, node->info.id); | 	remove_segment_owner(node->driver_node, node->info.id); | ||||||
| 
 | 
 | ||||||
| 	spa_list_consume(follower, &node->follower_list, follower_link) { | 	spa_list_consume(follower, &node->follower_list, follower_link) { | ||||||
| 		pw_log_debug(NAME" %p: reassign follower %p", impl, follower); | 		pw_log_debug("%p: reassign follower %p", impl, follower); | ||||||
| 		pw_impl_node_set_driver(follower, NULL); | 		pw_impl_node_set_driver(follower, NULL); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -1762,7 +1763,7 @@ void pw_impl_node_destroy(struct pw_impl_node *node) | ||||||
| 		spa_node_set_callbacks(node->node, NULL, NULL); | 		spa_node_set_callbacks(node->node, NULL, NULL); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy ports", node); | 	pw_log_debug("%p: destroy ports", node); | ||||||
| 	spa_list_consume(port, &node->input_ports, link) | 	spa_list_consume(port, &node->input_ports, link) | ||||||
| 		pw_impl_port_destroy(port); | 		pw_impl_port_destroy(port); | ||||||
| 	spa_list_consume(port, &node->output_ports, link) | 	spa_list_consume(port, &node->output_ports, link) | ||||||
|  | @ -1777,7 +1778,7 @@ void pw_impl_node_destroy(struct pw_impl_node *node) | ||||||
| 		pw_context_recalc_graph(node->context, | 		pw_context_recalc_graph(node->context, | ||||||
| 				"active node destroy"); | 				"active node destroy"); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free", node); | 	pw_log_debug("%p: free", node); | ||||||
| 	pw_impl_node_emit_free(node); | 	pw_impl_node_emit_free(node); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_clean(&node->listener_list); | 	spa_hook_list_clean(&node->listener_list); | ||||||
|  | @ -1882,7 +1883,7 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node, | ||||||
| 	if (max == 0) | 	if (max == 0) | ||||||
| 		max = UINT32_MAX; | 		max = UINT32_MAX; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: params id:%d (%s) index:%u max:%u cached:%d", node, param_id, | 	pw_log_debug("%p: params id:%d (%s) index:%u max:%u cached:%d", node, param_id, | ||||||
| 			spa_debug_type_find_name(spa_type_param, param_id), | 			spa_debug_type_find_name(spa_type_param, param_id), | ||||||
| 			index, max, pi->user); | 			index, max, pi->user); | ||||||
| 
 | 
 | ||||||
|  | @ -1908,7 +1909,7 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node, | ||||||
| 			if (spa_pod_filter(&b, &result.param, p->param, filter) != 0) | 			if (spa_pod_filter(&b, &result.param, p->param, filter) != 0) | ||||||
| 				continue; | 				continue; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME " %p: %d param %u", node, seq, result.index); | 			pw_log_debug("%p: %d param %u", node, seq, result.index); | ||||||
| 			result_node_params(&user_data, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result); | 			result_node_params(&user_data, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result); | ||||||
| 
 | 
 | ||||||
| 			if (++count == max) | 			if (++count == max) | ||||||
|  | @ -1938,7 +1939,7 @@ SPA_EXPORT | ||||||
| int pw_impl_node_set_param(struct pw_impl_node *node, | int pw_impl_node_set_param(struct pw_impl_node *node, | ||||||
| 		uint32_t id, uint32_t flags, const struct spa_pod *param) | 		uint32_t id, uint32_t flags, const struct spa_pod *param) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: set_param id:%d (%s) flags:%08x param:%p", node, id, | 	pw_log_debug("%p: set_param id:%d (%s) flags:%08x param:%p", node, id, | ||||||
| 			spa_debug_type_find_name(spa_type_param, id), flags, param); | 			spa_debug_type_find_name(spa_type_param, id), flags, param); | ||||||
| 	return spa_node_set_param(node->node, id, flags, param); | 	return spa_node_set_param(node->node, id, flags, param); | ||||||
| } | } | ||||||
|  | @ -1974,7 +1975,7 @@ pw_impl_node_find_port(struct pw_impl_node *node, enum pw_direction direction, u | ||||||
| 				port = p; | 				port = p; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	pw_log_debug(NAME" %p: return %s port %d: %p", node, | 	pw_log_debug("%p: return %s port %d: %p", node, | ||||||
| 			pw_direction_as_string(direction), port_id, port); | 			pw_direction_as_string(direction), port_id, port); | ||||||
| 	return port; | 	return port; | ||||||
| } | } | ||||||
|  | @ -1999,7 +2000,7 @@ uint32_t pw_impl_node_get_free_port_id(struct pw_impl_node *node, enum pw_direct | ||||||
| 		portmap = &node->output_port_map; | 		portmap = &node->output_port_map; | ||||||
| 		dynamic = SPA_FLAG_IS_SET(node->spa_flags, SPA_NODE_FLAG_OUT_DYNAMIC_PORTS); | 		dynamic = SPA_FLAG_IS_SET(node->spa_flags, SPA_NODE_FLAG_OUT_DYNAMIC_PORTS); | ||||||
| 	} | 	} | ||||||
| 	pw_log_debug(NAME" %p: direction %s n_ports:%u max_ports:%u", | 	pw_log_debug("%p: direction %s n_ports:%u max_ports:%u", | ||||||
| 			node, pw_direction_as_string(direction), n_ports, max_ports); | 			node, pw_direction_as_string(direction), n_ports, max_ports); | ||||||
| 
 | 
 | ||||||
| 	if (!dynamic || n_ports >= max_ports) { | 	if (!dynamic || n_ports >= max_ports) { | ||||||
|  | @ -2013,12 +2014,12 @@ uint32_t pw_impl_node_get_free_port_id(struct pw_impl_node *node, enum pw_direct | ||||||
| 		goto error; | 		goto error; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free port %d", node, port_id); | 	pw_log_debug("%p: free port %d", node, port_id); | ||||||
| 
 | 
 | ||||||
| 	return port_id; | 	return port_id; | ||||||
| 
 | 
 | ||||||
| error: | error: | ||||||
| 	pw_log_warn(NAME" %p: no more port available: %s", node, spa_strerror(res)); | 	pw_log_warn("%p: no more port available: %s", node, spa_strerror(res)); | ||||||
| 	errno = -res; | 	errno = -res; | ||||||
| 	return SPA_ID_INVALID; | 	return SPA_ID_INVALID; | ||||||
| } | } | ||||||
|  | @ -2033,7 +2034,7 @@ static void on_state_complete(void *obj, void *data, int res, uint32_t seq) | ||||||
| 	impl->pending_id = SPA_ID_INVALID; | 	impl->pending_id = SPA_ID_INVALID; | ||||||
| 	impl->pending_play = false; | 	impl->pending_play = false; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: state complete res:%d seq:%d", node, res, seq); | 	pw_log_debug("%p: state complete res:%d seq:%d", node, res, seq); | ||||||
| 	if (impl->last_error < 0) { | 	if (impl->last_error < 0) { | ||||||
| 		res = impl->last_error; | 		res = impl->last_error; | ||||||
| 		impl->last_error = 0; | 		impl->last_error = 0; | ||||||
|  | @ -2054,7 +2055,7 @@ static void node_activate(struct pw_impl_node *this) | ||||||
| { | { | ||||||
| 	struct pw_impl_port *port; | 	struct pw_impl_port *port; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: activate", this); | 	pw_log_debug("%p: activate", this); | ||||||
| 	spa_list_for_each(port, &this->input_ports, link) { | 	spa_list_for_each(port, &this->input_ports, link) { | ||||||
| 		struct pw_impl_link *link; | 		struct pw_impl_link *link; | ||||||
| 		spa_list_for_each(link, &port->links, input_link) | 		spa_list_for_each(link, &port->links, input_link) | ||||||
|  | @ -2081,7 +2082,7 @@ int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state) | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this); | ||||||
| 	enum pw_node_state old = impl->pending; | 	enum pw_node_state old = impl->pending; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: set state (%s) %s -> %s, active %d pause_on_idle:%d", node, | 	pw_log_debug("%p: set state (%s) %s -> %s, active %d pause_on_idle:%d", node, | ||||||
| 			pw_node_state_as_string(node->info.state), | 			pw_node_state_as_string(node->info.state), | ||||||
| 			pw_node_state_as_string(old), | 			pw_node_state_as_string(old), | ||||||
| 			pw_node_state_as_string(state), | 			pw_node_state_as_string(state), | ||||||
|  | @ -2151,7 +2152,7 @@ int pw_impl_node_set_active(struct pw_impl_node *node, bool active) | ||||||
| 	bool old = node->active; | 	bool old = node->active; | ||||||
| 
 | 
 | ||||||
| 	if (old != active) { | 	if (old != active) { | ||||||
| 		pw_log_debug(NAME" %p: %s", node, active ? "activate" : "deactivate"); | 		pw_log_debug("%p: %s", node, active ? "activate" : "deactivate"); | ||||||
| 
 | 
 | ||||||
| 		node->active = active; | 		node->active = active; | ||||||
| 		pw_impl_node_emit_active_changed(node, active); | 		pw_impl_node_emit_active_changed(node, active); | ||||||
|  |  | ||||||
|  | @ -40,6 +40,9 @@ | ||||||
| 
 | 
 | ||||||
| #define NAME "port" | #define NAME "port" | ||||||
| 
 | 
 | ||||||
|  | PW_LOG_TOPIC_EXTERN(log_port); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_port | ||||||
|  | 
 | ||||||
| /** \cond */ | /** \cond */ | ||||||
| struct impl { | struct impl { | ||||||
| 	struct pw_impl_port this; | 	struct pw_impl_port this; | ||||||
|  | @ -135,9 +138,9 @@ static int tee_process(void *object) | ||||||
| 	struct pw_impl_port_mix *mix; | 	struct pw_impl_port_mix *mix; | ||||||
| 	struct spa_io_buffers *io = &this->rt.io; | 	struct spa_io_buffers *io = &this->rt.io; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace_fp(NAME" %p: tee input %d %d", this, io->status, io->buffer_id); | 	pw_log_trace_fp("%p: tee input %d %d", this, io->status, io->buffer_id); | ||||||
| 	spa_list_for_each(mix, &this->rt.mix_list, rt_link) { | 	spa_list_for_each(mix, &this->rt.mix_list, rt_link) { | ||||||
| 		pw_log_trace_fp(NAME" %p: port %d %p->%p %d", this, | 		pw_log_trace_fp("%p: port %d %p->%p %d", this, | ||||||
| 				mix->port.port_id, io, mix->io, mix->io->buffer_id); | 				mix->port.port_id, io, mix->io, mix->io->buffer_id); | ||||||
| 		*mix->io = *io; | 		*mix->io = *io; | ||||||
| 	} | 	} | ||||||
|  | @ -151,7 +154,7 @@ static int tee_reuse_buffer(void *object, uint32_t port_id, uint32_t buffer_id) | ||||||
| 	struct impl *impl = object; | 	struct impl *impl = object; | ||||||
| 	struct pw_impl_port *this = &impl->this; | 	struct pw_impl_port *this = &impl->this; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace_fp(NAME" %p: tee reuse buffer %d %d", this, port_id, buffer_id); | 	pw_log_trace_fp("%p: tee reuse buffer %d %d", this, port_id, buffer_id); | ||||||
| 	spa_node_port_reuse_buffer(this->node->node, this->port_id, buffer_id); | 	spa_node_port_reuse_buffer(this->node->node, this->port_id, buffer_id); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -174,7 +177,7 @@ static int schedule_mix_input(void *object) | ||||||
| 		return SPA_STATUS_HAVE_DATA | SPA_STATUS_NEED_DATA; | 		return SPA_STATUS_HAVE_DATA | SPA_STATUS_NEED_DATA; | ||||||
| 
 | 
 | ||||||
| 	spa_list_for_each(mix, &this->rt.mix_list, rt_link) { | 	spa_list_for_each(mix, &this->rt.mix_list, rt_link) { | ||||||
| 		pw_log_trace_fp(NAME" %p: mix input %d %p->%p %d %d", this, | 		pw_log_trace_fp("%p: mix input %d %p->%p %d %d", this, | ||||||
| 				mix->port.port_id, mix->io, io, mix->io->status, mix->io->buffer_id); | 				mix->port.port_id, mix->io, io, mix->io->status, mix->io->buffer_id); | ||||||
| 		*io = *mix->io; | 		*io = *mix->io; | ||||||
| 		mix->io->status = SPA_STATUS_NEED_DATA; | 		mix->io->status = SPA_STATUS_NEED_DATA; | ||||||
|  | @ -190,7 +193,7 @@ static int schedule_mix_reuse_buffer(void *object, uint32_t port_id, uint32_t bu | ||||||
| 	struct pw_impl_port_mix *mix; | 	struct pw_impl_port_mix *mix; | ||||||
| 
 | 
 | ||||||
| 	spa_list_for_each(mix, &this->rt.mix_list, rt_link) { | 	spa_list_for_each(mix, &this->rt.mix_list, rt_link) { | ||||||
| 		pw_log_trace_fp(NAME" %p: reuse buffer %d %d", this, port_id, buffer_id); | 		pw_log_trace_fp("%p: reuse buffer %d %d", this, port_id, buffer_id); | ||||||
| 		/* FIXME send reuse buffer to peer */ | 		/* FIXME send reuse buffer to peer */ | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
|  | @ -241,7 +244,7 @@ int pw_impl_port_init_mix(struct pw_impl_port *port, struct pw_impl_port_mix *mi | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: init mix n_mix:%d %d.%d io:%p: (%s)", port, | 	pw_log_debug("%p: init mix n_mix:%d %d.%d io:%p: (%s)", port, | ||||||
| 			port->n_mix, port->port_id, mix->port.port_id, | 			port->n_mix, port->port_id, mix->port.port_id, | ||||||
| 			mix->io, spa_strerror(res)); | 			mix->io, spa_strerror(res)); | ||||||
| 
 | 
 | ||||||
|  | @ -262,7 +265,7 @@ int pw_impl_port_release_mix(struct pw_impl_port *port, struct pw_impl_port_mix | ||||||
| 
 | 
 | ||||||
| 	spa_node_remove_port(port->mix, port->direction, port_id); | 	spa_node_remove_port(port->mix, port->direction, port_id); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: release mix %d %d.%d", port, | 	pw_log_debug("%p: release mix %d %d.%d", port, | ||||||
| 			port->n_mix, port->port_id, mix->port.port_id); | 			port->n_mix, port->port_id, mix->port.port_id); | ||||||
| 
 | 
 | ||||||
| 	return res; | 	return res; | ||||||
|  | @ -285,7 +288,7 @@ static int update_properties(struct pw_impl_port *port, const struct spa_dict *d | ||||||
| 	port->info.props = &port->properties->dict; | 	port->info.props = &port->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	if (changed) { | 	if (changed) { | ||||||
| 		pw_log_debug(NAME" %p: updated %d properties", port, changed); | 		pw_log_debug("%p: updated %d properties", port, changed); | ||||||
| 		port->info.change_mask |= PW_PORT_CHANGE_MASK_PROPS; | 		port->info.change_mask |= PW_PORT_CHANGE_MASK_PROPS; | ||||||
| 	} | 	} | ||||||
| 	return changed; | 	return changed; | ||||||
|  | @ -313,7 +316,7 @@ static int notify_param(void *data, int seq, uint32_t id, | ||||||
| 		if (!resource_is_subscribed(resource, id)) | 		if (!resource_is_subscribed(resource, id)) | ||||||
| 			continue; | 			continue; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: resource %p notify param %d", port, resource, id); | 		pw_log_debug("%p: resource %p notify param %d", port, resource, id); | ||||||
| 		pw_port_resource_param(resource, seq, id, index, next, param); | 		pw_port_resource_param(resource, seq, id, index, next, param); | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -327,13 +330,13 @@ static void emit_params(struct pw_impl_port *port, uint32_t *changed_ids, uint32 | ||||||
| 	if (port->global == NULL) | 	if (port->global == NULL) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: emit %d params", port, n_changed_ids); | 	pw_log_debug("%p: emit %d params", port, n_changed_ids); | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < n_changed_ids; i++) { | 	for (i = 0; i < n_changed_ids; i++) { | ||||||
| 		struct pw_resource *resource; | 		struct pw_resource *resource; | ||||||
| 		int subscribed = 0; | 		int subscribed = 0; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: emit param %d/%d: %d", port, i, n_changed_ids, | 		pw_log_debug("%p: emit param %d/%d: %d", port, i, n_changed_ids, | ||||||
| 				changed_ids[i]); | 				changed_ids[i]); | ||||||
| 
 | 
 | ||||||
| 		pw_impl_port_emit_param_changed(port, changed_ids[i]); | 		pw_impl_port_emit_param_changed(port, changed_ids[i]); | ||||||
|  | @ -348,7 +351,7 @@ static void emit_params(struct pw_impl_port *port, uint32_t *changed_ids, uint32 | ||||||
| 
 | 
 | ||||||
| 		if ((res = pw_impl_port_for_each_param(port, 1, changed_ids[i], 0, UINT32_MAX, | 		if ((res = pw_impl_port_for_each_param(port, 1, changed_ids[i], 0, UINT32_MAX, | ||||||
| 					NULL, notify_param, port)) < 0) { | 					NULL, notify_param, port)) < 0) { | ||||||
| 			pw_log_error(NAME" %p: error %d (%s)", port, res, spa_strerror(res)); | 			pw_log_error("%p: error %d (%s)", port, res, spa_strerror(res)); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  | @ -384,7 +387,7 @@ static void update_info(struct pw_impl_port *port, const struct spa_port_info *i | ||||||
| { | { | ||||||
| 	uint32_t changed_ids[MAX_PARAMS], n_changed_ids = 0; | 	uint32_t changed_ids[MAX_PARAMS], n_changed_ids = 0; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: %p flags:%08"PRIx64" change_mask:%08"PRIx64, | 	pw_log_debug("%p: %p flags:%08"PRIx64" change_mask:%08"PRIx64, | ||||||
| 			port, info, info->flags, info->change_mask); | 			port, info, info->flags, info->change_mask); | ||||||
| 
 | 
 | ||||||
| 	if (info->change_mask & SPA_PORT_CHANGE_MASK_FLAGS) { | 	if (info->change_mask & SPA_PORT_CHANGE_MASK_FLAGS) { | ||||||
|  | @ -394,7 +397,7 @@ static void update_info(struct pw_impl_port *port, const struct spa_port_info *i | ||||||
| 		if (info->props) { | 		if (info->props) { | ||||||
| 			update_properties(port, info->props, true); | 			update_properties(port, info->props, true); | ||||||
| 		} else { | 		} else { | ||||||
| 			pw_log_warn(NAME" %p: port PROPS update but no properties", port); | 			pw_log_warn("%p: port PROPS update but no properties", port); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	if (info->change_mask & SPA_PORT_CHANGE_MASK_PARAMS) { | 	if (info->change_mask & SPA_PORT_CHANGE_MASK_PARAMS) { | ||||||
|  | @ -406,7 +409,7 @@ static void update_info(struct pw_impl_port *port, const struct spa_port_info *i | ||||||
| 		for (i = 0; i < port->info.n_params; i++) { | 		for (i = 0; i < port->info.n_params; i++) { | ||||||
| 			uint32_t id = info->params[i].id; | 			uint32_t id = info->params[i].id; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: param %d id:%d (%s) %08x:%08x", port, i, | 			pw_log_debug("%p: param %d id:%d (%s) %08x:%08x", port, i, | ||||||
| 					id, spa_debug_type_find_name(spa_type_param, id), | 					id, spa_debug_type_find_name(spa_type_param, id), | ||||||
| 					port->info.params[i].flags, info->params[i].flags); | 					port->info.params[i].flags, info->params[i].flags); | ||||||
| 
 | 
 | ||||||
|  | @ -414,7 +417,7 @@ static void update_info(struct pw_impl_port *port, const struct spa_port_info *i | ||||||
| 			if (port->info.params[i].flags == info->params[i].flags) | 			if (port->info.params[i].flags == info->params[i].flags) | ||||||
| 				continue; | 				continue; | ||||||
| 
 | 
 | ||||||
| 			pw_log_debug(NAME" %p: update param %d", port, id); | 			pw_log_debug("%p: update param %d", port, id); | ||||||
| 			port->info.params[i] = info->params[i]; | 			port->info.params[i] = info->params[i]; | ||||||
| 			port->info.params[i].user = 0; | 			port->info.params[i].user = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -462,7 +465,7 @@ struct pw_impl_port *pw_context_create_port( | ||||||
| 	impl->cache_params = true; | 	impl->cache_params = true; | ||||||
| 
 | 
 | ||||||
| 	this = &impl->this; | 	this = &impl->this; | ||||||
| 	pw_log_debug(NAME" %p: new %s %d", this, | 	pw_log_debug("%p: new %s %d", this, | ||||||
| 			pw_direction_as_string(direction), port_id); | 			pw_direction_as_string(direction), port_id); | ||||||
| 
 | 
 | ||||||
| 	if (info && info->change_mask & SPA_PORT_CHANGE_MASK_PROPS && info->props) | 	if (info && info->change_mask & SPA_PORT_CHANGE_MASK_PROPS && info->props) | ||||||
|  | @ -529,7 +532,7 @@ struct pw_impl_port *pw_context_create_port( | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
| error_no_mem: | error_no_mem: | ||||||
| 	pw_log_warn(NAME" %p: new failed", impl); | 	pw_log_warn("%p: new failed", impl); | ||||||
| 	free(impl); | 	free(impl); | ||||||
| 	errno = -res; | 	errno = -res; | ||||||
| 	return NULL; | 	return NULL; | ||||||
|  | @ -546,7 +549,7 @@ int pw_impl_port_set_mix(struct pw_impl_port *port, struct spa_node *node, uint3 | ||||||
| 		flags = 0; | 		flags = 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: mix node %p->%p", port, port->mix, node); | 	pw_log_debug("%p: mix node %p->%p", port, port->mix, node); | ||||||
| 
 | 
 | ||||||
| 	if (port->mix != NULL && port->mix != node) { | 	if (port->mix != NULL && port->mix != node) { | ||||||
| 		spa_list_for_each(mix, &port->mix_list, link) | 		spa_list_for_each(mix, &port->mix_list, link) | ||||||
|  | @ -588,7 +591,7 @@ static int setup_mixer(struct pw_impl_port *port, const struct spa_pod *param) | ||||||
| 	if ((res = spa_format_parse(param, &media_type, &media_subtype)) < 0) | 	if ((res = spa_format_parse(param, &media_type, &media_subtype)) < 0) | ||||||
| 		return res; | 		return res; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: %s/%s", port, | 	pw_log_debug("%p: %s/%s", port, | ||||||
| 			spa_debug_type_find_name(spa_type_media_type, media_type), | 			spa_debug_type_find_name(spa_type_media_type, media_type), | ||||||
| 			spa_debug_type_find_name(spa_type_media_subtype, media_subtype)); | 			spa_debug_type_find_name(spa_type_media_subtype, media_subtype)); | ||||||
| 
 | 
 | ||||||
|  | @ -717,7 +720,7 @@ static int do_add_port(struct spa_loop *loop, | ||||||
| { | { | ||||||
|         struct pw_impl_port *this = user_data; |         struct pw_impl_port *this = user_data; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: add port", this); | 	pw_log_trace("%p: add port", this); | ||||||
| 	if (this->direction == PW_DIRECTION_INPUT) | 	if (this->direction == PW_DIRECTION_INPUT) | ||||||
| 		spa_list_append(&this->node->rt.input_mix, &this->rt.node_link); | 		spa_list_append(&this->node->rt.input_mix, &this->rt.node_link); | ||||||
| 	else | 	else | ||||||
|  | @ -739,7 +742,7 @@ static int check_param_io(void *data, int seq, uint32_t id, | ||||||
| 			SPA_PARAM_IO_size, SPA_POD_Int(&psize)) < 0) | 			SPA_PARAM_IO_size, SPA_POD_Int(&psize)) < 0) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: got io id:%d (%s)", port, pid, | 	pw_log_debug("%p: got io id:%d (%s)", port, pid, | ||||||
| 			spa_debug_type_find_name(spa_type_io, pid)); | 			spa_debug_type_find_name(spa_type_io, pid)); | ||||||
| 
 | 
 | ||||||
| 	switch (pid) { | 	switch (pid) { | ||||||
|  | @ -762,7 +765,7 @@ static int reply_param(void *data, int seq, uint32_t id, | ||||||
| { | { | ||||||
| 	struct resource_data *d = data; | 	struct resource_data *d = data; | ||||||
| 	struct pw_resource *resource = d->resource; | 	struct pw_resource *resource = d->resource; | ||||||
| 	pw_log_debug(NAME" %p: resource %p reply param %u %u %u", d->port, | 	pw_log_debug("%p: resource %p reply param %u %u %u", d->port, | ||||||
| 			resource, id, index, next); | 			resource, id, index, next); | ||||||
| 	pw_port_resource_param(resource, seq, id, index, next, param); | 	pw_port_resource_param(resource, seq, id, index, next, param); | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -776,7 +779,7 @@ static int port_enum_params(void *object, int seq, uint32_t id, uint32_t index, | ||||||
| 	struct pw_impl_port *port = data->port; | 	struct pw_impl_port *port = data->port; | ||||||
| 	int res; | 	int res; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: resource %p enum params seq:%d id:%d (%s) index:%u num:%u", port, | 	pw_log_debug("%p: resource %p enum params seq:%d id:%d (%s) index:%u num:%u", port, | ||||||
| 			resource, seq, id, spa_debug_type_find_name(spa_type_param, id), | 			resource, seq, id, spa_debug_type_find_name(spa_type_param, id), | ||||||
| 			index, num); | 			index, num); | ||||||
| 
 | 
 | ||||||
|  | @ -799,7 +802,7 @@ static int port_subscribe_params(void *object, uint32_t *ids, uint32_t n_ids) | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < n_ids; i++) { | 	for (i = 0; i < n_ids; i++) { | ||||||
| 		data->subscribe_ids[i] = ids[i]; | 		data->subscribe_ids[i] = ids[i]; | ||||||
| 		pw_log_debug(NAME" %p: resource %p subscribe param id:%d (%s)", data->port, | 		pw_log_debug("%p: resource %p subscribe param id:%d (%s)", data->port, | ||||||
| 				resource, ids[i], | 				resource, ids[i], | ||||||
| 				spa_debug_type_find_name(spa_type_param, ids[i])); | 				spa_debug_type_find_name(spa_type_param, ids[i])); | ||||||
| 		port_enum_params(data, 1, ids[i], 0, UINT32_MAX, NULL); | 		port_enum_params(data, 1, ids[i], 0, UINT32_MAX, NULL); | ||||||
|  | @ -852,7 +855,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 			&data->object_listener, | 			&data->object_listener, | ||||||
| 			&port_methods, data); | 			&port_methods, data); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: bound to %d", this, resource->id); | 	pw_log_debug("%p: bound to %d", this, resource->id); | ||||||
| 	pw_global_add_resource(global, resource); | 	pw_global_add_resource(global, resource); | ||||||
| 
 | 
 | ||||||
| 	this->info.change_mask = PW_PORT_CHANGE_MASK_ALL; | 	this->info.change_mask = PW_PORT_CHANGE_MASK_ALL; | ||||||
|  | @ -861,7 +864,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions, | ||||||
| 	return 0; | 	return 0; | ||||||
| 
 | 
 | ||||||
| error_resource: | error_resource: | ||||||
| 	pw_log_error(NAME" %p: can't create port resource: %m", this); | 	pw_log_error("%p: can't create port resource: %m", this); | ||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -984,9 +987,9 @@ int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node) | ||||||
| 	port->info.props = &port->properties->dict; | 	port->info.props = &port->properties->dict; | ||||||
| 
 | 
 | ||||||
| 	if (control) { | 	if (control) { | ||||||
| 		pw_log_debug(NAME" %p: setting node control", port); | 		pw_log_debug("%p: setting node control", port); | ||||||
| 	} else { | 	} else { | ||||||
| 		pw_log_debug(NAME" %p: setting node io", port); | 		pw_log_debug("%p: setting node io", port); | ||||||
| 		spa_node_port_set_io(node->node, | 		spa_node_port_set_io(node->node, | ||||||
| 				     port->direction, port->port_id, | 				     port->direction, port->port_id, | ||||||
| 				     SPA_IO_Buffers, | 				     SPA_IO_Buffers, | ||||||
|  | @ -998,7 +1001,7 @@ int pw_impl_port_add(struct pw_impl_port *port, struct pw_impl_node *node) | ||||||
| 			     &port->rt.io, sizeof(port->rt.io)); | 			     &port->rt.io, sizeof(port->rt.io)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: %d add to node %p", port, port_id, node); | 	pw_log_debug("%p: %d add to node %p", port, port_id, node); | ||||||
| 
 | 
 | ||||||
| 	spa_list_append(ports, &port->link); | 	spa_list_append(ports, &port->link); | ||||||
| 
 | 
 | ||||||
|  | @ -1038,7 +1041,7 @@ static int do_remove_port(struct spa_loop *loop, | ||||||
| { | { | ||||||
| 	struct pw_impl_port *this = user_data; | 	struct pw_impl_port *this = user_data; | ||||||
| 
 | 
 | ||||||
| 	pw_log_trace(NAME" %p: remove port", this); | 	pw_log_trace("%p: remove port", this); | ||||||
| 	spa_list_remove(&this->rt.node_link); | 	spa_list_remove(&this->rt.node_link); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -1052,7 +1055,7 @@ static void pw_impl_port_remove(struct pw_impl_port *port) | ||||||
| 	if (node == NULL) | 	if (node == NULL) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: remove added:%d", port, port->added); | 	pw_log_debug("%p: remove added:%d", port, port->added); | ||||||
| 
 | 
 | ||||||
| 	if (port->added) { | 	if (port->added) { | ||||||
| 		pw_loop_invoke(node->data_loop, do_remove_port, | 		pw_loop_invoke(node->data_loop, do_remove_port, | ||||||
|  | @ -1062,7 +1065,7 @@ static void pw_impl_port_remove(struct pw_impl_port *port) | ||||||
| 
 | 
 | ||||||
| 	if (SPA_FLAG_IS_SET(port->flags, PW_IMPL_PORT_FLAG_TO_REMOVE)) { | 	if (SPA_FLAG_IS_SET(port->flags, PW_IMPL_PORT_FLAG_TO_REMOVE)) { | ||||||
| 		if ((res = spa_node_remove_port(node->node, port->direction, port->port_id)) < 0) | 		if ((res = spa_node_remove_port(node->node, port->direction, port->port_id)) < 0) | ||||||
| 			pw_log_warn(NAME" %p: can't remove: %s", port, spa_strerror(res)); | 			pw_log_warn("%p: can't remove: %s", port, spa_strerror(res)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (port->direction == PW_DIRECTION_INPUT) { | 	if (port->direction == PW_DIRECTION_INPUT) { | ||||||
|  | @ -1085,14 +1088,14 @@ void pw_impl_port_destroy(struct pw_impl_port *port) | ||||||
| 	struct impl *impl = SPA_CONTAINER_OF(port, struct impl, this); | 	struct impl *impl = SPA_CONTAINER_OF(port, struct impl, this); | ||||||
| 	struct pw_control *control; | 	struct pw_control *control; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", port); | 	pw_log_debug("%p: destroy", port); | ||||||
| 
 | 
 | ||||||
| 	port->destroying = true; | 	port->destroying = true; | ||||||
| 	pw_impl_port_emit_destroy(port); | 	pw_impl_port_emit_destroy(port); | ||||||
| 
 | 
 | ||||||
| 	pw_impl_port_unlink(port); | 	pw_impl_port_unlink(port); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: control destroy", port); | 	pw_log_debug("%p: control destroy", port); | ||||||
| 	spa_list_consume(control, &port->control_list[0], port_link) | 	spa_list_consume(control, &port->control_list[0], port_link) | ||||||
| 		pw_control_destroy(control); | 		pw_control_destroy(control); | ||||||
| 	spa_list_consume(control, &port->control_list[1], port_link) | 	spa_list_consume(control, &port->control_list[1], port_link) | ||||||
|  | @ -1105,7 +1108,7 @@ void pw_impl_port_destroy(struct pw_impl_port *port) | ||||||
| 		pw_global_destroy(port->global); | 		pw_global_destroy(port->global); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free", port); | 	pw_log_debug("%p: free", port); | ||||||
| 	pw_impl_port_emit_free(port); | 	pw_impl_port_emit_free(port); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_clean(&port->listener_list); | 	spa_hook_list_clean(&port->listener_list); | ||||||
|  | @ -1186,7 +1189,7 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port, | ||||||
| 	if (max == 0) | 	if (max == 0) | ||||||
| 		max = UINT32_MAX; | 		max = UINT32_MAX; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: params id:%d (%s) index:%u max:%u cached:%d", port, param_id, | 	pw_log_debug("%p: params id:%d (%s) index:%u max:%u cached:%d", port, param_id, | ||||||
| 			spa_debug_type_find_name(spa_type_param, param_id), | 			spa_debug_type_find_name(spa_type_param, param_id), | ||||||
| 			index, max, pi->user); | 			index, max, pi->user); | ||||||
| 
 | 
 | ||||||
|  | @ -1237,7 +1240,7 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: res %d: (%s)", port, res, spa_strerror(res)); | 	pw_log_debug("%p: res %d: (%s)", port, res, spa_strerror(res)); | ||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1372,14 +1375,14 @@ int pw_impl_port_set_param(struct pw_impl_port *port, uint32_t id, uint32_t flag | ||||||
| 	int res; | 	int res; | ||||||
| 	struct pw_impl_node *node = port->node; | 	struct pw_impl_node *node = port->node; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: %d set param %d %p", port, port->state, id, param); | 	pw_log_debug("%p: %d set param %d %p", port, port->state, id, param); | ||||||
| 
 | 
 | ||||||
| 	/* set parameter on node */ | 	/* set parameter on node */ | ||||||
| 	res = spa_node_port_set_param(node->node, | 	res = spa_node_port_set_param(node->node, | ||||||
| 			port->direction, port->port_id, | 			port->direction, port->port_id, | ||||||
| 			id, flags, param); | 			id, flags, param); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: %d set param on node %d:%d id:%d (%s): %d (%s)", port, port->state, | 	pw_log_debug("%p: %d set param on node %d:%d id:%d (%s): %d (%s)", port, port->state, | ||||||
| 			port->direction, port->port_id, id, | 			port->direction, port->port_id, id, | ||||||
| 			spa_debug_type_find_name(spa_type_param, id), | 			spa_debug_type_find_name(spa_type_param, id), | ||||||
| 			res, spa_strerror(res)); | 			res, spa_strerror(res)); | ||||||
|  | @ -1405,7 +1408,7 @@ int pw_impl_port_set_param(struct pw_impl_port *port, uint32_t id, uint32_t flag | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (id == SPA_PARAM_Format) { | 	if (id == SPA_PARAM_Format) { | ||||||
| 		pw_log_debug(NAME" %p: %d %p %d", port, port->state, param, res); | 		pw_log_debug("%p: %d %p %d", port, port->state, param, res); | ||||||
| 
 | 
 | ||||||
| 		if (port->added) { | 		if (port->added) { | ||||||
| 			pw_loop_invoke(node->data_loop, do_remove_port, SPA_ID_INVALID, NULL, 0, true, port); | 			pw_loop_invoke(node->data_loop, do_remove_port, SPA_ID_INVALID, NULL, 0, true, port); | ||||||
|  | @ -1440,7 +1443,7 @@ static int negotiate_mixer_buffers(struct pw_impl_port *port, uint32_t flags, | ||||||
| 		/* try dynamic data */ | 		/* try dynamic data */ | ||||||
| 		alloc_flags = PW_BUFFERS_FLAG_DYNAMIC; | 		alloc_flags = PW_BUFFERS_FLAG_DYNAMIC; | ||||||
| 
 | 
 | ||||||
| 		pw_log_debug(NAME" %p: %d.%d negotiate %d buffers on node: %p", | 		pw_log_debug("%p: %d.%d negotiate %d buffers on node: %p", | ||||||
| 				port, port->direction, port->port_id, n_buffers, node->node); | 				port, port->direction, port->port_id, n_buffers, node->node); | ||||||
| 
 | 
 | ||||||
| 		if (port->added) { | 		if (port->added) { | ||||||
|  | @ -1455,7 +1458,7 @@ static int negotiate_mixer_buffers(struct pw_impl_port *port, uint32_t flags, | ||||||
| 					port->mix, 0, | 					port->mix, 0, | ||||||
| 					node->node, port->port_id, | 					node->node, port->port_id, | ||||||
| 					&port->mix_buffers)) < 0) { | 					&port->mix_buffers)) < 0) { | ||||||
| 				pw_log_warn(NAME" %p: can't negotiate buffers: %s", | 				pw_log_warn("%p: can't negotiate buffers: %s", | ||||||
| 						port, spa_strerror(res)); | 						port, spa_strerror(res)); | ||||||
| 				return res; | 				return res; | ||||||
| 			} | 			} | ||||||
|  | @ -1465,7 +1468,7 @@ static int negotiate_mixer_buffers(struct pw_impl_port *port, uint32_t flags, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: %d.%d use %d buffers on node: %p", | 	pw_log_debug("%p: %d.%d use %d buffers on node: %p", | ||||||
| 			port, port->direction, port->port_id, n_buffers, node->node); | 			port, port->direction, port->port_id, n_buffers, node->node); | ||||||
| 
 | 
 | ||||||
| 	res = spa_node_port_use_buffers(node->node, | 	res = spa_node_port_use_buffers(node->node, | ||||||
|  | @ -1491,7 +1494,7 @@ int pw_impl_port_use_buffers(struct pw_impl_port *port, struct pw_impl_port_mix | ||||||
| { | { | ||||||
| 	int res = 0, res2; | 	int res = 0, res2; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: %d:%d.%d: %d buffers flags:%d state:%d n_mix:%d", port, | 	pw_log_debug("%p: %d:%d.%d: %d buffers flags:%d state:%d n_mix:%d", port, | ||||||
| 			port->direction, port->port_id, mix->id, | 			port->direction, port->port_id, mix->id, | ||||||
| 			n_buffers, flags, port->state, port->n_mix); | 			n_buffers, flags, port->state, port->n_mix); | ||||||
| 
 | 
 | ||||||
|  | @ -1512,7 +1515,7 @@ int pw_impl_port_use_buffers(struct pw_impl_port *port, struct pw_impl_port_mix | ||||||
| 		res = negotiate_mixer_buffers(port, flags, buffers, n_buffers); | 		res = negotiate_mixer_buffers(port, flags, buffers, n_buffers); | ||||||
| 
 | 
 | ||||||
| 		if (res < 0) { | 		if (res < 0) { | ||||||
| 			pw_log_error(NAME" %p: negotiate buffers on node: %d (%s)", | 			pw_log_error("%p: negotiate buffers on node: %d (%s)", | ||||||
| 				port, res, spa_strerror(res)); | 				port, res, spa_strerror(res)); | ||||||
| 			pw_impl_port_update_state(port, PW_IMPL_PORT_STATE_ERROR, res, | 			pw_impl_port_update_state(port, PW_IMPL_PORT_STATE_ERROR, res, | ||||||
| 					strdup("can't negotiate buffers on port")); | 					strdup("can't negotiate buffers on port")); | ||||||
|  | @ -1530,7 +1533,7 @@ int pw_impl_port_use_buffers(struct pw_impl_port *port, struct pw_impl_port_mix | ||||||
| 			buffers, n_buffers); | 			buffers, n_buffers); | ||||||
| 	if (res2 < 0) { | 	if (res2 < 0) { | ||||||
| 		if (res2 != -ENOTSUP && n_buffers > 0) { | 		if (res2 != -ENOTSUP && n_buffers > 0) { | ||||||
| 			pw_log_warn(NAME" %p: mix use buffers failed: %d (%s)", | 			pw_log_warn("%p: mix use buffers failed: %d (%s)", | ||||||
| 					port, res2, spa_strerror(res2)); | 					port, res2, spa_strerror(res2)); | ||||||
| 			return res2; | 			return res2; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -53,6 +53,15 @@ PW_LOG_TOPIC(log_context, "pw.context"); | ||||||
| PW_LOG_TOPIC(log_metadata, "pw.metadata"); | PW_LOG_TOPIC(log_metadata, "pw.metadata"); | ||||||
| PW_LOG_TOPIC(log_node, "pw.node"); | PW_LOG_TOPIC(log_node, "pw.node"); | ||||||
| PW_LOG_TOPIC(log_port, "pw.port"); | PW_LOG_TOPIC(log_port, "pw.port"); | ||||||
|  | PW_LOG_TOPIC(log_core, "pw.core"); | ||||||
|  | PW_LOG_TOPIC(log_proxy, "pw.proxy"); | ||||||
|  | PW_LOG_TOPIC(log_global, "pw.global"); | ||||||
|  | PW_LOG_TOPIC(log_protocol, "pw.protocol"); | ||||||
|  | PW_LOG_TOPIC(log_client, "pw.client"); | ||||||
|  | PW_LOG_TOPIC(log_factory, "pw.factory"); | ||||||
|  | PW_LOG_TOPIC(log_module, "pw.module"); | ||||||
|  | PW_LOG_TOPIC(log_device, "pw.device"); | ||||||
|  | PW_LOG_TOPIC(log_resource, "pw.resource"); | ||||||
| 
 | 
 | ||||||
| PW_LOG_TOPIC(PW_LOG_TOPIC_DEFAULT, "default"); | PW_LOG_TOPIC(PW_LOG_TOPIC_DEFAULT, "default"); | ||||||
| 
 | 
 | ||||||
|  | @ -413,4 +422,13 @@ pw_log_init(void) | ||||||
| 	PW_LOG_TOPIC_INIT(log_metadata); | 	PW_LOG_TOPIC_INIT(log_metadata); | ||||||
| 	PW_LOG_TOPIC_INIT(log_node); | 	PW_LOG_TOPIC_INIT(log_node); | ||||||
| 	PW_LOG_TOPIC_INIT(log_port); | 	PW_LOG_TOPIC_INIT(log_port); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_core); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_proxy); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_global); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_protocol); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_client); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_factory); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_module); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_device); | ||||||
|  | 	PW_LOG_TOPIC_INIT(log_resource); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -52,6 +52,9 @@ | ||||||
| 
 | 
 | ||||||
| #define SUPPORTLIB	"support/libspa-support" | #define SUPPORTLIB	"support/libspa-support" | ||||||
| 
 | 
 | ||||||
|  | PW_LOG_TOPIC_EXTERN(log_context); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_context | ||||||
|  | 
 | ||||||
| static char *prgname; | static char *prgname; | ||||||
| 
 | 
 | ||||||
| static struct spa_i18n *_pipewire_i18n = NULL; | static struct spa_i18n *_pipewire_i18n = NULL; | ||||||
|  |  | ||||||
|  | @ -31,7 +31,8 @@ | ||||||
| #include <pipewire/private.h> | #include <pipewire/private.h> | ||||||
| #include <pipewire/type.h> | #include <pipewire/type.h> | ||||||
| 
 | 
 | ||||||
| #define NAME "protocol" | PW_LOG_TOPIC_EXTERN(log_protocol); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_protocol | ||||||
| 
 | 
 | ||||||
| /** \cond */ | /** \cond */ | ||||||
| struct impl { | struct impl { | ||||||
|  | @ -68,7 +69,7 @@ struct pw_protocol *pw_protocol_new(struct pw_context *context, | ||||||
| 
 | 
 | ||||||
| 	spa_list_append(&context->protocol_list, &protocol->link); | 	spa_list_append(&context->protocol_list, &protocol->link); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: Created protocol %s", protocol, name); | 	pw_log_debug("%p: Created protocol %s", protocol, name); | ||||||
| 
 | 
 | ||||||
| 	return protocol; | 	return protocol; | ||||||
| } | } | ||||||
|  | @ -107,7 +108,7 @@ void pw_protocol_destroy(struct pw_protocol *protocol) | ||||||
| 	struct pw_protocol_server *server; | 	struct pw_protocol_server *server; | ||||||
| 	struct pw_protocol_client *client; | 	struct pw_protocol_client *client; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy", protocol); | 	pw_log_debug("%p: destroy", protocol); | ||||||
| 	pw_protocol_emit_destroy(protocol); | 	pw_protocol_emit_destroy(protocol); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_clean(&protocol->listener_list); | 	spa_hook_list_clean(&protocol->listener_list); | ||||||
|  | @ -152,7 +153,7 @@ pw_protocol_add_marshal(struct pw_protocol *protocol, | ||||||
| 
 | 
 | ||||||
| 	spa_list_append(&protocol->marshal_list, &impl->link); | 	spa_list_append(&protocol->marshal_list, &impl->link); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: Add marshal %s/%d to protocol %s", protocol, | 	pw_log_debug("%p: Add marshal %s/%d to protocol %s", protocol, | ||||||
| 			marshal->type, marshal->version, protocol->name); | 			marshal->type, marshal->version, protocol->name); | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -170,7 +171,7 @@ pw_protocol_get_marshal(struct pw_protocol *protocol, const char *type, uint32_t | ||||||
| 		    (impl->marshal->flags & flags) == flags) | 		    (impl->marshal->flags & flags) == flags) | ||||||
|                         return impl->marshal; |                         return impl->marshal; | ||||||
|         } |         } | ||||||
| 	pw_log_debug(NAME" %p: No marshal %s/%d for protocol %s", protocol, | 	pw_log_debug("%p: No marshal %s/%d for protocol %s", protocol, | ||||||
| 			type, version, protocol->name); | 			type, version, protocol->name); | ||||||
| 	return NULL; | 	return NULL; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -32,7 +32,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <spa/debug/types.h> | #include <spa/debug/types.h> | ||||||
| 
 | 
 | ||||||
| #define NAME "proxy" | PW_LOG_TOPIC_EXTERN(log_proxy); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_proxy | ||||||
| 
 | 
 | ||||||
| /** \cond */ | /** \cond */ | ||||||
| struct proxy { | struct proxy { | ||||||
|  | @ -52,7 +53,7 @@ int pw_proxy_init(struct pw_proxy *proxy, const char *type, uint32_t version) | ||||||
| 	proxy->id = pw_map_insert_new(&proxy->core->objects, proxy); | 	proxy->id = pw_map_insert_new(&proxy->core->objects, proxy); | ||||||
| 	if (proxy->id == SPA_ID_INVALID) { | 	if (proxy->id == SPA_ID_INVALID) { | ||||||
| 		res = -errno; | 		res = -errno; | ||||||
| 		pw_log_error(NAME" %p: can't allocate new id: %m", proxy); | 		pw_log_error("%p: can't allocate new id: %m", proxy); | ||||||
| 		goto error; | 		goto error; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -60,7 +61,7 @@ int pw_proxy_init(struct pw_proxy *proxy, const char *type, uint32_t version) | ||||||
| 	spa_hook_list_init(&proxy->object_listener_list); | 	spa_hook_list_init(&proxy->object_listener_list); | ||||||
| 
 | 
 | ||||||
| 	if ((res = pw_proxy_install_marshal(proxy, false)) < 0) { | 	if ((res = pw_proxy_install_marshal(proxy, false)) < 0) { | ||||||
| 		pw_log_error(NAME" %p: no marshal for type %s/%d: %s", proxy, | 		pw_log_error("%p: no marshal for type %s/%d: %s", proxy, | ||||||
| 				type, version, spa_strerror(res)); | 				type, version, spa_strerror(res)); | ||||||
| 		goto error_clean; | 		goto error_clean; | ||||||
| 	} | 	} | ||||||
|  | @ -108,7 +109,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory, | ||||||
| 	if (user_data_size > 0) | 	if (user_data_size > 0) | ||||||
| 		this->user_data = SPA_PTROFF(impl, sizeof(struct proxy), void); | 		this->user_data = SPA_PTROFF(impl, sizeof(struct proxy), void); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new %u type %s/%d core-proxy:%p, marshal:%p", | 	pw_log_debug("%p: new %u type %s/%d core-proxy:%p, marshal:%p", | ||||||
| 			this, this->id, type, version, this->core, this->marshal); | 			this, this->id, type, version, this->core, this->marshal); | ||||||
| 	return this; | 	return this; | ||||||
| 
 | 
 | ||||||
|  | @ -159,7 +160,7 @@ SPA_EXPORT | ||||||
| int pw_proxy_set_bound_id(struct pw_proxy *proxy, uint32_t global_id) | int pw_proxy_set_bound_id(struct pw_proxy *proxy, uint32_t global_id) | ||||||
| { | { | ||||||
| 	proxy->bound_id = global_id; | 	proxy->bound_id = global_id; | ||||||
| 	pw_log_debug(NAME" %p: id:%d bound:%d", proxy, proxy->id, global_id); | 	pw_log_debug("%p: id:%d bound:%d", proxy, proxy->id, global_id); | ||||||
| 	pw_proxy_emit_bound(proxy, global_id); | 	pw_proxy_emit_bound(proxy, global_id); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | @ -229,7 +230,7 @@ static inline void remove_from_map(struct pw_proxy *proxy) | ||||||
| SPA_EXPORT | SPA_EXPORT | ||||||
| void pw_proxy_destroy(struct pw_proxy *proxy) | void pw_proxy_destroy(struct pw_proxy *proxy) | ||||||
| { | { | ||||||
| 	pw_log_debug(NAME" %p: destroy id:%u removed:%u zombie:%u ref:%d", proxy, | 	pw_log_debug("%p: destroy id:%u removed:%u zombie:%u ref:%d", proxy, | ||||||
| 			proxy->id, proxy->removed, proxy->zombie, proxy->refcount); | 			proxy->id, proxy->removed, proxy->zombie, proxy->refcount); | ||||||
| 
 | 
 | ||||||
| 	assert(!proxy->destroyed); | 	assert(!proxy->destroyed); | ||||||
|  | @ -267,7 +268,7 @@ void pw_proxy_remove(struct pw_proxy *proxy) | ||||||
| { | { | ||||||
| 	assert(proxy->refcount > 0); | 	assert(proxy->refcount > 0); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: remove id:%u removed:%u destroyed:%u zombie:%u ref:%d", proxy, | 	pw_log_debug("%p: remove id:%u removed:%u destroyed:%u zombie:%u ref:%d", proxy, | ||||||
| 			proxy->id, proxy->removed, proxy->destroyed, proxy->zombie, | 			proxy->id, proxy->removed, proxy->destroyed, proxy->zombie, | ||||||
| 			proxy->refcount); | 			proxy->refcount); | ||||||
| 
 | 
 | ||||||
|  | @ -294,7 +295,7 @@ void pw_proxy_unref(struct pw_proxy *proxy) | ||||||
| 	if (--proxy->refcount > 0) | 	if (--proxy->refcount > 0) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free %u", proxy, proxy->id); | 	pw_log_debug("%p: free %u", proxy, proxy->id); | ||||||
| 	/** client must explicitly destroy all proxies */ | 	/** client must explicitly destroy all proxies */ | ||||||
| 	assert(proxy->destroyed); | 	assert(proxy->destroyed); | ||||||
| 	free(proxy); | 	free(proxy); | ||||||
|  | @ -315,7 +316,7 @@ int pw_proxy_sync(struct pw_proxy *proxy, int seq) | ||||||
| 
 | 
 | ||||||
| 	if (core && !core->removed) { | 	if (core && !core->removed) { | ||||||
| 		res = pw_core_sync(core, proxy->id, seq); | 		res = pw_core_sync(core, proxy->id, seq); | ||||||
| 		pw_log_debug(NAME" %p: %u seq:%d sync %u", proxy, proxy->id, seq, res); | 		pw_log_debug("%p: %u seq:%d sync %u", proxy, proxy->id, seq, res); | ||||||
| 	} | 	} | ||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -31,7 +31,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <spa/debug/types.h> | #include <spa/debug/types.h> | ||||||
| 
 | 
 | ||||||
| #define NAME "resource" | PW_LOG_TOPIC_EXTERN(log_device); | ||||||
|  | #define PW_LOG_TOPIC_DEFAULT log_device | ||||||
| 
 | 
 | ||||||
| /** \cond */ | /** \cond */ | ||||||
| struct impl { | struct impl { | ||||||
|  | @ -72,14 +73,14 @@ struct pw_resource *pw_resource_new(struct pw_impl_client *client, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((res = pw_map_insert_at(&client->objects, id, this)) < 0) { | 	if ((res = pw_map_insert_at(&client->objects, id, this)) < 0) { | ||||||
| 		pw_log_error(NAME" %p: can't add id %u for client %p: %s", | 		pw_log_error("%p: can't add id %u for client %p: %s", | ||||||
| 			this, id, client, spa_strerror(res)); | 			this, id, client, spa_strerror(res)); | ||||||
| 		goto error_clean; | 		goto error_clean; | ||||||
| 	} | 	} | ||||||
| 	this->id = id; | 	this->id = id; | ||||||
| 
 | 
 | ||||||
| 	if ((res = pw_resource_install_marshal(this, false)) < 0) { | 	if ((res = pw_resource_install_marshal(this, false)) < 0) { | ||||||
| 		pw_log_error(NAME" %p: no marshal for type %s/%d: %s", this, | 		pw_log_error("%p: no marshal for type %s/%d: %s", this, | ||||||
| 				type, version, spa_strerror(res)); | 				type, version, spa_strerror(res)); | ||||||
| 		goto error_clean; | 		goto error_clean; | ||||||
| 	} | 	} | ||||||
|  | @ -88,7 +89,7 @@ struct pw_resource *pw_resource_new(struct pw_impl_client *client, | ||||||
| 	if (user_data_size > 0) | 	if (user_data_size > 0) | ||||||
| 		this->user_data = SPA_PTROFF(impl, sizeof(struct impl), void); | 		this->user_data = SPA_PTROFF(impl, sizeof(struct impl), void); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: new %u type %s/%d client:%p marshal:%p", | 	pw_log_debug("%p: new %u type %s/%d client:%p marshal:%p", | ||||||
| 			this, id, type, version, client, this->marshal); | 			this, id, type, version, client, this->marshal); | ||||||
| 
 | 
 | ||||||
| 	pw_impl_client_emit_resource_added(client, this); | 	pw_impl_client_emit_resource_added(client, this); | ||||||
|  | @ -200,7 +201,7 @@ int pw_resource_ping(struct pw_resource *resource, int seq) | ||||||
| 	if (client->core_resource != NULL) { | 	if (client->core_resource != NULL) { | ||||||
| 		pw_core_resource_ping(client->core_resource, resource->id, seq); | 		pw_core_resource_ping(client->core_resource, resource->id, seq); | ||||||
| 		res = client->send_seq; | 		res = client->send_seq; | ||||||
| 		pw_log_debug(NAME" %p: %u seq:%d ping %d", resource, resource->id, seq, res); | 		pw_log_debug("%p: %u seq:%d ping %d", resource, resource->id, seq, res); | ||||||
| 	} | 	} | ||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
|  | @ -212,7 +213,7 @@ int pw_resource_set_bound_id(struct pw_resource *resource, uint32_t global_id) | ||||||
| 
 | 
 | ||||||
| 	resource->bound_id = global_id; | 	resource->bound_id = global_id; | ||||||
| 	if (client->core_resource != NULL) { | 	if (client->core_resource != NULL) { | ||||||
| 		pw_log_debug(NAME" %p: %u global_id:%u", resource, resource->id, global_id); | 		pw_log_debug("%p: %u global_id:%u", resource, resource->id, global_id); | ||||||
| 		pw_core_resource_bound_id(client->core_resource, resource->id, global_id); | 		pw_core_resource_bound_id(client->core_resource, resource->id, global_id); | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
|  | @ -270,7 +271,7 @@ void pw_resource_destroy(struct pw_resource *resource) | ||||||
| 		resource->global = NULL; | 		resource->global = NULL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: destroy %u", resource, resource->id); | 	pw_log_debug("%p: destroy %u", resource, resource->id); | ||||||
| 	pw_resource_emit_destroy(resource); | 	pw_resource_emit_destroy(resource); | ||||||
| 
 | 
 | ||||||
| 	pw_map_insert_at(&client->objects, resource->id, NULL); | 	pw_map_insert_at(&client->objects, resource->id, NULL); | ||||||
|  | @ -279,7 +280,7 @@ void pw_resource_destroy(struct pw_resource *resource) | ||||||
| 	if (client->core_resource && !resource->removed) | 	if (client->core_resource && !resource->removed) | ||||||
| 		pw_core_resource_remove_id(client->core_resource, resource->id); | 		pw_core_resource_remove_id(client->core_resource, resource->id); | ||||||
| 
 | 
 | ||||||
| 	pw_log_debug(NAME" %p: free %u", resource, resource->id); | 	pw_log_debug("%p: free %u", resource, resource->id); | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_clean(&resource->listener_list); | 	spa_hook_list_clean(&resource->listener_list); | ||||||
| 	spa_hook_list_clean(&resource->object_listener_list); | 	spa_hook_list_clean(&resource->object_listener_list); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Peter Hutterer
						Peter Hutterer