mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	modules: use the new topic-based logging from various pipewire modules
This commit is contained in:
		
							parent
							
								
									e9d869b46f
								
							
						
					
					
						commit
						14112fd168
					
				
					 29 changed files with 228 additions and 80 deletions
				
			
		| 
						 | 
					@ -124,6 +124,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "access"
 | 
					#define NAME "access"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MODULE_USAGE	"[ access.force=flatpak ] "		\
 | 
					#define MODULE_USAGE	"[ access.force=flatpak ] "		\
 | 
				
			||||||
			"[ access.allowed=<cmd-line> ] "	\
 | 
								"[ access.allowed=<cmd-line> ] "	\
 | 
				
			||||||
			"[ access.rejected=<cmd-line> ] "	\
 | 
								"[ access.rejected=<cmd-line> ] "	\
 | 
				
			||||||
| 
						 | 
					@ -258,7 +261,7 @@ context_check_access(void *data, struct pw_impl_client *client)
 | 
				
			||||||
	if (impl->properties && (str = pw_properties_get(impl->properties, "access.allowed")) != NULL) {
 | 
						if (impl->properties && (str = pw_properties_get(impl->properties, "access.allowed")) != NULL) {
 | 
				
			||||||
		res = check_cmdline(client, pid, str);
 | 
							res = check_cmdline(client, pid, str);
 | 
				
			||||||
		if (res < 0) {
 | 
							if (res < 0) {
 | 
				
			||||||
			pw_log_warn(NAME" %p: client %p allowed check failed: %s",
 | 
								pw_log_warn("%p: client %p allowed check failed: %s",
 | 
				
			||||||
				impl, client, spa_strerror(res));
 | 
									impl, client, spa_strerror(res));
 | 
				
			||||||
		} else if (res > 0) {
 | 
							} else if (res > 0) {
 | 
				
			||||||
			access = "allowed";
 | 
								access = "allowed";
 | 
				
			||||||
| 
						 | 
					@ -269,7 +272,7 @@ context_check_access(void *data, struct pw_impl_client *client)
 | 
				
			||||||
	if (impl->properties && (str = pw_properties_get(impl->properties, "access.rejected")) != NULL) {
 | 
						if (impl->properties && (str = pw_properties_get(impl->properties, "access.rejected")) != NULL) {
 | 
				
			||||||
		res = check_cmdline(client, pid, str);
 | 
							res = check_cmdline(client, pid, str);
 | 
				
			||||||
		if (res < 0) {
 | 
							if (res < 0) {
 | 
				
			||||||
			pw_log_warn(NAME" %p: client %p rejected check failed: %s",
 | 
								pw_log_warn("%p: client %p rejected check failed: %s",
 | 
				
			||||||
				impl, client, spa_strerror(res));
 | 
									impl, client, spa_strerror(res));
 | 
				
			||||||
		} else if (res > 0) {
 | 
							} else if (res > 0) {
 | 
				
			||||||
			res = -EACCES;
 | 
								res = -EACCES;
 | 
				
			||||||
| 
						 | 
					@ -281,11 +284,11 @@ context_check_access(void *data, struct pw_impl_client *client)
 | 
				
			||||||
	if (impl->properties && (str = pw_properties_get(impl->properties, "access.restricted")) != NULL) {
 | 
						if (impl->properties && (str = pw_properties_get(impl->properties, "access.restricted")) != NULL) {
 | 
				
			||||||
		res = check_cmdline(client, pid, str);
 | 
							res = check_cmdline(client, pid, str);
 | 
				
			||||||
		if (res < 0) {
 | 
							if (res < 0) {
 | 
				
			||||||
			pw_log_warn(NAME" %p: client %p restricted check failed: %s",
 | 
								pw_log_warn("%p: client %p restricted check failed: %s",
 | 
				
			||||||
				impl, client, spa_strerror(res));
 | 
									impl, client, spa_strerror(res));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (res > 0) {
 | 
							else if (res > 0) {
 | 
				
			||||||
			pw_log_debug(NAME" %p: restricted client %p added", impl, client);
 | 
								pw_log_debug(" %p: restricted client %p added", impl, client);
 | 
				
			||||||
			access = "restricted";
 | 
								access = "restricted";
 | 
				
			||||||
			goto wait_permissions;
 | 
								goto wait_permissions;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -302,11 +305,11 @@ context_check_access(void *data, struct pw_impl_client *client)
 | 
				
			||||||
				access = "unrestricted";
 | 
									access = "unrestricted";
 | 
				
			||||||
				goto granted;
 | 
									goto granted;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			pw_log_warn(NAME" %p: client %p sandbox check failed: %s",
 | 
								pw_log_warn("%p: client %p sandbox check failed: %s",
 | 
				
			||||||
				impl, client, spa_strerror(res));
 | 
									impl, client, spa_strerror(res));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else if (res > 0) {
 | 
							else if (res > 0) {
 | 
				
			||||||
			pw_log_debug(NAME" %p: flatpak client %p added", impl, client);
 | 
								pw_log_debug(" %p: flatpak client %p added", impl, client);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		access = "flatpak";
 | 
							access = "flatpak";
 | 
				
			||||||
		goto wait_permissions;
 | 
							goto wait_permissions;
 | 
				
			||||||
| 
						 | 
					@ -316,7 +319,7 @@ context_check_access(void *data, struct pw_impl_client *client)
 | 
				
			||||||
		access = "unrestricted";
 | 
							access = "unrestricted";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
granted:
 | 
					granted:
 | 
				
			||||||
	pw_log_info(NAME" %p: client %p '%s' access granted", impl, client, access);
 | 
						pw_log_info("%p: client %p '%s' access granted", impl, client, access);
 | 
				
			||||||
	items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access);
 | 
						items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access);
 | 
				
			||||||
	pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -325,7 +328,7 @@ granted:
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
wait_permissions:
 | 
					wait_permissions:
 | 
				
			||||||
	pw_log_info(NAME " %p: client %p wait for '%s' permissions",
 | 
						pw_log_info("%p: client %p wait for '%s' permissions",
 | 
				
			||||||
			impl, client, access);
 | 
								impl, client, access);
 | 
				
			||||||
	items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access);
 | 
						items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, access);
 | 
				
			||||||
	pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
| 
						 | 
					@ -367,6 +370,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct pw_properties *props;
 | 
						struct pw_properties *props;
 | 
				
			||||||
	struct impl *impl;
 | 
						struct impl *impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,6 +42,9 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define NAME "adapter"
 | 
					#define NAME "adapter"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FACTORY_USAGE	SPA_KEY_FACTORY_NAME"=<factory-name> " \
 | 
					#define FACTORY_USAGE	SPA_KEY_FACTORY_NAME"=<factory-name> " \
 | 
				
			||||||
			"["SPA_KEY_LIBRARY_NAME"=<library-name>] " \
 | 
								"["SPA_KEY_LIBRARY_NAME"=<library-name>] " \
 | 
				
			||||||
			ADAPTER_USAGE
 | 
								ADAPTER_USAGE
 | 
				
			||||||
| 
						 | 
					@ -79,7 +82,7 @@ static void resource_destroy(void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct node_data *nd = data;
 | 
						struct node_data *nd = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: destroy %p", nd, nd->adapter);
 | 
						pw_log_debug("%p: destroy %p", nd, nd->adapter);
 | 
				
			||||||
	spa_hook_remove(&nd->resource_listener);
 | 
						spa_hook_remove(&nd->resource_listener);
 | 
				
			||||||
	nd->bound_resource = NULL;
 | 
						nd->bound_resource = NULL;
 | 
				
			||||||
	if (nd->adapter && !nd->linger)
 | 
						if (nd->adapter && !nd->linger)
 | 
				
			||||||
| 
						 | 
					@ -94,7 +97,7 @@ static const struct pw_resource_events resource_events = {
 | 
				
			||||||
static void node_destroy(void *data)
 | 
					static void node_destroy(void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct node_data *nd = data;
 | 
						struct node_data *nd = data;
 | 
				
			||||||
	pw_log_debug(NAME" %p: destroy %p", nd, nd->adapter);
 | 
						pw_log_debug("%p: destroy %p", nd, nd->adapter);
 | 
				
			||||||
	spa_list_remove(&nd->link);
 | 
						spa_list_remove(&nd->link);
 | 
				
			||||||
	nd->adapter = NULL;
 | 
						nd->adapter = NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -103,7 +106,7 @@ static void node_free(void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct node_data *nd = data;
 | 
						struct node_data *nd = data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: free %p", nd, nd->follower);
 | 
						pw_log_debug("%p: free %p", nd, nd->follower);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (nd->bound_resource != NULL)
 | 
						if (nd->bound_resource != NULL)
 | 
				
			||||||
		spa_hook_remove(&nd->resource_listener);
 | 
							spa_hook_remove(&nd->resource_listener);
 | 
				
			||||||
| 
						 | 
					@ -275,7 +278,7 @@ static void module_destroy(void *data)
 | 
				
			||||||
	struct factory_data *d = data;
 | 
						struct factory_data *d = data;
 | 
				
			||||||
	struct node_data *nd;
 | 
						struct node_data *nd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: destroy", d);
 | 
						pw_log_debug("%p: destroy", d);
 | 
				
			||||||
	spa_hook_remove(&d->module_listener);
 | 
						spa_hook_remove(&d->module_listener);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_consume(nd, &d->node_list, link)
 | 
						spa_list_consume(nd, &d->node_list, link)
 | 
				
			||||||
| 
						 | 
					@ -298,7 +301,7 @@ static void module_registered(void *data)
 | 
				
			||||||
	pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
						if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
				
			||||||
		pw_log_error(NAME" %p: can't register factory: %s", factory, spa_strerror(res));
 | 
							pw_log_error("%p: can't register factory: %s", factory, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -315,6 +318,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct pw_impl_factory *factory;
 | 
						struct pw_impl_factory *factory;
 | 
				
			||||||
	struct factory_data *data;
 | 
						struct factory_data *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	factory = pw_context_create_factory(context,
 | 
						factory = pw_context_create_factory(context,
 | 
				
			||||||
				 "adapter",
 | 
									 "adapter",
 | 
				
			||||||
				 PW_TYPE_INTERFACE_Node,
 | 
									 PW_TYPE_INTERFACE_Node,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "adapter"
 | 
					#define NAME "adapter"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_EXTERN(mod_topic);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct buffer {
 | 
					struct buffer {
 | 
				
			||||||
	struct spa_buffer buf;
 | 
						struct spa_buffer buf;
 | 
				
			||||||
	struct spa_data datas[1];
 | 
						struct spa_data datas[1];
 | 
				
			||||||
| 
						 | 
					@ -187,14 +190,14 @@ static int find_format(struct pw_impl_node *node, enum pw_direction direction,
 | 
				
			||||||
				SPA_PARAM_EnumFormat, &state,
 | 
									SPA_PARAM_EnumFormat, &state,
 | 
				
			||||||
				NULL, &format, &b)) != 1) {
 | 
									NULL, &format, &b)) != 1) {
 | 
				
			||||||
		res = res < 0 ? res : -ENOENT;
 | 
							res = res < 0 ? res : -ENOENT;
 | 
				
			||||||
		pw_log_warn(NAME " %p: can't get format: %s", node, spa_strerror(res));
 | 
							pw_log_warn("%p: can't get format: %s", node, spa_strerror(res));
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = spa_format_parse(format, media_type, media_subtype)) < 0)
 | 
						if ((res = spa_format_parse(format, media_type, media_subtype)) < 0)
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: %s/%s", node,
 | 
						pw_log_debug("%p: %s/%s", node,
 | 
				
			||||||
			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));
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -220,7 +223,7 @@ struct pw_impl_node *pw_adapter_new(struct pw_context *context,
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: in %d/%d out %d/%d", follower,
 | 
						pw_log_debug("%p: in %d/%d out %d/%d", follower,
 | 
				
			||||||
			info->n_input_ports, info->max_input_ports,
 | 
								info->n_input_ports, info->max_input_ports,
 | 
				
			||||||
			info->n_output_ports, info->max_output_ports);
 | 
								info->n_output_ports, info->max_output_ports);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,11 +35,14 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "module-client-device/client-device.h"
 | 
					#include "module-client-device/client-device.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "client-device"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/** \page page_module_client_device PipeWire Module: Client Device
 | 
					/** \page page_module_client_device PipeWire Module: Client Device
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "client-device"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct spa_dict_item module_props[] = {
 | 
					static const struct spa_dict_item module_props[] = {
 | 
				
			||||||
	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
						{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
				
			||||||
	{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create and control remote devices" },
 | 
						{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create and control remote devices" },
 | 
				
			||||||
| 
						 | 
					@ -150,7 +153,7 @@ static void module_registered(void *data)
 | 
				
			||||||
	pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
						if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
				
			||||||
		pw_log_error(NAME" %p: can't register factory: %s", factory, spa_strerror(res));
 | 
							pw_log_error("%p: can't register factory: %s", factory, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -167,6 +170,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct pw_impl_factory *factory;
 | 
						struct pw_impl_factory *factory;
 | 
				
			||||||
	struct factory_data *data;
 | 
						struct factory_data *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
	factory = pw_context_create_factory(context,
 | 
						factory = pw_context_create_factory(context,
 | 
				
			||||||
				 "client-device",
 | 
									 "client-device",
 | 
				
			||||||
				 SPA_TYPE_INTERFACE_Device,
 | 
									 SPA_TYPE_INTERFACE_Device,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,6 +41,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "client-node"
 | 
					#define NAME "client-node"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct spa_dict_item module_props[] = {
 | 
					static const struct spa_dict_item module_props[] = {
 | 
				
			||||||
	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
						{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
				
			||||||
	{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create and control remote nodes" },
 | 
						{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create and control remote nodes" },
 | 
				
			||||||
| 
						 | 
					@ -138,7 +141,7 @@ static void module_registered(void *data)
 | 
				
			||||||
	pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
						if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
				
			||||||
		pw_log_error(NAME" %p: can't register factory: %s", factory, spa_strerror(res));
 | 
							pw_log_error("%p: can't register factory: %s", factory, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -155,6 +158,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct pw_impl_factory *factory;
 | 
						struct pw_impl_factory *factory;
 | 
				
			||||||
	struct factory_data *data;
 | 
						struct factory_data *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	factory = pw_context_create_factory(context,
 | 
						factory = pw_context_create_factory(context,
 | 
				
			||||||
				 "client-node",
 | 
									 "client-node",
 | 
				
			||||||
				 PW_TYPE_INTERFACE_ClientNode,
 | 
									 PW_TYPE_INTERFACE_ClientNode,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,6 +44,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "client-node"
 | 
					#define NAME "client-node"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_EXTERN(mod_topic);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \cond */
 | 
					/** \cond */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_INPUTS	1024
 | 
					#define MAX_INPUTS	1024
 | 
				
			||||||
| 
						 | 
					@ -257,14 +260,14 @@ static void clear_data(struct node *this, struct spa_data *d)
 | 
				
			||||||
		id = SPA_PTR_TO_UINT32(d->data);
 | 
							id = SPA_PTR_TO_UINT32(d->data);
 | 
				
			||||||
		m = pw_mempool_find_id(this->client->pool, id);
 | 
							m = pw_mempool_find_id(this->client->pool, id);
 | 
				
			||||||
		if (m) {
 | 
							if (m) {
 | 
				
			||||||
			pw_log_debug(NAME " %p: mem %d", impl, m->id);
 | 
								pw_log_debug("%p: mem %d", impl, m->id);
 | 
				
			||||||
			pw_memblock_unref(m);
 | 
								pw_memblock_unref(m);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	case SPA_DATA_MemFd:
 | 
						case SPA_DATA_MemFd:
 | 
				
			||||||
	case SPA_DATA_DmaBuf:
 | 
						case SPA_DATA_DmaBuf:
 | 
				
			||||||
		pw_log_debug(NAME " %p: close fd:%d", impl, (int)d->fd);
 | 
							pw_log_debug("%p: close fd:%d", impl, (int)d->fd);
 | 
				
			||||||
		close(d->fd);
 | 
							close(d->fd);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
| 
						 | 
					@ -340,7 +343,7 @@ static int impl_node_enum_params(void *object, int seq,
 | 
				
			||||||
		if (spa_pod_filter(&b, &result.param, param, filter) != 0)
 | 
							if (spa_pod_filter(&b, &result.param, param, filter) != 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_log_debug(NAME " %p: %d param %u", this, seq, result.index);
 | 
							pw_log_debug("%p: %d param %u", this, seq, result.index);
 | 
				
			||||||
		spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
 | 
							spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (++count == num)
 | 
							if (++count == num)
 | 
				
			||||||
| 
						 | 
					@ -407,7 +410,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
 | 
				
			||||||
	spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
				
			||||||
	spa_return_val_if_fail(command != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(command != NULL, -EINVAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: send command %d", this, SPA_COMMAND_TYPE(command));
 | 
						pw_log_debug("%p: send command %d", this, SPA_COMMAND_TYPE(command));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->resource == NULL)
 | 
						if (this->resource == NULL)
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
| 
						 | 
					@ -469,7 +472,7 @@ impl_node_sync(void *object, int seq)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: sync", this);
 | 
						pw_log_debug("%p: sync", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->resource == NULL)
 | 
						if (this->resource == NULL)
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
| 
						 | 
					@ -599,7 +602,7 @@ impl_node_port_enum_params(void *object, int seq,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	port = GET_PORT(this, direction, port_id);
 | 
						port = GET_PORT(this, direction, port_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: seq:%d port %d.%d id:%u start:%u num:%u n_params:%d",
 | 
						pw_log_debug("%p: seq:%d port %d.%d id:%u start:%u num:%u n_params:%d",
 | 
				
			||||||
			this, seq, direction, port_id, id, start, num, port->n_params);
 | 
								this, seq, direction, port_id, id, start, num, port->n_params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	result.id = id;
 | 
						result.id = id;
 | 
				
			||||||
| 
						 | 
					@ -626,7 +629,7 @@ impl_node_port_enum_params(void *object, int seq,
 | 
				
			||||||
		if (spa_pod_filter(&b, &result.param, param, filter) < 0)
 | 
							if (spa_pod_filter(&b, &result.param, param, filter) < 0)
 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		pw_log_debug(NAME " %p: %d param %u", this, seq, result.index);
 | 
							pw_log_debug("%p: %d param %u", this, seq, result.index);
 | 
				
			||||||
		spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
 | 
							spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (++count == num)
 | 
							if (++count == num)
 | 
				
			||||||
| 
						 | 
					@ -649,7 +652,7 @@ impl_node_port_set_param(void *object,
 | 
				
			||||||
	if(!CHECK_PORT(this, direction, port_id))
 | 
						if(!CHECK_PORT(this, direction, port_id))
 | 
				
			||||||
		return param == NULL ? 0 : -EINVAL;
 | 
							return param == NULL ? 0 : -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: port %d.%d set param %s %d", this,
 | 
						pw_log_debug("%p: port %d.%d set param %s %d", this,
 | 
				
			||||||
			direction, port_id,
 | 
								direction, port_id,
 | 
				
			||||||
			spa_debug_type_find_name(spa_type_param, id), id);
 | 
								spa_debug_type_find_name(spa_type_param, id), id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -680,7 +683,7 @@ static int do_port_set_io(struct impl *impl,
 | 
				
			||||||
	uint32_t tag[5] = { impl->node_id, direction, port_id, mix_id, id };
 | 
						uint32_t tag[5] = { impl->node_id, direction, port_id, mix_id, id };
 | 
				
			||||||
	struct pw_memmap *mm, *old;
 | 
						struct pw_memmap *mm, *old;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: %s port %d.%d set io %p %zd", this,
 | 
						pw_log_debug("%p: %s port %d.%d set io %p %zd", this,
 | 
				
			||||||
			direction == SPA_DIRECTION_INPUT ? "input" : "output",
 | 
								direction == SPA_DIRECTION_INPUT ? "input" : "output",
 | 
				
			||||||
			port_id, mix_id, data, size);
 | 
								port_id, mix_id, data, size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -940,7 +943,7 @@ client_node_get_node(void *data,
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
	uint32_t new_id = user_data_size;
 | 
						uint32_t new_id = user_data_size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: bind %u/%u", this, new_id, version);
 | 
						pw_log_debug("%p: bind %u/%u", this, new_id, version);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->bind_node_version = version;
 | 
						impl->bind_node_version = version;
 | 
				
			||||||
	impl->bind_node_id = new_id;
 | 
						impl->bind_node_id = new_id;
 | 
				
			||||||
| 
						 | 
					@ -961,7 +964,7 @@ client_node_update(void *data,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (change_mask & PW_CLIENT_NODE_UPDATE_PARAMS) {
 | 
						if (change_mask & PW_CLIENT_NODE_UPDATE_PARAMS) {
 | 
				
			||||||
		uint32_t i;
 | 
							uint32_t i;
 | 
				
			||||||
		pw_log_debug(NAME" %p: update %d params", this, n_params);
 | 
							pw_log_debug("%p: update %d params", this, n_params);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (i = 0; i < this->n_params; i++)
 | 
							for (i = 0; i < this->n_params; i++)
 | 
				
			||||||
			free(this->params[i]);
 | 
								free(this->params[i]);
 | 
				
			||||||
| 
						 | 
					@ -974,7 +977,7 @@ client_node_update(void *data,
 | 
				
			||||||
	if (change_mask & PW_CLIENT_NODE_UPDATE_INFO) {
 | 
						if (change_mask & PW_CLIENT_NODE_UPDATE_INFO) {
 | 
				
			||||||
		spa_node_emit_info(&this->hooks, info);
 | 
							spa_node_emit_info(&this->hooks, info);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pw_log_debug(NAME" %p: got node update", this);
 | 
						pw_log_debug("%p: got node update", this);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1130,7 +1133,7 @@ static void node_on_data_fd_events(struct spa_source *source)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (SPA_UNLIKELY(spa_system_eventfd_read(this->data_system,
 | 
							if (SPA_UNLIKELY(spa_system_eventfd_read(this->data_system,
 | 
				
			||||||
					this->data_source.fd, &cmd) < 0))
 | 
										this->data_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_warn("(%s-%u) client missed %"PRIu64" wakeups",
 | 
								pw_log_warn("(%s-%u) client missed %"PRIu64" wakeups",
 | 
				
			||||||
				node->name, node->info.id, cmd - 1);
 | 
									node->name, node->info.id, cmd - 1);
 | 
				
			||||||
| 
						 | 
					@ -1222,7 +1225,7 @@ static void client_node_resource_destroy(void *data)
 | 
				
			||||||
	struct pw_impl_client_node *this = &impl->this;
 | 
						struct pw_impl_client_node *this = &impl->this;
 | 
				
			||||||
	struct node *node = &impl->node;
 | 
						struct node *node = &impl->node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: destroy", node);
 | 
						pw_log_debug("%p: destroy", node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->node.resource = this->resource = NULL;
 | 
						impl->node.resource = this->resource = NULL;
 | 
				
			||||||
	spa_hook_remove(&impl->resource_listener);
 | 
						spa_hook_remove(&impl->resource_listener);
 | 
				
			||||||
| 
						 | 
					@ -1247,7 +1250,7 @@ static void client_node_resource_error(void *data, int seq, int res, const char
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
	struct spa_result_node_error result;
 | 
						struct spa_result_node_error result;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_error(NAME " %p: error seq:%d %d (%s)", this, seq, res, message);
 | 
						pw_log_error("%p: error seq:%d %d (%s)", this, seq, res, message);
 | 
				
			||||||
	result.message = message;
 | 
						result.message = message;
 | 
				
			||||||
	spa_node_emit_result(&this->hooks, seq, res, SPA_RESULT_TYPE_NODE_ERROR, &result);
 | 
						spa_node_emit_result(&this->hooks, seq, res, SPA_RESULT_TYPE_NODE_ERROR, &result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1257,7 +1260,7 @@ static void client_node_resource_pong(void *data, int seq)
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: got pong, emit result %d", this, seq);
 | 
						pw_log_debug("%p: got pong, emit result %d", this, seq);
 | 
				
			||||||
	spa_node_emit_result(&this->hooks, seq, 0, 0, NULL);
 | 
						spa_node_emit_result(&this->hooks, seq, 0, 0, NULL);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1268,11 +1271,11 @@ void pw_impl_client_node_registered(struct pw_impl_client_node *this, struct pw_
 | 
				
			||||||
	struct pw_impl_client *client = impl->node.client;
 | 
						struct pw_impl_client *client = impl->node.client;
 | 
				
			||||||
	uint32_t node_id = global->id;
 | 
						uint32_t node_id = global->id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: %d", &impl->node, node_id);
 | 
						pw_log_debug("%p: %d", &impl->node, node_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->activation = pw_mempool_import_block(client->pool, node->activation);
 | 
						impl->activation = pw_mempool_import_block(client->pool, node->activation);
 | 
				
			||||||
	if (impl->activation == NULL) {
 | 
						if (impl->activation == NULL) {
 | 
				
			||||||
		pw_log_debug(NAME " %p: can't import block: %m", &impl->node);
 | 
							pw_log_debug("%p: can't import block: %m", &impl->node);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	impl->node_id = node_id;
 | 
						impl->node_id = node_id;
 | 
				
			||||||
| 
						 | 
					@ -1312,7 +1315,7 @@ static void node_initialized(void *data)
 | 
				
			||||||
	node->writefd = impl->fds[1];
 | 
						node->writefd = impl->fds[1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_loop_add_source(node->data_loop, &node->data_source);
 | 
						spa_loop_add_source(node->data_loop, &node->data_source);
 | 
				
			||||||
	pw_log_debug(NAME " %p: transport read-fd:%d write-fd:%d", node, impl->fds[0], impl->fds[1]);
 | 
						pw_log_debug("%p: transport read-fd:%d write-fd:%d", node, impl->fds[0], impl->fds[1]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size = sizeof(struct spa_io_buffers) * MAX_AREAS;
 | 
						size = sizeof(struct spa_io_buffers) * MAX_AREAS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1324,7 +1327,7 @@ static void node_initialized(void *data)
 | 
				
			||||||
	if (impl->io_areas == NULL)
 | 
						if (impl->io_areas == NULL)
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: io areas %p", node, impl->io_areas->map->ptr);
 | 
						pw_log_debug("%p: io areas %p", node, impl->io_areas->map->ptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((global = pw_impl_node_get_global(this->node)) != NULL)
 | 
						if ((global = pw_impl_node_get_global(this->node)) != NULL)
 | 
				
			||||||
		pw_impl_client_node_registered(this, global);
 | 
							pw_impl_client_node_registered(this, global);
 | 
				
			||||||
| 
						 | 
					@ -1341,7 +1344,7 @@ static void node_free(void *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->node = NULL;
 | 
						this->node = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: free", node);
 | 
						pw_log_debug("%p: free", node);
 | 
				
			||||||
	node_clear(node);
 | 
						node_clear(node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_hook_remove(&impl->node_listener);
 | 
						spa_hook_remove(&impl->node_listener);
 | 
				
			||||||
| 
						 | 
					@ -1385,7 +1388,7 @@ static int port_init_mix(void *data, struct pw_impl_port_mix *mix)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m->peer_id = mix->peer_id;
 | 
						m->peer_id = mix->peer_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: init mix id:%d io:%p base:%p", impl,
 | 
						pw_log_debug("%p: init mix id:%d io:%p base:%p", impl,
 | 
				
			||||||
			mix->id, mix->io, impl->io_areas->map->ptr);
 | 
								mix->id, mix->io, impl->io_areas->map->ptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -1398,7 +1401,7 @@ static int port_release_mix(void *data, struct pw_impl_port_mix *mix)
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
	struct mix *m;
 | 
						struct mix *m;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: remove mix id:%d io:%p base:%p",
 | 
						pw_log_debug("%p: remove mix id:%d io:%p base:%p",
 | 
				
			||||||
			this, mix->id, mix->io, impl->io_areas->map->ptr);
 | 
								this, mix->id, mix->io, impl->io_areas->map->ptr);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((m = find_mix(port, mix->port.port_id)) == NULL || !m->valid)
 | 
						if ((m = find_mix(port, mix->port.port_id)) == NULL || !m->valid)
 | 
				
			||||||
| 
						 | 
					@ -1445,7 +1448,7 @@ impl_mix_add_port(void *object, enum spa_direction direction, uint32_t mix_id,
 | 
				
			||||||
		const struct spa_dict *props)
 | 
							const struct spa_dict *props)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct port *port = object;
 | 
						struct port *port = object;
 | 
				
			||||||
	pw_log_debug(NAME " %p: add port %d:%d.%d", object, direction, port->id, mix_id);
 | 
						pw_log_debug("%p: add port %d:%d.%d", object, direction, port->id, mix_id);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1453,7 +1456,7 @@ static int
 | 
				
			||||||
impl_mix_remove_port(void *object, enum spa_direction direction, uint32_t mix_id)
 | 
					impl_mix_remove_port(void *object, enum spa_direction direction, uint32_t mix_id)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct port *port = object;
 | 
						struct port *port = object;
 | 
				
			||||||
	pw_log_debug(NAME " %p: remove port %d:%d.%d", object, direction, port->id, mix_id);
 | 
						pw_log_debug("%p: remove port %d:%d.%d", object, direction, port->id, mix_id);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1526,7 +1529,7 @@ static void node_port_init(void *data, struct pw_impl_port *port)
 | 
				
			||||||
	struct port *p = pw_impl_port_get_user_data(port);
 | 
						struct port *p = pw_impl_port_get_user_data(port);
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: port %p init", this, port);
 | 
						pw_log_debug("%p: port %p init", this, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	*p = this->dummy;
 | 
						*p = this->dummy;
 | 
				
			||||||
	p->port = port;
 | 
						p->port = port;
 | 
				
			||||||
| 
						 | 
					@ -1572,7 +1575,7 @@ static void node_port_removed(void *data, struct pw_impl_port *port)
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
	struct port *p = pw_impl_port_get_user_data(port);
 | 
						struct port *p = pw_impl_port_get_user_data(port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: port %p remove", this, port);
 | 
						pw_log_debug("%p: port %p remove", this, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p->removed = true;
 | 
						p->removed = true;
 | 
				
			||||||
	clear_port(this, p);
 | 
						clear_port(this, p);
 | 
				
			||||||
| 
						 | 
					@ -1589,10 +1592,10 @@ static void node_peer_added(void *data, struct pw_impl_node *peer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m = pw_mempool_import_block(this->client->pool, peer->activation);
 | 
						m = pw_mempool_import_block(this->client->pool, peer->activation);
 | 
				
			||||||
	if (m == NULL) {
 | 
						if (m == NULL) {
 | 
				
			||||||
		pw_log_debug(NAME " %p: can't ensure mem: %m", this);
 | 
							pw_log_debug("%p: can't ensure mem: %m", this);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pw_log_debug(NAME " %p: peer %p id:%u added mem_id:%u", &impl->this, peer,
 | 
						pw_log_debug("%p: peer %p id:%u added mem_id:%u", &impl->this, peer,
 | 
				
			||||||
			peer->info.id, m->id);
 | 
								peer->info.id, m->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->resource == NULL)
 | 
						if (this->resource == NULL)
 | 
				
			||||||
| 
						 | 
					@ -1617,11 +1620,11 @@ static void node_peer_removed(void *data, struct pw_impl_node *peer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m = pw_mempool_find_fd(this->client->pool, peer->activation->fd);
 | 
						m = pw_mempool_find_fd(this->client->pool, peer->activation->fd);
 | 
				
			||||||
	if (m == NULL) {
 | 
						if (m == NULL) {
 | 
				
			||||||
		pw_log_warn(NAME " %p: unknown peer %p fd:%d", this, peer,
 | 
							pw_log_warn("%p: unknown peer %p fd:%d", this, peer,
 | 
				
			||||||
			peer->source.fd);
 | 
								peer->source.fd);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pw_log_debug(NAME " %p: peer %p %u removed", this, peer,
 | 
						pw_log_debug("%p: peer %p %u removed", this, peer,
 | 
				
			||||||
			peer->info.id);
 | 
								peer->info.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->resource != NULL) {
 | 
						if (this->resource != NULL) {
 | 
				
			||||||
| 
						 | 
					@ -1641,7 +1644,7 @@ static void node_driver_changed(void *data, struct pw_impl_node *old, struct pw_
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct node *this = &impl->node;
 | 
						struct node *this = &impl->node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME " %p: driver changed %p -> %p", this, old, driver);
 | 
						pw_log_debug("%p: driver changed %p -> %p", this, old, driver);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	node_peer_removed(data, old);
 | 
						node_peer_removed(data, old);
 | 
				
			||||||
	node_peer_added(data, driver);
 | 
						node_peer_added(data, driver);
 | 
				
			||||||
| 
						 | 
					@ -1708,7 +1711,7 @@ struct pw_impl_client_node *pw_impl_client_node_new(struct pw_resource *resource
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->context = context;
 | 
						impl->context = context;
 | 
				
			||||||
	impl->fds[0] = impl->fds[1] = -1;
 | 
						impl->fds[0] = impl->fds[1] = -1;
 | 
				
			||||||
	pw_log_debug(NAME " %p: new", &impl->node);
 | 
						pw_log_debug("%p: new", &impl->node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	support = pw_context_get_support(impl->context, &n_support);
 | 
						support = pw_context_get_support(impl->context, &n_support);
 | 
				
			||||||
	node_init(&impl->node, NULL, support, n_support);
 | 
						node_init(&impl->node, NULL, support, n_support);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,9 @@
 | 
				
			||||||
#include <pipewire/extensions/protocol-native.h>
 | 
					#include <pipewire/extensions/protocol-native.h>
 | 
				
			||||||
#include <pipewire/extensions/client-node.h>
 | 
					#include <pipewire/extensions/client-node.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_EXTERN(mod_topic);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void push_item(struct spa_pod_builder *b, const struct spa_dict_item *item)
 | 
					static inline void push_item(struct spa_pod_builder *b, const struct spa_dict_item *item)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,6 +43,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MAX_MIX	4096
 | 
					#define MAX_MIX	4096
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_EXTERN(mod_topic);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \cond */
 | 
					/** \cond */
 | 
				
			||||||
static bool mlock_warned = false;
 | 
					static bool mlock_warned = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -110,6 +110,10 @@
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "echo-cancel"
 | 
					#define NAME "echo-cancel"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Hopefully this is enough for any combination of AEC engine and resampler
 | 
					/* Hopefully this is enough for any combination of AEC engine and resampler
 | 
				
			||||||
 * input requirement for rate matching */
 | 
					 * input requirement for rate matching */
 | 
				
			||||||
#define MAX_BUFSIZE_MS 100
 | 
					#define MAX_BUFSIZE_MS 100
 | 
				
			||||||
| 
						 | 
					@ -820,6 +824,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,6 +53,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "example-sink"
 | 
					#define NAME "example-sink"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_FORMAT "S16"
 | 
					#define DEFAULT_FORMAT "S16"
 | 
				
			||||||
#define DEFAULT_RATE "48000"
 | 
					#define DEFAULT_RATE "48000"
 | 
				
			||||||
#define DEFAULT_CHANNELS "2"
 | 
					#define DEFAULT_CHANNELS "2"
 | 
				
			||||||
| 
						 | 
					@ -369,6 +372,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,6 +53,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "example-source"
 | 
					#define NAME "example-source"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_FORMAT "S16"
 | 
					#define DEFAULT_FORMAT "S16"
 | 
				
			||||||
#define DEFAULT_RATE "48000"
 | 
					#define DEFAULT_RATE "48000"
 | 
				
			||||||
#define DEFAULT_CHANNELS "2"
 | 
					#define DEFAULT_CHANNELS "2"
 | 
				
			||||||
| 
						 | 
					@ -389,6 +392,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,6 +49,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "filter-chain"
 | 
					#define NAME "filter-chain"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * \page page_module_filter_chain PipeWire Module: Filter-Chain
 | 
					 * \page page_module_filter_chain PipeWire Module: Filter-Chain
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
| 
						 | 
					@ -1640,6 +1643,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct spa_cpu *cpu_iface;
 | 
						struct spa_cpu *cpu_iface;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,6 +39,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "link-factory"
 | 
					#define NAME "link-factory"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FACTORY_USAGE	PW_KEY_LINK_OUTPUT_NODE"=<output-node> "	\
 | 
					#define FACTORY_USAGE	PW_KEY_LINK_OUTPUT_NODE"=<output-node> "	\
 | 
				
			||||||
			"["PW_KEY_LINK_OUTPUT_PORT"=<output-port>] "	\
 | 
								"["PW_KEY_LINK_OUTPUT_PORT"=<output-port>] "	\
 | 
				
			||||||
			PW_KEY_LINK_INPUT_NODE"=<input-node> "		\
 | 
								PW_KEY_LINK_INPUT_NODE"=<input-node> "		\
 | 
				
			||||||
| 
						 | 
					@ -487,7 +490,7 @@ static void module_registered(void *data)
 | 
				
			||||||
	pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
						if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
				
			||||||
		pw_log_error(NAME" %p: can't register factory: %s", factory, spa_strerror(res));
 | 
							pw_log_error("%p: can't register factory: %s", factory, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -505,6 +508,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct factory_data *data;
 | 
						struct factory_data *data;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	factory = pw_context_create_factory(context,
 | 
						factory = pw_context_create_factory(context,
 | 
				
			||||||
				 "link-factory",
 | 
									 "link-factory",
 | 
				
			||||||
				 PW_TYPE_INTERFACE_Link,
 | 
									 PW_TYPE_INTERFACE_Link,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,6 +47,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "loopback"
 | 
					#define NAME "loopback"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct spa_dict_item module_props[] = {
 | 
					static const struct spa_dict_item module_props[] = {
 | 
				
			||||||
	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
						{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
				
			||||||
	{ PW_KEY_MODULE_DESCRIPTION, "Create loopback streams" },
 | 
						{ PW_KEY_MODULE_DESCRIPTION, "Create loopback streams" },
 | 
				
			||||||
| 
						 | 
					@ -398,6 +401,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,6 +39,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "metadata"
 | 
					#define NAME "metadata"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct spa_dict_item module_props[] = {
 | 
					static const struct spa_dict_item module_props[] = {
 | 
				
			||||||
	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
						{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
 | 
				
			||||||
	{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create metadata store" },
 | 
						{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create metadata store" },
 | 
				
			||||||
| 
						 | 
					@ -142,7 +145,7 @@ static void module_registered(void *data)
 | 
				
			||||||
	pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
						if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
				
			||||||
		pw_log_error(NAME" %p: can't register factory: %s", factory, spa_strerror(res));
 | 
							pw_log_error("%p: can't register factory: %s", factory, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -160,6 +163,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct factory_data *data;
 | 
						struct factory_data *data;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_protocol_native_ext_metadata_init(context)) < 0)
 | 
						if ((res = pw_protocol_native_ext_metadata_init(context)) < 0)
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -81,6 +81,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "portal"
 | 
					#define NAME "portal"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct impl {
 | 
					struct impl {
 | 
				
			||||||
	struct pw_context *context;
 | 
						struct pw_context *context;
 | 
				
			||||||
	struct pw_properties *properties;
 | 
						struct pw_properties *properties;
 | 
				
			||||||
| 
						 | 
					@ -120,7 +123,7 @@ context_check_access(void *data, struct pw_impl_client *client)
 | 
				
			||||||
	items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "portal");
 | 
						items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "portal");
 | 
				
			||||||
	pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_client_update_properties(client, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_info(NAME" %p: portal managed client %p added", impl, client);
 | 
						pw_log_info("%p: portal managed client %p added", impl, client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* portal makes this connection and will change the permissions before
 | 
						/* portal makes this connection and will change the permissions before
 | 
				
			||||||
	 * handing this connection to the client */
 | 
						 * handing this connection to the client */
 | 
				
			||||||
| 
						 | 
					@ -308,6 +311,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	uint32_t n_support;
 | 
						uint32_t n_support;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	support = pw_context_get_support(context, &n_support);
 | 
						support = pw_context_get_support(context, &n_support);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus);
 | 
						dbus = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DBus);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +46,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "profiler"
 | 
					#define NAME "profiler"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define TMP_BUFFER		(16 * 1024)
 | 
					#define TMP_BUFFER		(16 * 1024)
 | 
				
			||||||
#define MAX_BUFFER		(8 * 1024 * 1024)
 | 
					#define MAX_BUFFER		(8 * 1024 * 1024)
 | 
				
			||||||
#define MIN_FLUSH		(16 * 1024)
 | 
					#define MIN_FLUSH		(16 * 1024)
 | 
				
			||||||
| 
						 | 
					@ -135,7 +138,7 @@ static void flush_timeout(void *data, uint64_t expirations)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	avail = spa_ringbuffer_get_read_index(&impl->buffer, &idx);
 | 
						avail = spa_ringbuffer_get_read_index(&impl->buffer, &idx);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace(NAME"%p avail %d", impl, avail);
 | 
						pw_log_trace("%p avail %d", impl, avail);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (avail <= 0) {
 | 
						if (avail <= 0) {
 | 
				
			||||||
		if (++impl->empty == DEFAULT_IDLE)
 | 
							if (++impl->empty == DEFAULT_IDLE)
 | 
				
			||||||
| 
						 | 
					@ -233,12 +236,12 @@ static void context_do_profile(void *data, struct pw_impl_node *node)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	filled = spa_ringbuffer_get_write_index(&impl->buffer, &idx);
 | 
						filled = spa_ringbuffer_get_write_index(&impl->buffer, &idx);
 | 
				
			||||||
	if (filled < 0 || filled > MAX_BUFFER) {
 | 
						if (filled < 0 || filled > MAX_BUFFER) {
 | 
				
			||||||
		pw_log_warn(NAME " %p: queue xrun %d", impl, filled);
 | 
							pw_log_warn("%p: queue xrun %d", impl, filled);
 | 
				
			||||||
		goto done;
 | 
							goto done;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	avail = MAX_BUFFER - filled;
 | 
						avail = MAX_BUFFER - filled;
 | 
				
			||||||
	if (avail < b.state.offset) {
 | 
						if (avail < b.state.offset) {
 | 
				
			||||||
		pw_log_warn(NAME " %p: queue full %d < %d", impl, avail, b.state.offset);
 | 
							pw_log_warn("%p: queue full %d < %d", impl, avail, b.state.offset);
 | 
				
			||||||
		goto done;
 | 
							goto done;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spa_ringbuffer_write_data(&impl->buffer,
 | 
						spa_ringbuffer_write_data(&impl->buffer,
 | 
				
			||||||
| 
						 | 
					@ -280,7 +283,7 @@ static void resource_destroy(void *data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	if (--impl->busy == 0) {
 | 
						if (--impl->busy == 0) {
 | 
				
			||||||
		pw_log_info(NAME" %p: stopping profiler", impl);
 | 
							pw_log_info("%p: stopping profiler", impl);
 | 
				
			||||||
		stop_listener(impl);
 | 
							stop_listener(impl);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -323,7 +326,7 @@ global_bind(void *_data, struct pw_impl_client *client, uint32_t permissions,
 | 
				
			||||||
			&resource_events, impl);
 | 
								&resource_events, impl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (++impl->busy == 1) {
 | 
						if (++impl->busy == 1) {
 | 
				
			||||||
		pw_log_info(NAME" %p: starting profiler", impl);
 | 
							pw_log_info("%p: starting profiler", impl);
 | 
				
			||||||
		pw_loop_invoke(impl->context->data_loop,
 | 
							pw_loop_invoke(impl->context->data_loop,
 | 
				
			||||||
                       do_start, SPA_ID_INVALID, NULL, 0, false, impl);
 | 
					                       do_start, SPA_ID_INVALID, NULL, 0, false, impl);
 | 
				
			||||||
		impl->listening = true;
 | 
							impl->listening = true;
 | 
				
			||||||
| 
						 | 
					@ -357,6 +360,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct impl *impl;
 | 
						struct impl *impl;
 | 
				
			||||||
	struct pw_loop *main_loop = pw_context_get_main_loop(context);
 | 
						struct pw_loop *main_loop = pw_context_get_main_loop(context);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,9 @@
 | 
				
			||||||
#include <pipewire/extensions/protocol-native.h>
 | 
					#include <pipewire/extensions/protocol-native.h>
 | 
				
			||||||
#include <pipewire/extensions/profiler.h>
 | 
					#include <pipewire/extensions/profiler.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_EXTERN(mod_topic);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int profiler_proxy_marshal_add_listener(void *object,
 | 
					static int profiler_proxy_marshal_add_listener(void *object,
 | 
				
			||||||
			struct spa_hook *listener,
 | 
								struct spa_hook *listener,
 | 
				
			||||||
			const struct pw_profiler_events *events,
 | 
								const struct pw_profiler_events *events,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,6 +54,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "protocol-simple"
 | 
					#define NAME "protocol-simple"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_PORT 4711
 | 
					#define DEFAULT_PORT 4711
 | 
				
			||||||
#define DEFAULT_SERVER "[ \"tcp:"SPA_STRINGIFY(DEFAULT_PORT)"\" ]"
 | 
					#define DEFAULT_SERVER "[ \"tcp:"SPA_STRINGIFY(DEFAULT_PORT)"\" ]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -155,7 +158,7 @@ static void client_free(struct client *client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = client->impl;
 | 
						struct impl *impl = client->impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_info(NAME" %p: client:%p [%s] free", impl, client, client->name);
 | 
						pw_log_info("%p: client:%p [%s] free", impl, client, client->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	client_disconnect(client);
 | 
						client_disconnect(client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -211,9 +214,9 @@ on_client_data(void *data, int fd, uint32_t mask)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
error:
 | 
					error:
 | 
				
			||||||
        if (res == -EPIPE)
 | 
					        if (res == -EPIPE)
 | 
				
			||||||
                pw_log_info(NAME" %p: client:%p [%s] disconnected", impl, client, client->name);
 | 
					                pw_log_info("%p: client:%p [%s] disconnected", impl, client, client->name);
 | 
				
			||||||
        else  {
 | 
					        else  {
 | 
				
			||||||
                pw_log_error(NAME" %p: client:%p [%s] error %d (%s)", impl,
 | 
					                pw_log_error("%p: client:%p [%s] error %d (%s)", impl,
 | 
				
			||||||
                                client, client->name, res, spa_strerror(res));
 | 
					                                client, client->name, res, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	client_cleanup(client);
 | 
						client_cleanup(client);
 | 
				
			||||||
| 
						 | 
					@ -503,7 +506,7 @@ on_connect(void *data, int fd, uint32_t mask)
 | 
				
			||||||
	if (client->source == NULL)
 | 
						if (client->source == NULL)
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_info(NAME" %p: client:%p [%s] connected", impl, client, client->name);
 | 
						pw_log_info("%p: client:%p [%s] connected", impl, client, client->name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	props = pw_properties_new(
 | 
						props = pw_properties_new(
 | 
				
			||||||
			PW_KEY_CLIENT_API, "protocol-simple",
 | 
								PW_KEY_CLIENT_API, "protocol-simple",
 | 
				
			||||||
| 
						 | 
					@ -544,7 +547,7 @@ on_connect(void *data, int fd, uint32_t mask)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
error:
 | 
					error:
 | 
				
			||||||
	pw_log_error(NAME" %p: failed to create client: %m", impl);
 | 
						pw_log_error("%p: failed to create client: %m", impl);
 | 
				
			||||||
	pw_properties_free(props);
 | 
						pw_properties_free(props);
 | 
				
			||||||
	if (client != NULL)
 | 
						if (client != NULL)
 | 
				
			||||||
		client_free(client);
 | 
							client_free(client);
 | 
				
			||||||
| 
						 | 
					@ -578,13 +581,13 @@ static int make_inet_socket(struct server *server, const char *name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((fd = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) < 0) {
 | 
						if ((fd = socket(PF_INET, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) < 0) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
		pw_log_error(NAME" %p: socket() failed: %m", server);
 | 
							pw_log_error("%p: socket() failed: %m", server);
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	on = 1;
 | 
						on = 1;
 | 
				
			||||||
	if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void *) &on, sizeof(on)) < 0)
 | 
						if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void *) &on, sizeof(on)) < 0)
 | 
				
			||||||
		pw_log_warn(NAME" %p: setsockopt(): %m", server);
 | 
							pw_log_warn("%p: setsockopt(): %m", server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_zero(addr);
 | 
						spa_zero(addr);
 | 
				
			||||||
	addr.sin_family = AF_INET;
 | 
						addr.sin_family = AF_INET;
 | 
				
			||||||
| 
						 | 
					@ -593,16 +596,16 @@ static int make_inet_socket(struct server *server, const char *name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
 | 
						if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
		pw_log_error(NAME" %p: bind() failed: %m", server);
 | 
							pw_log_error("%p: bind() failed: %m", server);
 | 
				
			||||||
		goto error_close;
 | 
							goto error_close;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (listen(fd, 5) < 0) {
 | 
						if (listen(fd, 5) < 0) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
		pw_log_error(NAME" %p: listen() failed: %m", server);
 | 
							pw_log_error("%p: listen() failed: %m", server);
 | 
				
			||||||
		goto error_close;
 | 
							goto error_close;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	server->type = SERVER_TYPE_INET;
 | 
						server->type = SERVER_TYPE_INET;
 | 
				
			||||||
	pw_log_info(NAME" listening on tcp:%08x:%u", address, port);
 | 
						pw_log_info("listening on tcp:%08x:%u", address, port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return fd;
 | 
						return fd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -617,7 +620,7 @@ static void server_free(struct server *server)
 | 
				
			||||||
	struct impl *impl = server->impl;
 | 
						struct impl *impl = server->impl;
 | 
				
			||||||
	struct client *c;
 | 
						struct client *c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: free server %p", impl, server);
 | 
						pw_log_debug("%p: free server %p", impl, server);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_remove(&server->link);
 | 
						spa_list_remove(&server->link);
 | 
				
			||||||
	spa_list_consume(c, &server->client_list, link)
 | 
						spa_list_consume(c, &server->client_list, link)
 | 
				
			||||||
| 
						 | 
					@ -652,7 +655,7 @@ static struct server *create_server(struct impl *impl, const char *address)
 | 
				
			||||||
	server->source = pw_loop_add_io(impl->loop, fd, SPA_IO_IN, true, on_connect, server);
 | 
						server->source = pw_loop_add_io(impl->loop, fd, SPA_IO_IN, true, on_connect, server);
 | 
				
			||||||
	if (server->source == NULL) {
 | 
						if (server->source == NULL) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
		pw_log_error(NAME" %p: can't create server source: %m", impl);
 | 
							pw_log_error("%p: can't create server source: %m", impl);
 | 
				
			||||||
		goto error_close;
 | 
							goto error_close;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return server;
 | 
						return server;
 | 
				
			||||||
| 
						 | 
					@ -783,7 +786,7 @@ static int parse_params(struct impl *impl)
 | 
				
			||||||
        if (spa_json_enter_array(&it[0], &it[1]) > 0) {
 | 
					        if (spa_json_enter_array(&it[0], &it[1]) > 0) {
 | 
				
			||||||
                while (spa_json_get_string(&it[1], value, sizeof(value)-1) > 0) {
 | 
					                while (spa_json_get_string(&it[1], value, sizeof(value)-1) > 0) {
 | 
				
			||||||
                        if (create_server(impl, value) == NULL) {
 | 
					                        if (create_server(impl, value) == NULL) {
 | 
				
			||||||
				pw_log_warn(NAME" %p: can't create server for %s: %m",
 | 
									pw_log_warn("%p: can't create server for %s: %m",
 | 
				
			||||||
					impl, value);
 | 
										impl, value);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -811,6 +814,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct impl *impl;
 | 
						struct impl *impl;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,6 +56,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "pulse-tunnel"
 | 
					#define NAME "pulse-tunnel"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MODULE_USAGE	"[ remote.name=<remote> ] "				\
 | 
					#define MODULE_USAGE	"[ remote.name=<remote> ] "				\
 | 
				
			||||||
			"[ node.latency=<latency as fraction> ] "		\
 | 
								"[ node.latency=<latency as fraction> ] "		\
 | 
				
			||||||
			"[ node.name=<name of the nodes> ] "			\
 | 
								"[ node.name=<name of the nodes> ] "			\
 | 
				
			||||||
| 
						 | 
					@ -201,10 +204,10 @@ static void playback_stream_process(void *d)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	filled = spa_ringbuffer_get_write_index(&impl->ring, &write_index);
 | 
						filled = spa_ringbuffer_get_write_index(&impl->ring, &write_index);
 | 
				
			||||||
	if (filled < 0) {
 | 
						if (filled < 0) {
 | 
				
			||||||
		pw_log_warn(NAME" %p: underrun write:%u filled:%d",
 | 
							pw_log_warn("%p: underrun write:%u filled:%d",
 | 
				
			||||||
				impl, write_index, filled);
 | 
									impl, write_index, filled);
 | 
				
			||||||
	} else if ((uint32_t)filled + size > RINGBUFFER_SIZE) {
 | 
						} else if ((uint32_t)filled + size > RINGBUFFER_SIZE) {
 | 
				
			||||||
		pw_log_debug(NAME" %p: overrun write:%u filled:%d size:%u max:%u",
 | 
							pw_log_debug("%p: overrun write:%u filled:%d size:%u max:%u",
 | 
				
			||||||
                                        impl, write_index, filled,
 | 
					                                        impl, write_index, filled,
 | 
				
			||||||
                                        size, RINGBUFFER_SIZE);
 | 
					                                        size, RINGBUFFER_SIZE);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -383,10 +386,10 @@ static void stream_read_request_cb(pa_stream *s, size_t length, void *userdata)
 | 
				
			||||||
	filled = spa_ringbuffer_get_write_index(&impl->ring, &write_index);
 | 
						filled = spa_ringbuffer_get_write_index(&impl->ring, &write_index);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (filled < 0) {
 | 
						if (filled < 0) {
 | 
				
			||||||
		pw_log_warn(NAME" %p: underrun write:%u filled:%d",
 | 
							pw_log_warn("%p: underrun write:%u filled:%d",
 | 
				
			||||||
				impl, write_index, filled);
 | 
									impl, write_index, filled);
 | 
				
			||||||
	} else if (filled + length > RINGBUFFER_SIZE) {
 | 
						} else if (filled + length > RINGBUFFER_SIZE) {
 | 
				
			||||||
		pw_log_warn(NAME" %p: overrun write:%u filled:%d",
 | 
							pw_log_warn("%p: overrun write:%u filled:%d",
 | 
				
			||||||
				impl, write_index, filled);
 | 
									impl, write_index, filled);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	while (length > 0) {
 | 
						while (length > 0) {
 | 
				
			||||||
| 
						 | 
					@ -733,6 +736,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,6 +85,11 @@
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "roc-sink"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ROC_DEFAULT_IP "0.0.0.0"
 | 
					#define ROC_DEFAULT_IP "0.0.0.0"
 | 
				
			||||||
#define ROC_DEFAULT_SOURCE_PORT 10001
 | 
					#define ROC_DEFAULT_SOURCE_PORT 10001
 | 
				
			||||||
#define ROC_DEFAULT_REPAIR_PORT 10002
 | 
					#define ROC_DEFAULT_REPAIR_PORT 10002
 | 
				
			||||||
| 
						 | 
					@ -384,6 +389,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	char *local_ip = NULL, *remote_ip = NULL;
 | 
						char *local_ip = NULL, *remote_ip = NULL;
 | 
				
			||||||
	int res = 0, remote_repair_port, remote_source_port;
 | 
						int res = 0, remote_repair_port, remote_source_port;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data = calloc(1, sizeof(struct module_roc_sink_data));
 | 
						data = calloc(1, sizeof(struct module_roc_sink_data));
 | 
				
			||||||
	if (data == NULL)
 | 
						if (data == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,6 +88,11 @@
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "roc-source"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ROC_DEFAULT_IP           "0.0.0.0"
 | 
					#define ROC_DEFAULT_IP           "0.0.0.0"
 | 
				
			||||||
#define ROC_DEFAULT_SOURCE_PORT  10001
 | 
					#define ROC_DEFAULT_SOURCE_PORT  10001
 | 
				
			||||||
#define ROC_DEFAULT_REPAIR_PORT  10002
 | 
					#define ROC_DEFAULT_REPAIR_PORT  10002
 | 
				
			||||||
| 
						 | 
					@ -429,6 +434,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	char *local_ip = NULL, *resampler_profile = NULL;
 | 
						char *local_ip = NULL, *resampler_profile = NULL;
 | 
				
			||||||
	int res = 0, local_repair_port, local_source_port, sess_latency_msec;
 | 
						int res = 0, local_repair_port, local_source_port, sess_latency_msec;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data = calloc(1, sizeof(struct module_roc_source_data));
 | 
						data = calloc(1, sizeof(struct module_roc_source_data));
 | 
				
			||||||
	if (data == NULL)
 | 
						if (data == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,12 @@
 | 
				
			||||||
/** \page page_module_rt PipeWire Module: RT
 | 
					/** \page page_module_rt PipeWire Module: RT
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "rt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_POLICY	SCHED_FIFO
 | 
					#define DEFAULT_POLICY	SCHED_FIFO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_NICE_LEVEL -11
 | 
					#define DEFAULT_NICE_LEVEL -11
 | 
				
			||||||
| 
						 | 
					@ -249,6 +255,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	int nice_level;
 | 
						int nice_level;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -48,6 +48,11 @@
 | 
				
			||||||
/** \page page_module_rtkit PipeWire Module: RTKit
 | 
					/** \page page_module_rtkit PipeWire Module: RTKit
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "rtkit"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DEFAULT_NICE_LEVEL	-11
 | 
					#define DEFAULT_NICE_LEVEL	-11
 | 
				
			||||||
#define DEFAULT_RT_PRIO		88
 | 
					#define DEFAULT_RT_PRIO		88
 | 
				
			||||||
#define DEFAULT_RT_TIME_SOFT	2000000
 | 
					#define DEFAULT_RT_TIME_SOFT	2000000
 | 
				
			||||||
| 
						 | 
					@ -675,6 +680,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	const char *str;
 | 
						const char *str;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((props = pw_context_get_properties(context)) != NULL &&
 | 
						if ((props = pw_context_get_properties(context)) != NULL &&
 | 
				
			||||||
	    (str = pw_properties_get(props, "support.dbus")) != NULL &&
 | 
						    (str = pw_properties_get(props, "support.dbus")) != NULL &&
 | 
				
			||||||
	    !pw_properties_parse_bool(str))
 | 
						    !pw_properties_parse_bool(str))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,6 +51,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "zeroconf-discover"
 | 
					#define NAME "zeroconf-discover"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MODULE_USAGE	" "
 | 
					#define MODULE_USAGE	" "
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct spa_dict_item module_props[] = {
 | 
					static const struct spa_dict_item module_props[] = {
 | 
				
			||||||
| 
						 | 
					@ -479,6 +482,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct impl *impl;
 | 
						struct impl *impl;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl));
 | 
						impl = calloc(1, sizeof(struct impl));
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		goto error_errno;
 | 
							goto error_errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "spa-device-factory"
 | 
					#define NAME "spa-device-factory"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FACTORY_USAGE	SPA_KEY_FACTORY_NAME"=<factory-name> " \
 | 
					#define FACTORY_USAGE	SPA_KEY_FACTORY_NAME"=<factory-name> " \
 | 
				
			||||||
			"["SPA_KEY_LIBRARY_NAME"=<library-name>]"
 | 
								"["SPA_KEY_LIBRARY_NAME"=<library-name>]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,7 +232,7 @@ static void module_registered(void *data)
 | 
				
			||||||
	pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
						if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
				
			||||||
		pw_log_error(NAME" %p: can't register factory: %s", factory, spa_strerror(res));
 | 
							pw_log_error("%p: can't register factory: %s", factory, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -246,6 +249,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct pw_impl_factory *factory;
 | 
						struct pw_impl_factory *factory;
 | 
				
			||||||
	struct factory_data *data;
 | 
						struct factory_data *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	factory = pw_context_create_factory(context,
 | 
						factory = pw_context_create_factory(context,
 | 
				
			||||||
				 "spa-device-factory",
 | 
									 "spa-device-factory",
 | 
				
			||||||
				 PW_TYPE_INTERFACE_Device,
 | 
									 PW_TYPE_INTERFACE_Device,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "spa-device.h"
 | 
					#include "spa-device.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "spa-device"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MODULE_USAGE "<factory> [key=value ...]"
 | 
					#define MODULE_USAGE "<factory> [key=value ...]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct spa_dict_item module_props[] = {
 | 
					static const struct spa_dict_item module_props[] = {
 | 
				
			||||||
| 
						 | 
					@ -72,6 +77,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
        struct device_data *data;
 | 
					        struct device_data *data;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (args == NULL)
 | 
						if (args == NULL)
 | 
				
			||||||
		goto error_arguments;
 | 
							goto error_arguments;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,9 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NAME "spa-node-factory"
 | 
					#define NAME "spa-node-factory"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FACTORY_USAGE	SPA_KEY_FACTORY_NAME"=<factory-name> " \
 | 
					#define FACTORY_USAGE	SPA_KEY_FACTORY_NAME"=<factory-name> " \
 | 
				
			||||||
			"["SPA_KEY_LIBRARY_NAME"=<library-name>]"
 | 
								"["SPA_KEY_LIBRARY_NAME"=<library-name>]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -228,7 +231,7 @@ static void module_registered(void *data)
 | 
				
			||||||
	pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
						pw_impl_factory_update_properties(factory, &SPA_DICT_INIT(items, 1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
						if ((res = pw_impl_factory_register(factory, NULL)) < 0) {
 | 
				
			||||||
		pw_log_error(NAME" %p: can't register factory: %s", factory, spa_strerror(res));
 | 
							pw_log_error("%p: can't register factory: %s", factory, spa_strerror(res));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -245,6 +248,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct pw_impl_factory *factory;
 | 
						struct pw_impl_factory *factory;
 | 
				
			||||||
	struct factory_data *data;
 | 
						struct factory_data *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	factory = pw_context_create_factory(context,
 | 
						factory = pw_context_create_factory(context,
 | 
				
			||||||
				 "spa-node-factory",
 | 
									 "spa-node-factory",
 | 
				
			||||||
				 PW_TYPE_INTERFACE_Node,
 | 
									 PW_TYPE_INTERFACE_Node,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,6 +33,11 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "spa-node.h"
 | 
					#include "spa-node.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "spa-node"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
 | 
				
			||||||
 | 
					#define PW_LOG_TOPIC_DEFAULT mod_topic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MODULE_USAGE	"<factory> [key=value ...]"
 | 
					#define MODULE_USAGE	"<factory> [key=value ...]"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const struct spa_dict_item module_props[] = {
 | 
					static const struct spa_dict_item module_props[] = {
 | 
				
			||||||
| 
						 | 
					@ -72,6 +77,8 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
 | 
				
			||||||
	struct pw_impl_node *node;
 | 
						struct pw_impl_node *node;
 | 
				
			||||||
        struct node_data *data;
 | 
					        struct node_data *data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (args == NULL)
 | 
						if (args == NULL)
 | 
				
			||||||
		goto error_arguments;
 | 
							goto error_arguments;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue