mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	keys: add keys.h with defines and docs
Add a keys.h file that lists and documents all keys available to be used in properties.
This commit is contained in:
		
							parent
							
								
									7bb6515800
								
							
						
					
					
						commit
						3ad73f0532
					
				
					 52 changed files with 483 additions and 291 deletions
				
			
		|  | @ -1 +1 @@ | ||||||
| Subproject commit ddd753cfc5161797f624b4795e8c7bb71ebfad6d | Subproject commit d81bbae7ea2cb07abe85636bd52ab19b06b20dee | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit 998263819ab94ca1188782b66dc26b9f518b1bc5 | Subproject commit 8646c4976070a7c8cfbf710a294be45e15206b6c | ||||||
|  | @ -1 +1 @@ | ||||||
| Subproject commit 2057d7955ce73db0e9cd16d38bbaf8c05b06fb80 | Subproject commit 7d5e860d0c40383bbfa57b4a2ef84505e4071942 | ||||||
|  | @ -97,8 +97,8 @@ int main(int argc, char *argv[]) | ||||||
| 		return -1; | 		return -1; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	props = pw_properties_new(PW_CORE_PROP_NAME, daemon_name, | 	props = pw_properties_new(PW_KEY_CORE_NAME, daemon_name, | ||||||
| 				  PW_CORE_PROP_DAEMON, "1", NULL); | 				  PW_KEY_CORE_DAEMON, "1", NULL); | ||||||
| 
 | 
 | ||||||
| 	loop = pw_main_loop_new(props); | 	loop = pw_main_loop_new(props); | ||||||
| 	pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGINT, do_quit, loop); | 	pw_loop_add_signal(pw_main_loop_get_loop(loop), SIGINT, do_quit, loop); | ||||||
|  |  | ||||||
|  | @ -116,13 +116,13 @@ int main(int argc, char *argv[]) | ||||||
| 	 * the fd of this pipewire mainloop to it. */ | 	 * the fd of this pipewire mainloop to it. */ | ||||||
| 	data.loop = pw_main_loop_new(NULL); | 	data.loop = pw_main_loop_new(NULL); | ||||||
| 
 | 
 | ||||||
| 	/* create a simple stream, the simple stream manages to core and remote
 | 	/* Create a simple stream, the simple stream manages the core and remote
 | ||||||
| 	 * objects for you if you don't need to deal with them | 	 * objects for you if you don't need to deal with them. | ||||||
| 	 * | 	 * | ||||||
| 	 * If you plan to autoconnect your stream, you need to provide at least | 	 * If you plan to autoconnect your stream, you need to provide at least | ||||||
| 	 * media, category and role properties | 	 * media, category and role properties. | ||||||
| 	 * | 	 * | ||||||
| 	 * Pass your events and a use_data pointer as the last arguments. This | 	 * Pass your events and a user_data pointer as the last arguments. This | ||||||
| 	 * will inform you about the stream state. The most important event | 	 * will inform you about the stream state. The most important event | ||||||
| 	 * you need to listen to is the process event where you need to produce | 	 * you need to listen to is the process event where you need to produce | ||||||
| 	 * the data. | 	 * the data. | ||||||
|  | @ -131,22 +131,22 @@ int main(int argc, char *argv[]) | ||||||
| 			pw_main_loop_get_loop(data.loop), | 			pw_main_loop_get_loop(data.loop), | ||||||
| 			"audio-src", | 			"audio-src", | ||||||
| 			pw_properties_new( | 			pw_properties_new( | ||||||
| 				PW_NODE_PROP_MEDIA, "Audio", | 				PW_KEY_MEDIA_TYPE, "Audio", | ||||||
| 				PW_NODE_PROP_CATEGORY, "Playback", | 				PW_KEY_MEDIA_CATEGORY, "Playback", | ||||||
| 				PW_NODE_PROP_ROLE, "Music", | 				PW_KEY_MEDIA_ROLE, "Music", | ||||||
| 				NULL), | 				NULL), | ||||||
| 			&stream_events, | 			&stream_events, | ||||||
| 			&data); | 			&data); | ||||||
| 
 | 
 | ||||||
| 	/* make one parameter with the supported formats. The SPA_PARAM_EnumFormat
 | 	/* Make one parameter with the supported formats. The SPA_PARAM_EnumFormat
 | ||||||
| 	 * id means that this is a format enumeration. */ | 	 * id means that this is a format enumeration (of 1 value). */ | ||||||
| 	params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, | 	params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, | ||||||
| 			&SPA_AUDIO_INFO_RAW_INIT( | 			&SPA_AUDIO_INFO_RAW_INIT( | ||||||
| 				.format = SPA_AUDIO_FORMAT_F32, | 				.format = SPA_AUDIO_FORMAT_F32, | ||||||
| 				.channels = DEFAULT_CHANNELS, | 				.channels = DEFAULT_CHANNELS, | ||||||
| 				.rate = DEFAULT_RATE )); | 				.rate = DEFAULT_RATE )); | ||||||
| 
 | 
 | ||||||
| 	/* now connect this stream. We ask that our process function is
 | 	/* Now connect this stream. We ask that our process function is
 | ||||||
| 	 * called in a realtime thread. */ | 	 * called in a realtime thread. */ | ||||||
| 	pw_stream_connect(data.stream, | 	pw_stream_connect(data.stream, | ||||||
| 			  PW_DIRECTION_OUTPUT, | 			  PW_DIRECTION_OUTPUT, | ||||||
|  | @ -156,7 +156,7 @@ int main(int argc, char *argv[]) | ||||||
| 			  PW_STREAM_FLAG_RT_PROCESS, | 			  PW_STREAM_FLAG_RT_PROCESS, | ||||||
| 			  params, 1); | 			  params, 1); | ||||||
| 
 | 
 | ||||||
| 	/* and wait */ | 	/* and wait while we let things run */ | ||||||
| 	pw_main_loop_run(data.loop); | 	pw_main_loop_run(data.loop); | ||||||
| 
 | 
 | ||||||
| 	pw_stream_destroy(data.stream); | 	pw_stream_destroy(data.stream); | ||||||
|  |  | ||||||
|  | @ -458,12 +458,12 @@ static void make_node(struct data *data) | ||||||
| { | { | ||||||
| 	struct pw_properties *props; | 	struct pw_properties *props; | ||||||
| 
 | 
 | ||||||
| 	props = pw_properties_new(PW_NODE_PROP_AUTOCONNECT, "1", NULL); | 	props = pw_properties_new(PW_KEY_NODE_AUTOCONNECT, "1", NULL); | ||||||
| 	if (data->path) | 	if (data->path) | ||||||
| 		pw_properties_set(props, PW_NODE_PROP_TARGET_NODE, data->path); | 		pw_properties_set(props, PW_KEY_NODE_TARGET, data->path); | ||||||
| 	pw_properties_set(props, PW_NODE_PROP_MEDIA, "Video"); | 	pw_properties_set(props, PW_KEY_MEDIA_TYPE, "Video"); | ||||||
| 	pw_properties_set(props, PW_NODE_PROP_CATEGORY, "Capture"); | 	pw_properties_set(props, PW_KEY_MEDIA_CATEGORY, "Capture"); | ||||||
| 	pw_properties_set(props, PW_NODE_PROP_ROLE, "Camera"); | 	pw_properties_set(props, PW_KEY_MEDIA_ROLE, "Camera"); | ||||||
| 
 | 
 | ||||||
| 	data->impl_node.iface = SPA_INTERFACE_INIT( | 	data->impl_node.iface = SPA_INTERFACE_INIT( | ||||||
| 			SPA_TYPE_INTERFACE_Node, | 			SPA_TYPE_INTERFACE_Node, | ||||||
|  |  | ||||||
|  | @ -464,14 +464,14 @@ static void make_node(struct data *data) | ||||||
| { | { | ||||||
| 	struct pw_properties *props; | 	struct pw_properties *props; | ||||||
| 
 | 
 | ||||||
| 	props = pw_properties_new(PW_NODE_PROP_AUTOCONNECT, "1", | 	props = pw_properties_new(PW_KEY_NODE_AUTOCONNECT, "1", | ||||||
| 				  PW_NODE_PROP_EXCLUSIVE, "1", | 				  PW_KEY_NODE_EXCLUSIVE, "1", | ||||||
| 				  PW_NODE_PROP_MEDIA, "Audio", | 				  PW_KEY_MEDIA_TYPE, "Audio", | ||||||
| 				  PW_NODE_PROP_CATEGORY, "Playback", | 				  PW_KEY_MEDIA_CATEGORY, "Playback", | ||||||
| 				  PW_NODE_PROP_ROLE, "Music", | 				  PW_KEY_MEDIA_ROLE, "Music", | ||||||
| 				  NULL); | 				  NULL); | ||||||
| 	if (data->path) | 	if (data->path) | ||||||
| 		pw_properties_set(props, PW_NODE_PROP_TARGET_NODE, data->path); | 		pw_properties_set(props, PW_KEY_NODE_TARGET, data->path); | ||||||
| 
 | 
 | ||||||
| 	data->impl_node.iface = SPA_INTERFACE_INIT( | 	data->impl_node.iface = SPA_INTERFACE_INIT( | ||||||
| 			SPA_TYPE_INTERFACE_Node, | 			SPA_TYPE_INTERFACE_Node, | ||||||
|  | @ -522,7 +522,7 @@ int main(int argc, char *argv[]) | ||||||
| 		SPA_PORT_CHANGE_MASK_PARAMS; | 		SPA_PORT_CHANGE_MASK_PARAMS; | ||||||
| 	data.info = SPA_PORT_INFO_INIT(); | 	data.info = SPA_PORT_INFO_INIT(); | ||||||
| 	data.info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS; | 	data.info.flags = SPA_PORT_FLAG_CAN_USE_BUFFERS; | ||||||
| 	data.items[0] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio"); | 	data.items[0] = SPA_DICT_ITEM_INIT(PW_KEY_FORMAT_DSP, "32 bit float mono audio"); | ||||||
| 	data.dict = SPA_DICT_INIT_ARRAY(data.items); | 	data.dict = SPA_DICT_INIT_ARRAY(data.items); | ||||||
| 	data.info.props = &data.dict; | 	data.info.props = &data.dict; | ||||||
| 	data.params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ); | 	data.params[0] = SPA_PARAM_INFO(SPA_PARAM_EnumFormat, SPA_PARAM_INFO_READ); | ||||||
|  |  | ||||||
|  | @ -58,8 +58,8 @@ static int make_node(struct data *data) | ||||||
|                                   "spa.factory.name", data->factory, NULL); |                                   "spa.factory.name", data->factory, NULL); | ||||||
| 
 | 
 | ||||||
| 	if (data->path) { | 	if (data->path) { | ||||||
| 		pw_properties_set(props, PW_NODE_PROP_AUTOCONNECT, "1"); | 		pw_properties_set(props, PW_KEY_NODE_AUTOCONNECT, "1"); | ||||||
| 		pw_properties_set(props, PW_NODE_PROP_TARGET_NODE, data->path); | 		pw_properties_set(props, PW_KEY_NODE_TARGET, data->path); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|         data->node = pw_factory_create_object(factory, |         data->node = pw_factory_create_object(factory, | ||||||
|  |  | ||||||
|  | @ -291,18 +291,18 @@ static int link_session_dsp(struct impl *impl, struct session *session) | ||||||
| 	pw_log_debug(NAME " %p: link session dsp '%d'", impl, session->id); | 	pw_log_debug(NAME " %p: link session dsp '%d'", impl, session->id); | ||||||
| 
 | 
 | ||||||
| 	props = pw_properties_new(NULL, NULL); | 	props = pw_properties_new(NULL, NULL); | ||||||
| 	pw_properties_set(props, PW_LINK_PROP_PASSIVE, "true"); | 	pw_properties_set(props, PW_KEY_LINK_PASSIVE, "true"); | ||||||
| 	if (session->direction == PW_DIRECTION_OUTPUT) { | 	if (session->direction == PW_DIRECTION_OUTPUT) { | ||||||
| 		pw_properties_setf(props, PW_LINK_OUTPUT_NODE_ID, "%d", session->dsp->info->id); | 		pw_properties_setf(props, PW_KEY_LINK_OUTPUT_NODE, "%d", session->dsp->info->id); | ||||||
| 		pw_properties_setf(props, PW_LINK_OUTPUT_PORT_ID, "%d", -1); | 		pw_properties_setf(props, PW_KEY_LINK_OUTPUT_PORT, "%d", -1); | ||||||
| 		pw_properties_setf(props, PW_LINK_INPUT_NODE_ID, "%d", session->node->info->id); | 		pw_properties_setf(props, PW_KEY_LINK_INPUT_NODE, "%d", session->node->info->id); | ||||||
| 		pw_properties_setf(props, PW_LINK_INPUT_PORT_ID, "%d", -1); | 		pw_properties_setf(props, PW_KEY_LINK_INPUT_PORT, "%d", -1); | ||||||
| 	} | 	} | ||||||
| 	else { | 	else { | ||||||
| 		pw_properties_setf(props, PW_LINK_OUTPUT_NODE_ID, "%d", session->node->info->id); | 		pw_properties_setf(props, PW_KEY_LINK_OUTPUT_NODE, "%d", session->node->info->id); | ||||||
| 		pw_properties_setf(props, PW_LINK_OUTPUT_PORT_ID, "%d", -1); | 		pw_properties_setf(props, PW_KEY_LINK_OUTPUT_PORT, "%d", -1); | ||||||
| 		pw_properties_setf(props, PW_LINK_INPUT_NODE_ID, "%d", session->dsp->info->id); | 		pw_properties_setf(props, PW_KEY_LINK_INPUT_NODE, "%d", session->dsp->info->id); | ||||||
| 		pw_properties_setf(props, PW_LINK_INPUT_PORT_ID, "%d", -1); | 		pw_properties_setf(props, PW_KEY_LINK_INPUT_PORT, "%d", -1); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|         session->link_proxy = pw_core_proxy_create_object(impl->core_proxy, |         session->link_proxy = pw_core_proxy_create_object(impl->core_proxy, | ||||||
|  | @ -478,7 +478,7 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id, | ||||||
| 	struct pw_proxy *p; | 	struct pw_proxy *p; | ||||||
| 	struct node *node; | 	struct node *node; | ||||||
| 
 | 
 | ||||||
| 	media_class = props ? spa_dict_lookup(props, "media.class") : NULL; | 	media_class = props ? spa_dict_lookup(props, PW_KEY_MEDIA_CLASS) : NULL; | ||||||
| 
 | 
 | ||||||
| 	p = pw_registry_proxy_bind(impl->registry_proxy, | 	p = pw_registry_proxy_bind(impl->registry_proxy, | ||||||
| 			id, type, PW_VERSION_NODE_PROXY, | 			id, type, PW_VERSION_NODE_PROXY, | ||||||
|  | @ -556,7 +556,7 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id, | ||||||
| 		sess->enabled = false; | 		sess->enabled = false; | ||||||
| 		sess->starting = true; | 		sess->starting = true; | ||||||
| 		sess->node = node; | 		sess->node = node; | ||||||
| 		if ((str = spa_dict_lookup(props, "node.plugged")) != NULL) | 		if ((str = spa_dict_lookup(props, PW_KEY_NODE_PLUGGED)) != NULL) | ||||||
| 			sess->plugged = pw_properties_parse_uint64(str); | 			sess->plugged = pw_properties_parse_uint64(str); | ||||||
| 		else | 		else | ||||||
| 			sess->plugged = SPA_TIMESPEC_TO_NSEC(&impl->now); | 			sess->plugged = SPA_TIMESPEC_TO_NSEC(&impl->now); | ||||||
|  | @ -653,7 +653,7 @@ handle_port(struct impl *impl, uint32_t id, uint32_t parent_id, uint32_t type, | ||||||
| 	if ((node = find_object(impl, parent_id)) == NULL) | 	if ((node = find_object(impl, parent_id)) == NULL) | ||||||
| 		return -ESRCH; | 		return -ESRCH; | ||||||
| 
 | 
 | ||||||
| 	if (props == NULL || (str = spa_dict_lookup(props, "port.direction")) == NULL) | 	if (props == NULL || (str = spa_dict_lookup(props, PW_KEY_PORT_DIRECTION)) == NULL) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 
 | 
 | ||||||
| 	p = pw_registry_proxy_bind(impl->registry_proxy, | 	p = pw_registry_proxy_bind(impl->registry_proxy, | ||||||
|  | @ -669,7 +669,7 @@ handle_port(struct impl *impl, uint32_t id, uint32_t parent_id, uint32_t type, | ||||||
| 	port->node = node; | 	port->node = node; | ||||||
| 	port->direction = strcmp(str, "out") ? PW_DIRECTION_OUTPUT : PW_DIRECTION_INPUT; | 	port->direction = strcmp(str, "out") ? PW_DIRECTION_OUTPUT : PW_DIRECTION_INPUT; | ||||||
| 
 | 
 | ||||||
| 	if (props != NULL && (str = spa_dict_lookup(props, "port.dsp")) != NULL) | 	if (props != NULL && (str = spa_dict_lookup(props, PW_KEY_FORMAT_DSP)) != NULL) | ||||||
| 		port->flags |= PORT_FLAG_DSP; | 		port->flags |= PORT_FLAG_DSP; | ||||||
| 	if (node->type == NODE_TYPE_DSP && !(port->flags & PORT_FLAG_DSP)) | 	if (node->type == NODE_TYPE_DSP && !(port->flags & PORT_FLAG_DSP)) | ||||||
| 		port->flags |= PORT_FLAG_SKIP; | 		port->flags |= PORT_FLAG_SKIP; | ||||||
|  | @ -755,7 +755,7 @@ handle_client(struct impl *impl, uint32_t id, uint32_t parent_id, | ||||||
| 	if (props == NULL) | 	if (props == NULL) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
| 	str = spa_dict_lookup(props, "pipewire.access"); | 	str = spa_dict_lookup(props, PW_KEY_ACCESS); | ||||||
| 	if (str == NULL) | 	if (str == NULL) | ||||||
| 		return 0; | 		return 0; | ||||||
| 
 | 
 | ||||||
|  | @ -865,7 +865,7 @@ static int find_session(void *data, struct session *sess) | ||||||
| 		if ((props = sess->node->info->props) == NULL) | 		if ((props = sess->node->info->props) == NULL) | ||||||
| 			return 0; | 			return 0; | ||||||
| 
 | 
 | ||||||
| 		if ((str = spa_dict_lookup(props, "media.class")) == NULL) | 		if ((str = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS)) == NULL) | ||||||
| 			return 0; | 			return 0; | ||||||
| 
 | 
 | ||||||
| 		if (strcmp(str, find->media_class) != 0) | 		if (strcmp(str, find->media_class) != 0) | ||||||
|  | @ -912,19 +912,19 @@ static int link_nodes(struct node *peer, enum pw_direction direction, struct nod | ||||||
| 
 | 
 | ||||||
| 		props = pw_properties_new(NULL, NULL); | 		props = pw_properties_new(NULL, NULL); | ||||||
| 		if (p->direction == PW_DIRECTION_OUTPUT) { | 		if (p->direction == PW_DIRECTION_OUTPUT) { | ||||||
| 			pw_properties_setf(props, PW_LINK_OUTPUT_NODE_ID, "%d", node->obj.id); | 			pw_properties_setf(props, PW_KEY_LINK_OUTPUT_NODE, "%d", node->obj.id); | ||||||
| 			pw_properties_setf(props, PW_LINK_OUTPUT_PORT_ID, "%d", -1); | 			pw_properties_setf(props, PW_KEY_LINK_OUTPUT_PORT, "%d", -1); | ||||||
| 			pw_properties_setf(props, PW_LINK_INPUT_NODE_ID, "%d", peer->obj.id); | 			pw_properties_setf(props, PW_KEY_LINK_INPUT_NODE, "%d", peer->obj.id); | ||||||
| 			pw_properties_setf(props, PW_LINK_INPUT_PORT_ID, "%d", p->obj.id); | 			pw_properties_setf(props, PW_KEY_LINK_INPUT_PORT, "%d", p->obj.id); | ||||||
| 			pw_log_debug(NAME " %p: node %d -> port %d:%d", impl, | 			pw_log_debug(NAME " %p: node %d -> port %d:%d", impl, | ||||||
| 					node->obj.id, peer->obj.id, p->obj.id); | 					node->obj.id, peer->obj.id, p->obj.id); | ||||||
| 
 | 
 | ||||||
| 		} | 		} | ||||||
| 		else { | 		else { | ||||||
| 			pw_properties_setf(props, PW_LINK_OUTPUT_NODE_ID, "%d", peer->obj.id); | 			pw_properties_setf(props, PW_KEY_LINK_OUTPUT_NODE, "%d", peer->obj.id); | ||||||
| 			pw_properties_setf(props, PW_LINK_OUTPUT_PORT_ID, "%d", p->obj.id); | 			pw_properties_setf(props, PW_KEY_LINK_OUTPUT_PORT, "%d", p->obj.id); | ||||||
| 			pw_properties_setf(props, PW_LINK_INPUT_NODE_ID, "%d", node->obj.id); | 			pw_properties_setf(props, PW_KEY_LINK_INPUT_NODE, "%d", node->obj.id); | ||||||
| 			pw_properties_setf(props, PW_LINK_INPUT_PORT_ID, "%d", -1); | 			pw_properties_setf(props, PW_KEY_LINK_INPUT_PORT, "%d", -1); | ||||||
| 			pw_log_debug(NAME " %p: port %d:%d -> node %d", impl, | 			pw_log_debug(NAME " %p: port %d:%d -> node %d", impl, | ||||||
| 					peer->obj.id, p->obj.id, node->obj.id); | 					peer->obj.id, p->obj.id, node->obj.id); | ||||||
| 		} | 		} | ||||||
|  | @ -986,20 +986,20 @@ static int rescan_node(struct impl *impl, struct node *node) | ||||||
| 	info = node->info; | 	info = node->info; | ||||||
| 	props = info->props; | 	props = info->props; | ||||||
| 
 | 
 | ||||||
|         str = spa_dict_lookup(props, PW_NODE_PROP_AUTOCONNECT); |         str = spa_dict_lookup(props, PW_KEY_NODE_AUTOCONNECT); | ||||||
|         if (str == NULL || !pw_properties_parse_bool(str)) { |         if (str == NULL || !pw_properties_parse_bool(str)) { | ||||||
| 		pw_log_debug(NAME" %p: node %d does not need autoconnect", impl, node->obj.id); | 		pw_log_debug(NAME" %p: node %d does not need autoconnect", impl, node->obj.id); | ||||||
|                 return 0; |                 return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((media = spa_dict_lookup(props, PW_NODE_PROP_MEDIA)) == NULL) | 	if ((media = spa_dict_lookup(props, PW_KEY_MEDIA_TYPE)) == NULL) | ||||||
| 		media = node->media; | 		media = node->media; | ||||||
| 	if (media == NULL) { | 	if (media == NULL) { | ||||||
| 		pw_log_debug(NAME" %p: node %d has unknown media", impl, node->obj.id); | 		pw_log_debug(NAME" %p: node %d has unknown media", impl, node->obj.id); | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((category = spa_dict_lookup(props, PW_NODE_PROP_CATEGORY)) == NULL) { | 	if ((category = spa_dict_lookup(props, PW_KEY_MEDIA_CATEGORY)) == NULL) { | ||||||
| 		pw_log_debug(NAME" %p: node %d find category from ports: %d %d", | 		pw_log_debug(NAME" %p: node %d find category from ports: %d %d", | ||||||
| 			impl, node->obj.id, info->n_input_ports, info->n_output_ports); | 			impl, node->obj.id, info->n_input_ports, info->n_output_ports); | ||||||
| 		if (node->direction == PW_DIRECTION_INPUT || | 		if (node->direction == PW_DIRECTION_INPUT || | ||||||
|  | @ -1017,7 +1017,7 @@ static int rescan_node(struct impl *impl, struct node *node) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((role = spa_dict_lookup(props, PW_NODE_PROP_ROLE)) == NULL) { | 	if ((role = spa_dict_lookup(props, PW_KEY_MEDIA_ROLE)) == NULL) { | ||||||
| 		if (strcmp(media, "Audio") == 0) { | 		if (strcmp(media, "Audio") == 0) { | ||||||
| 			if (strcmp(category, "Duplex") == 0) | 			if (strcmp(category, "Duplex") == 0) | ||||||
| 				role = "Communication"; | 				role = "Communication"; | ||||||
|  | @ -1036,7 +1036,7 @@ static int rescan_node(struct impl *impl, struct node *node) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((str = spa_dict_lookup(props, PW_NODE_PROP_EXCLUSIVE)) != NULL) | 	if ((str = spa_dict_lookup(props, PW_KEY_NODE_EXCLUSIVE)) != NULL) | ||||||
| 		exclusive = pw_properties_parse_bool(str); | 		exclusive = pw_properties_parse_bool(str); | ||||||
| 	else | 	else | ||||||
| 		exclusive = false; | 		exclusive = false; | ||||||
|  | @ -1077,7 +1077,7 @@ static int rescan_node(struct impl *impl, struct node *node) | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	str = spa_dict_lookup(props, PW_NODE_PROP_TARGET_NODE); | 	str = spa_dict_lookup(props, PW_KEY_NODE_TARGET); | ||||||
| 	if (str != NULL) | 	if (str != NULL) | ||||||
| 		find.path_id = atoi(str); | 		find.path_id = atoi(str); | ||||||
| 	else | 	else | ||||||
|  | @ -1106,7 +1106,7 @@ static int rescan_node(struct impl *impl, struct node *node) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		else { | 		else { | ||||||
| 			str = spa_dict_lookup(props, "pipewire.dont-reconnect"); | 			str = spa_dict_lookup(props, PW_KEY_NODE_DONT_RECONNECT); | ||||||
| 			if (str != NULL && pw_properties_parse_bool(str)) { | 			if (str != NULL && pw_properties_parse_bool(str)) { | ||||||
| 				pw_registry_proxy_destroy(impl->registry_proxy, node->obj.id); | 				pw_registry_proxy_destroy(impl->registry_proxy, node->obj.id); | ||||||
| 				return -ENOENT; | 				return -ENOENT; | ||||||
|  | @ -1248,7 +1248,7 @@ static void rescan_session(struct impl *impl, struct session *sess) | ||||||
| 		info = node->format; | 		info = node->format; | ||||||
| 
 | 
 | ||||||
| 		props = pw_properties_new_dict(node->info->props); | 		props = pw_properties_new_dict(node->info->props); | ||||||
| 		if ((str = pw_properties_get(props, "device.nick")) == NULL) | 		if ((str = pw_properties_get(props, PW_KEY_DEVICE_NICK)) == NULL) | ||||||
| 			str = node->info->name; | 			str = node->info->name; | ||||||
| 		pw_properties_set(props, "audio-dsp.name", str); | 		pw_properties_set(props, "audio-dsp.name", str); | ||||||
| 		pw_properties_setf(props, "audio-dsp.direction", "%d", sess->direction); | 		pw_properties_setf(props, "audio-dsp.direction", "%d", sess->direction); | ||||||
|  |  | ||||||
|  | @ -344,9 +344,9 @@ int main(int argc, char *argv[]) | ||||||
| 			pw_main_loop_get_loop(data.loop), | 			pw_main_loop_get_loop(data.loop), | ||||||
| 			"video-play", | 			"video-play", | ||||||
| 			pw_properties_new( | 			pw_properties_new( | ||||||
| 				PW_NODE_PROP_MEDIA, "Video", | 				PW_KEY_MEDIA_TYPE, "Video", | ||||||
| 				PW_NODE_PROP_CATEGORY, "Capture", | 				PW_KEY_MEDIA_CATEGORY, "Capture", | ||||||
| 				PW_NODE_PROP_ROLE, "Camera", | 				PW_KEY_MEDIA_ROLE, "Camera", | ||||||
| 				NULL), | 				NULL), | ||||||
| 			&stream_events, | 			&stream_events, | ||||||
| 			&data); | 			&data); | ||||||
|  |  | ||||||
|  | @ -289,7 +289,7 @@ static void on_state_changed(void *_data, enum pw_remote_state old, enum pw_remo | ||||||
| 
 | 
 | ||||||
| 		data->stream = pw_stream_new(remote, "video-src", | 		data->stream = pw_stream_new(remote, "video-src", | ||||||
| 			pw_properties_new( | 			pw_properties_new( | ||||||
| 				"media.class", "Video/Source", | 				PW_KEY_MEDIA_CLASS, "Video/Source", | ||||||
| 				NULL)); | 				NULL)); | ||||||
| 
 | 
 | ||||||
| 		params[0] = spa_pod_builder_add_object(&b, | 		params[0] = spa_pod_builder_add_object(&b, | ||||||
|  |  | ||||||
|  | @ -237,7 +237,7 @@ new_node (GstPipeWireDeviceProvider *self, struct node_data *data) | ||||||
|     spa_dict_for_each (item, info->props) |     spa_dict_for_each (item, info->props) | ||||||
|       gst_structure_set (props, item->key, G_TYPE_STRING, item->value, NULL); |       gst_structure_set (props, item->key, G_TYPE_STRING, item->value, NULL); | ||||||
| 
 | 
 | ||||||
|     klass = spa_dict_lookup (info->props, "media.class"); |     klass = spa_dict_lookup (info->props, PW_KEY_MEDIA_CLASS); | ||||||
|   } |   } | ||||||
|   if (klass == NULL) |   if (klass == NULL) | ||||||
|     klass = "unknown/unknown"; |     klass = "unknown/unknown"; | ||||||
|  |  | ||||||
|  | @ -472,14 +472,14 @@ parse_stream_properties (GstPipeWireSrc *pwsrc, const struct pw_properties *prop | ||||||
|   gboolean is_live; |   gboolean is_live; | ||||||
| 
 | 
 | ||||||
|   GST_OBJECT_LOCK (pwsrc); |   GST_OBJECT_LOCK (pwsrc); | ||||||
|   var = pw_properties_get (props, PW_STREAM_PROP_IS_LIVE); |   var = pw_properties_get (props, PW_KEY_STREAM_IS_LIVE); | ||||||
|   var = "true"; |   var = "true"; | ||||||
|   is_live = pwsrc->is_live = var ? pw_properties_parse_bool(var) : FALSE; |   is_live = pwsrc->is_live = var ? pw_properties_parse_bool(var) : FALSE; | ||||||
| 
 | 
 | ||||||
|   var = pw_properties_get (props, PW_STREAM_PROP_LATENCY_MIN); |   var = pw_properties_get (props, PW_KEY_STREAM_LATENCY_MIN); | ||||||
|   pwsrc->min_latency = var ? (GstClockTime) atoi (var) : 0; |   pwsrc->min_latency = var ? (GstClockTime) atoi (var) : 0; | ||||||
| 
 | 
 | ||||||
|   var = pw_properties_get (props, PW_STREAM_PROP_LATENCY_MAX); |   var = pw_properties_get (props, PW_KEY_STREAM_LATENCY_MAX); | ||||||
|   pwsrc->max_latency = var ? (GstClockTime) atoi (var) : GST_CLOCK_TIME_NONE; |   pwsrc->max_latency = var ? (GstClockTime) atoi (var) : GST_CLOCK_TIME_NONE; | ||||||
|   GST_OBJECT_UNLOCK (pwsrc); |   GST_OBJECT_UNLOCK (pwsrc); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,9 +35,9 @@ | ||||||
| #include <pipewire/pipewire.h> | #include <pipewire/pipewire.h> | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Perform access check" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Perform access check" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct impl { | struct impl { | ||||||
|  | @ -121,7 +121,7 @@ core_check_access(void *data, struct pw_client *client) | ||||||
| 
 | 
 | ||||||
| 	pid = -EINVAL; | 	pid = -EINVAL; | ||||||
| 	if ((props = pw_client_get_properties(client)) != NULL) { | 	if ((props = pw_client_get_properties(client)) != NULL) { | ||||||
| 		if ((str = pw_properties_get(props, PW_CLIENT_PROP_UCRED_PID)) != NULL) | 		if ((str = pw_properties_get(props, PW_KEY_SEC_PID)) != NULL) | ||||||
| 			pid = atoi(str); | 			pid = atoi(str); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -138,7 +138,7 @@ core_check_access(void *data, struct pw_client *client) | ||||||
| 			goto granted; | 			goto granted; | ||||||
| 		if (res > 0) | 		if (res > 0) | ||||||
| 			res = -EACCES; | 			res = -EACCES; | ||||||
| 		items[0] = SPA_DICT_ITEM_INIT("pipewire.access", "blacklisted"); | 		items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "blacklisted"); | ||||||
| 		goto blacklisted; | 		goto blacklisted; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -153,7 +153,7 @@ core_check_access(void *data, struct pw_client *client) | ||||||
| 		else if (res > 0) { | 		else if (res > 0) { | ||||||
| 			pw_log_debug("module %p: restricted client %p added", impl, client); | 			pw_log_debug("module %p: restricted client %p added", impl, client); | ||||||
| 		} | 		} | ||||||
| 		items[0] = SPA_DICT_ITEM_INIT("pipewire.access", "restricted"); | 		items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "restricted"); | ||||||
| 		goto wait_permissions; | 		goto wait_permissions; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -166,7 +166,7 @@ core_check_access(void *data, struct pw_client *client) | ||||||
| 		else if (res > 0) { | 		else if (res > 0) { | ||||||
| 			pw_log_debug("module %p: sandboxed client %p added", impl, client); | 			pw_log_debug("module %p: sandboxed client %p added", impl, client); | ||||||
| 		} | 		} | ||||||
| 		items[0] = SPA_DICT_ITEM_INIT("pipewire.access", "flatpak"); | 		items[0] = SPA_DICT_ITEM_INIT(PW_KEY_ACCESS, "flatpak"); | ||||||
| 		goto wait_permissions; | 		goto wait_permissions; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -40,9 +40,9 @@ | ||||||
| #include "module-audio-dsp/audio-dsp.h" | #include "module-audio-dsp/audio-dsp.h" | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Manage audio DSP nodes" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Manage audio DSP nodes" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct factory_data { | struct factory_data { | ||||||
|  |  | ||||||
|  | @ -187,13 +187,13 @@ static void node_port_init(void *data, struct pw_port *port) | ||||||
| 
 | 
 | ||||||
| 	old = pw_port_get_properties(port); | 	old = pw_port_get_properties(port); | ||||||
| 
 | 
 | ||||||
| 	monitor = (str = pw_properties_get(old, "port.monitor")) != NULL && | 	monitor = (str = pw_properties_get(old, PW_KEY_PORT_MONITOR)) != NULL && | ||||||
| 			atoi(str) != 0; | 			pw_properties_parse_bool(str); | ||||||
| 
 | 
 | ||||||
| 	if (!monitor && direction == n->direction) | 	if (!monitor && direction == n->direction) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	new = pw_properties_new("port.dsp", "32 bit float mono audio", NULL); | 	new = pw_properties_new(PW_KEY_FORMAT_DSP, "32 bit float mono audio", NULL); | ||||||
| 
 | 
 | ||||||
| 	if (monitor) | 	if (monitor) | ||||||
| 		prefix = "monitor"; | 		prefix = "monitor"; | ||||||
|  | @ -202,23 +202,23 @@ static void node_port_init(void *data, struct pw_port *port) | ||||||
| 	else | 	else | ||||||
| 		prefix = "capture"; | 		prefix = "capture"; | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(old, "port.channel")) == NULL || | 	if ((str = pw_properties_get(old, PW_KEY_PORT_CHANNEL)) == NULL || | ||||||
| 	    strcmp(str, "UNK") == 0) { | 	    strcmp(str, "UNK") == 0) { | ||||||
| 		snprintf(position, 7, "%d", port->port_id); | 		snprintf(position, 7, "%d", port->port_id); | ||||||
| 		str = position; | 		str = position; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_properties_setf(new, "port.name", "%s_%s", prefix, str); | 	pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, str); | ||||||
| 
 | 
 | ||||||
| 	if (direction != n->direction) { | 	if (direction != n->direction) { | ||||||
| 		pw_properties_setf(new, "port.alias1", "%s_pcm:%s:%s%s", | 		pw_properties_setf(new, PW_KEY_PORT_ALIAS1, "%s_pcm:%s:%s%s", | ||||||
| 				pw_properties_get(n->props, "device.api"), | 				pw_properties_get(n->props, PW_KEY_DEVICE_API), | ||||||
| 				pw_properties_get(n->props, "audio-dsp.name"), | 				pw_properties_get(n->props, "audio-dsp.name"), | ||||||
| 				direction == PW_DIRECTION_INPUT ? "in" : "out", | 				direction == PW_DIRECTION_INPUT ? "in" : "out", | ||||||
| 				str); | 				str); | ||||||
| 
 | 
 | ||||||
| 		pw_properties_set(new, "port.physical", "1"); | 		pw_properties_set(new, PW_KEY_PORT_PHYSICAL, "1"); | ||||||
| 		pw_properties_set(new, "port.terminal", "1"); | 		pw_properties_set(new, PW_KEY_PORT_TERMINAL, "1"); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_port_update_properties(port, &new->dict); | 	pw_port_update_properties(port, &new->dict); | ||||||
|  | @ -271,8 +271,8 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core, | ||||||
| 
 | 
 | ||||||
| 	pr = pw_properties_copy(props); | 	pr = pw_properties_copy(props); | ||||||
| 
 | 
 | ||||||
| 	if ((api = pw_properties_get(pr, "device.api")) == NULL) { | 	if ((api = pw_properties_get(pr, PW_KEY_DEVICE_API)) == NULL) { | ||||||
| 		pw_log_error("missing device.api property"); | 		pw_log_error("missing "PW_KEY_DEVICE_API" property"); | ||||||
| 		goto error; | 		goto error; | ||||||
| 	} | 	} | ||||||
| 	if ((alias = pw_properties_get(pr, "audio-dsp.name")) == NULL) { | 	if ((alias = pw_properties_get(pr, "audio-dsp.name")) == NULL) { | ||||||
|  | @ -287,14 +287,14 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core, | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pw_properties_set(pr, | 	pw_properties_set(pr, | ||||||
| 			"media.class", | 			PW_KEY_MEDIA_CLASS, | ||||||
| 			direction == PW_DIRECTION_OUTPUT ? | 			direction == PW_DIRECTION_OUTPUT ? | ||||||
| 				"Audio/DSP/Playback" : | 				"Audio/DSP/Playback" : | ||||||
| 				"Audio/DSP/Capture"); | 				"Audio/DSP/Capture"); | ||||||
| 	pw_properties_set(pr, "node.driver", NULL); | 	pw_properties_set(pr, PW_KEY_NODE_DRIVER, NULL); | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(pr, "node.id")) != NULL) | 	if ((str = pw_properties_get(pr, PW_KEY_NODE_ID)) != NULL) | ||||||
| 		pw_properties_set(pr, "node.session", str); | 		pw_properties_set(pr, PW_KEY_NODE_SESSION, str); | ||||||
| 
 | 
 | ||||||
| 	if (direction == PW_DIRECTION_OUTPUT) { | 	if (direction == PW_DIRECTION_OUTPUT) { | ||||||
| 		pw_properties_set(pr, "merger.monitor", "1"); | 		pw_properties_set(pr, "merger.monitor", "1"); | ||||||
|  |  | ||||||
|  | @ -35,9 +35,9 @@ | ||||||
| #include "module-client-node/client-stream.h" | #include "module-client-node/client-stream.h" | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Allow clients to create and control remote nodes" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create and control remote nodes" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct pw_proxy *pw_remote_node_export(struct pw_remote *remote, | struct pw_proxy *pw_remote_node_export(struct pw_remote *remote, | ||||||
|  | @ -76,7 +76,7 @@ static void *create_object(void *_data, | ||||||
| 
 | 
 | ||||||
| 	parent = pw_client_get_global(client); | 	parent = pw_client_get_global(client); | ||||||
| 
 | 
 | ||||||
| 	if (properties && pw_properties_get(properties, "node.stream") != NULL) { | 	if (properties && pw_properties_get(properties, PW_KEY_NODE_STREAM) != NULL) { | ||||||
| 		result = pw_client_stream_new(node_resource, parent, properties); | 		result = pw_client_stream_new(node_resource, parent, properties); | ||||||
| 	} | 	} | ||||||
| 	else { | 	else { | ||||||
|  |  | ||||||
|  | @ -1671,7 +1671,7 @@ struct pw_client_node *pw_client_node_new(struct pw_resource *resource, | ||||||
| 	pw_map_init(&impl->io_map, 64, 64); | 	pw_map_init(&impl->io_map, 64, 64); | ||||||
| 	pw_array_init(&impl->mems, 64); | 	pw_array_init(&impl->mems, 64); | ||||||
| 
 | 
 | ||||||
| 	if ((name = pw_properties_get(properties, "node.name")) == NULL) | 	if ((name = pw_properties_get(properties, PW_KEY_NODE_NAME)) == NULL) | ||||||
| 		name = "client-node"; | 		name = "client-node"; | ||||||
| 
 | 
 | ||||||
| 	this->resource = resource; | 	this->resource = resource; | ||||||
|  |  | ||||||
|  | @ -988,11 +988,12 @@ static void client_node_initialized(void *data) | ||||||
| 			dir); | 			dir); | ||||||
| 
 | 
 | ||||||
| 	props = pw_node_get_properties(impl->client_node->node); | 	props = pw_node_get_properties(impl->client_node->node); | ||||||
| 	if (props != NULL && (str = pw_properties_get(props, PW_NODE_PROP_EXCLUSIVE)) != NULL) | 	if (props != NULL && (str = pw_properties_get(props, PW_KEY_NODE_EXCLUSIVE)) != NULL) | ||||||
| 		exclusive = pw_properties_parse_bool(str); | 		exclusive = pw_properties_parse_bool(str); | ||||||
| 	else | 	else | ||||||
| 		exclusive = false; | 		exclusive = false; | ||||||
| 	if (props != NULL && (str = pw_properties_get(props, "pipewire.monitor")) != NULL) | 
 | ||||||
|  | 	if (props != NULL && (str = pw_properties_get(props, PW_KEY_STREAM_MONITOR)) != NULL) | ||||||
| 		monitor = pw_properties_parse_bool(str); | 		monitor = pw_properties_parse_bool(str); | ||||||
| 	else | 	else | ||||||
| 		monitor = false; | 		monitor = false; | ||||||
|  | @ -1105,7 +1106,7 @@ static void client_node_initialized(void *data) | ||||||
| 
 | 
 | ||||||
| 	snprintf(media_class, sizeof(media_class), "Stream/%s/%s", dir, type); | 	snprintf(media_class, sizeof(media_class), "Stream/%s/%s", dir, type); | ||||||
| 
 | 
 | ||||||
| 	items[0] = SPA_DICT_ITEM_INIT("media.class", media_class); | 	items[0] = SPA_DICT_ITEM_INIT(PW_KEY_MEDIA_CLASS, media_class); | ||||||
| 	pw_node_update_properties(impl->this.node, &SPA_DICT_INIT(items, 1)); | 	pw_node_update_properties(impl->this.node, &SPA_DICT_INIT(items, 1)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1262,7 +1263,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource, | ||||||
| 	pw_log_debug("client-stream %p: new", impl); | 	pw_log_debug("client-stream %p: new", impl); | ||||||
| 
 | 
 | ||||||
| 	props = pw_properties_copy(properties); | 	props = pw_properties_copy(properties); | ||||||
| 	pw_properties_set(props, "node.driver", NULL); | 	pw_properties_set(props, PW_KEY_NODE_DRIVER, NULL); | ||||||
| 
 | 
 | ||||||
| 	impl->client_node = pw_client_node_new( | 	impl->client_node = pw_client_node_new( | ||||||
| 			resource, | 			resource, | ||||||
|  | @ -1280,7 +1281,7 @@ struct pw_client_stream *pw_client_stream_new(struct pw_resource *resource, | ||||||
| 	node_init(&impl->node, NULL, support, n_support); | 	node_init(&impl->node, NULL, support, n_support); | ||||||
| 	impl->node.impl = impl; | 	impl->node.impl = impl; | ||||||
| 
 | 
 | ||||||
| 	if ((name = pw_properties_get(properties, "node.name")) == NULL) | 	if ((name = pw_properties_get(properties, PW_KEY_NODE_NAME)) == NULL) | ||||||
| 		name = "client-stream"; | 		name = "client-stream"; | ||||||
| 
 | 
 | ||||||
| 	this->node = pw_spa_node_new(core, | 	this->node = pw_spa_node_new(core, | ||||||
|  |  | ||||||
|  | @ -33,9 +33,9 @@ | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Allow clients to create links" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Allow clients to create links" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct factory_data { | struct factory_data { | ||||||
|  | @ -153,20 +153,20 @@ static void *create_object(void *_data, | ||||||
| 	if (properties == NULL) | 	if (properties == NULL) | ||||||
| 		goto no_properties; | 		goto no_properties; | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(properties, PW_LINK_OUTPUT_NODE_ID)) == NULL) | 	if ((str = pw_properties_get(properties, PW_KEY_LINK_OUTPUT_NODE)) == NULL) | ||||||
| 		goto no_properties; | 		goto no_properties; | ||||||
| 
 | 
 | ||||||
| 	output_node_id = pw_properties_parse_int(str); | 	output_node_id = pw_properties_parse_int(str); | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(properties, PW_LINK_INPUT_NODE_ID)) == NULL) | 	if ((str = pw_properties_get(properties, PW_KEY_LINK_INPUT_NODE)) == NULL) | ||||||
| 		goto no_properties; | 		goto no_properties; | ||||||
| 
 | 
 | ||||||
| 	input_node_id = pw_properties_parse_int(str); | 	input_node_id = pw_properties_parse_int(str); | ||||||
| 
 | 
 | ||||||
| 	str = pw_properties_get(properties, PW_LINK_OUTPUT_PORT_ID); | 	str = pw_properties_get(properties, PW_KEY_LINK_OUTPUT_PORT); | ||||||
| 	output_port_id = str ? pw_properties_parse_int(str) : -1; | 	output_port_id = str ? pw_properties_parse_int(str) : -1; | ||||||
| 
 | 
 | ||||||
| 	str = pw_properties_get(properties, PW_LINK_INPUT_PORT_ID); | 	str = pw_properties_get(properties, PW_KEY_LINK_INPUT_PORT); | ||||||
| 	input_port_id = str ? pw_properties_parse_int(str) : -1; | 	input_port_id = str ? pw_properties_parse_int(str) : -1; | ||||||
| 
 | 
 | ||||||
| 	global = pw_core_find_global(core, output_node_id); | 	global = pw_core_find_global(core, output_node_id); | ||||||
|  | @ -206,7 +206,7 @@ static void *create_object(void *_data, | ||||||
| 	if (inport == NULL) | 	if (inport == NULL) | ||||||
| 		goto no_input_port; | 		goto no_input_port; | ||||||
| 
 | 
 | ||||||
| 	str = pw_properties_get(properties, "object.linger"); | 	str = pw_properties_get(properties, PW_KEY_OBJECT_LINGER); | ||||||
| 	linger = str ? pw_properties_parse_bool(str) : false; | 	linger = str ? pw_properties_parse_bool(str) : false; | ||||||
| 
 | 
 | ||||||
| 	link = pw_link_new(core, outport, inport, NULL, properties, sizeof(struct link_data)); | 	link = pw_link_new(core, outport, inport, NULL, properties, sizeof(struct link_data)); | ||||||
|  |  | ||||||
|  | @ -371,10 +371,10 @@ handle_create_client_node(PipeWireDaemon1 * interface, | ||||||
| 	pw_log_debug("protocol-dbus %p: create client-node: %s", impl, sender); | 	pw_log_debug("protocol-dbus %p: create client-node: %s", impl, sender); | ||||||
| 	props = pw_properties_from_variant(arg_properties); | 	props = pw_properties_from_variant(arg_properties); | ||||||
| 
 | 
 | ||||||
| 	target_node = pw_properties_get(props, PW_NODE_PROP_TARGET_NODE); | 	target_node = pw_properties_get(props, PW_KEY_NODE_TARGET); | ||||||
| 	if (target_node) { | 	if (target_node) { | ||||||
| 		if (strncmp(target_node, "/org/pipewire/node_", strlen("/org/pipewire/node_")) == 0) { | 		if (strncmp(target_node, "/org/pipewire/node_", strlen("/org/pipewire/node_")) == 0) { | ||||||
| 			pw_properties_setf(props, PW_NODE_PROP_TARGET_NODE, "%s", | 			pw_properties_setf(props, PW_KEY_NODE_TARGET, "%s", | ||||||
| 					   target_node + strlen("/org/pipewire/node_")); | 					   target_node + strlen("/org/pipewire/node_")); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -54,9 +54,9 @@ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Native protocol using unix sockets" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Native protocol using unix sockets" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static bool debug_messages = 0; | static bool debug_messages = 0; | ||||||
|  | @ -256,7 +256,7 @@ static struct pw_client *client_new(struct server *s, int fd) | ||||||
| 	struct pw_properties *props; | 	struct pw_properties *props; | ||||||
| 	char buffer[1024]; | 	char buffer[1024]; | ||||||
| 
 | 
 | ||||||
| 	props = pw_properties_new(PW_CLIENT_PROP_PROTOCOL, "protocol-native", NULL); | 	props = pw_properties_new(PW_KEY_PROTOCOL, "protocol-native", NULL); | ||||||
| 	if (props == NULL) | 	if (props == NULL) | ||||||
| 		goto exit; | 		goto exit; | ||||||
| 
 | 
 | ||||||
|  | @ -264,16 +264,16 @@ static struct pw_client *client_new(struct server *s, int fd) | ||||||
| 	if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) { | 	if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &ucred, &len) < 0) { | ||||||
| 		pw_log_error("no peercred: %m"); | 		pw_log_error("no peercred: %m"); | ||||||
| 	} else { | 	} else { | ||||||
| 		pw_properties_setf(props, PW_CLIENT_PROP_UCRED_PID, "%d", ucred.pid); | 		pw_properties_setf(props, PW_KEY_SEC_PID, "%d", ucred.pid); | ||||||
| 		pw_properties_setf(props, PW_CLIENT_PROP_UCRED_UID, "%d", ucred.uid); | 		pw_properties_setf(props, PW_KEY_SEC_UID, "%d", ucred.uid); | ||||||
| 		pw_properties_setf(props, PW_CLIENT_PROP_UCRED_GID, "%d", ucred.gid); | 		pw_properties_setf(props, PW_KEY_SEC_GID, "%d", ucred.gid); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	len = sizeof(buffer); | 	len = sizeof(buffer); | ||||||
| 	if (getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buffer, &len) < 0) { | 	if (getsockopt(fd, SOL_SOCKET, SO_PEERSEC, buffer, &len) < 0) { | ||||||
| 		pw_log_error("no peersec: %m"); | 		pw_log_error("no peersec: %m"); | ||||||
| 	} else { | 	} else { | ||||||
| 		pw_properties_setf(props, PW_CLIENT_PROP_SEC_LABEL, "%s", buffer); | 		pw_properties_setf(props, PW_KEY_SEC_LABEL, "%s", buffer); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	client = pw_client_new(protocol->core, | 	client = pw_client_new(protocol->core, | ||||||
|  | @ -651,7 +651,7 @@ impl_new_client(struct pw_protocol *protocol, | ||||||
| 	impl->properties = properties ? pw_properties_copy(properties) : NULL; | 	impl->properties = properties ? pw_properties_copy(properties) : NULL; | ||||||
| 
 | 
 | ||||||
| 	if (properties) | 	if (properties) | ||||||
| 		str = pw_properties_get(properties, "remote.intention"); | 		str = pw_properties_get(properties, PW_KEY_REMOTE_INTENTION); | ||||||
| 	if (str == NULL) | 	if (str == NULL) | ||||||
| 		str = "generic"; | 		str = "generic"; | ||||||
| 
 | 
 | ||||||
|  | @ -719,7 +719,7 @@ get_name(const struct pw_properties *properties) | ||||||
| 	const char *name = NULL; | 	const char *name = NULL; | ||||||
| 
 | 
 | ||||||
| 	if (properties) | 	if (properties) | ||||||
| 		name = pw_properties_get(properties, PW_CORE_PROP_NAME); | 		name = pw_properties_get(properties, PW_KEY_CORE_NAME); | ||||||
| 	if (name == NULL) | 	if (name == NULL) | ||||||
| 		name = getenv("PIPEWIRE_CORE"); | 		name = getenv("PIPEWIRE_CORE"); | ||||||
| 	if (name == NULL) | 	if (name == NULL) | ||||||
|  | @ -888,7 +888,7 @@ static int module_init(struct pw_module *module, struct pw_properties *propertie | ||||||
| 
 | 
 | ||||||
| 	val = getenv("PIPEWIRE_DAEMON"); | 	val = getenv("PIPEWIRE_DAEMON"); | ||||||
| 	if (val == NULL) | 	if (val == NULL) | ||||||
| 		val = pw_properties_get(pw_core_get_properties(core), PW_CORE_PROP_DAEMON); | 		val = pw_properties_get(pw_core_get_properties(core), PW_KEY_CORE_DAEMON); | ||||||
| 	if (val && pw_properties_parse_bool(val)) { | 	if (val && pw_properties_parse_bool(val)) { | ||||||
| 		if (impl_add_server(this, core, properties) == NULL) | 		if (impl_add_server(this, core, properties) == NULL) | ||||||
| 			return -errno; | 			return -errno; | ||||||
|  |  | ||||||
|  | @ -42,7 +42,7 @@ get_remote(const struct pw_properties *properties) | ||||||
| 	const char *name = NULL; | 	const char *name = NULL; | ||||||
| 
 | 
 | ||||||
| 	if (properties) | 	if (properties) | ||||||
| 		name = pw_properties_get(properties, PW_REMOTE_PROP_REMOTE_NAME); | 		name = pw_properties_get(properties, PW_KEY_REMOTE_NAME); | ||||||
| 	if (name == NULL) | 	if (name == NULL) | ||||||
| 		name = getenv("PIPEWIRE_REMOTE"); | 		name = getenv("PIPEWIRE_REMOTE"); | ||||||
| 	if (name == NULL) | 	if (name == NULL) | ||||||
|  |  | ||||||
|  | @ -42,9 +42,9 @@ | ||||||
| #include <pipewire/pipewire.h> | #include <pipewire/pipewire.h> | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Use RTKit to raise thread priorities" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Use RTKit to raise thread priorities" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct impl { | struct impl { | ||||||
|  |  | ||||||
|  | @ -33,14 +33,15 @@ | ||||||
| #include <pipewire/log.h> | #include <pipewire/log.h> | ||||||
| #include <pipewire/module.h> | #include <pipewire/module.h> | ||||||
| #include <pipewire/utils.h> | #include <pipewire/utils.h> | ||||||
|  | #include <pipewire/keys.h> | ||||||
| 
 | 
 | ||||||
| #include "spa-monitor.h" | #include "spa-monitor.h" | ||||||
| #include "spa-device.h" | #include "spa-device.h" | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Load and manage an SPA device" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Load and manage an SPA device" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct device_data { | struct device_data { | ||||||
|  |  | ||||||
|  | @ -35,13 +35,14 @@ | ||||||
| #include <pipewire/log.h> | #include <pipewire/log.h> | ||||||
| #include <pipewire/core.h> | #include <pipewire/core.h> | ||||||
| #include <pipewire/module.h> | #include <pipewire/module.h> | ||||||
|  | #include <pipewire/keys.h> | ||||||
| 
 | 
 | ||||||
| #include "spa-monitor.h" | #include "spa-monitor.h" | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Manage SPA monitors" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Manage SPA monitors" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct data { | struct data { | ||||||
|  |  | ||||||
|  | @ -34,9 +34,9 @@ | ||||||
| #include "spa-node.h" | #include "spa-node.h" | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Provide a factory to make SPA nodes" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Provide a factory to make SPA nodes" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct factory_data { | struct factory_data { | ||||||
|  |  | ||||||
|  | @ -32,6 +32,7 @@ | ||||||
| #include <limits.h> | #include <limits.h> | ||||||
| 
 | 
 | ||||||
| #include <pipewire/core.h> | #include <pipewire/core.h> | ||||||
|  | #include <pipewire/keys.h> | ||||||
| #include <pipewire/log.h> | #include <pipewire/log.h> | ||||||
| #include <pipewire/module.h> | #include <pipewire/module.h> | ||||||
| #include <pipewire/utils.h> | #include <pipewire/utils.h> | ||||||
|  | @ -40,9 +41,9 @@ | ||||||
| #include "spa-node.h" | #include "spa-node.h" | ||||||
| 
 | 
 | ||||||
| static const struct spa_dict_item module_props[] = { | static const struct spa_dict_item module_props[] = { | ||||||
| 	{ PW_MODULE_PROP_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | 	{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" }, | ||||||
| 	{ PW_MODULE_PROP_DESCRIPTION, "Load and manage an SPA node" }, | 	{ PW_KEY_MODULE_DESCRIPTION, "Load and manage an SPA node" }, | ||||||
| 	{ PW_MODULE_PROP_VERSION, PACKAGE_VERSION }, | 	{ PW_KEY_MODULE_VERSION, PACKAGE_VERSION }, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct node_data { | struct node_data { | ||||||
|  |  | ||||||
|  | @ -42,6 +42,7 @@ | ||||||
| #include <pipewire/type.h> | #include <pipewire/type.h> | ||||||
| #include <pipewire/node.h> | #include <pipewire/node.h> | ||||||
| #include <pipewire/device.h> | #include <pipewire/device.h> | ||||||
|  | #include <pipewire/keys.h> | ||||||
| 
 | 
 | ||||||
| #include "spa-monitor.h" | #include "spa-monitor.h" | ||||||
| #include "spa-device.h" | #include "spa-device.h" | ||||||
|  | @ -117,11 +118,11 @@ static struct monitor_item *add_item(struct pw_spa_monitor *this, | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(props, "device.form_factor")) != NULL) | 	if ((str = pw_properties_get(props, PW_KEY_DEVICE_FORM_FACTOR)) != NULL) | ||||||
| 		if (strcmp(str, "internal") == 0) | 		if (strcmp(str, "internal") == 0) | ||||||
| 			now = 0; | 			now = 0; | ||||||
| 	if (now != 0 && pw_properties_get(props, "device.plugged") == NULL) | 	if (now != 0 && pw_properties_get(props, PW_KEY_DEVICE_PLUGGED) == NULL) | ||||||
| 		pw_properties_setf(props, "device.plugged", "%"PRIu64, now); | 		pw_properties_setf(props, PW_KEY_DEVICE_PLUGGED, "%"PRIu64, now); | ||||||
| 
 | 
 | ||||||
| 	support = pw_core_get_support(impl->core, &n_support); | 	support = pw_core_get_support(impl->core, &n_support); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -110,14 +110,6 @@ struct pw_client_events { | ||||||
| 	void (*busy_changed) (void *data, bool busy); | 	void (*busy_changed) (void *data, bool busy); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** The name of the protocol used by the client, set by the protocol */ |  | ||||||
| #define PW_CLIENT_PROP_PROTOCOL		"pipewire.protocol" |  | ||||||
| 
 |  | ||||||
| #define PW_CLIENT_PROP_UCRED_PID	"pipewire.ucred.pid"	/**< Client pid, set by protocol */ |  | ||||||
| #define PW_CLIENT_PROP_UCRED_UID	"pipewire.ucred.uid"	/**< Client uid, set by protocol*/ |  | ||||||
| #define PW_CLIENT_PROP_UCRED_GID	"pipewire.ucred.gid"	/**< client gid, set by protocol*/ |  | ||||||
| #define PW_CLIENT_PROP_SEC_LABEL	"pipewire.sec.label"	/**< client security label, set by protocol*/ |  | ||||||
| 
 |  | ||||||
| /** Create a new client. This is mainly used by protocols. */ | /** Create a new client. This is mainly used by protocols. */ | ||||||
| struct pw_client * | struct pw_client * | ||||||
| pw_client_new(struct pw_core *core,		/**< the core object */ | pw_client_new(struct pw_core *core,		/**< the core object */ | ||||||
|  |  | ||||||
|  | @ -497,11 +497,11 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, | ||||||
| 	spa_list_init(&this->driver_list); | 	spa_list_init(&this->driver_list); | ||||||
| 	spa_hook_list_init(&this->listener_list); | 	spa_hook_list_init(&this->listener_list); | ||||||
| 
 | 
 | ||||||
| 	if ((name = pw_properties_get(properties, PW_CORE_PROP_NAME)) == NULL) { | 	if ((name = pw_properties_get(properties, PW_KEY_CORE_NAME)) == NULL) { | ||||||
| 		pw_properties_setf(properties, | 		pw_properties_setf(properties, | ||||||
| 				   PW_CORE_PROP_NAME, "pipewire-%s-%d", | 				   PW_KEY_CORE_NAME, "pipewire-%s-%d", | ||||||
| 				   pw_get_user_name(), getpid()); | 				   pw_get_user_name(), getpid()); | ||||||
| 		name = pw_properties_get(properties, PW_CORE_PROP_NAME); | 		name = pw_properties_get(properties, PW_KEY_CORE_NAME); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	this->info.change_mask = 0; | 	this->info.change_mask = 0; | ||||||
|  | @ -519,10 +519,10 @@ struct pw_core *pw_core_new(struct pw_loop *main_loop, | ||||||
| 				     PW_TYPE_INTERFACE_Core, | 				     PW_TYPE_INTERFACE_Core, | ||||||
| 				     PW_VERSION_CORE_PROXY, | 				     PW_VERSION_CORE_PROXY, | ||||||
| 				     pw_properties_new( | 				     pw_properties_new( | ||||||
| 					     PW_CORE_PROP_USER_NAME, this->info.user_name, | 					     PW_KEY_USER_NAME, this->info.user_name, | ||||||
| 					     PW_CORE_PROP_HOST_NAME, this->info.host_name, | 					     PW_KEY_HOST_NAME, this->info.host_name, | ||||||
| 					     PW_CORE_PROP_NAME, this->info.name, | 					     PW_KEY_CORE_NAME, this->info.name, | ||||||
| 					     PW_CORE_PROP_VERSION, this->info.version, | 					     PW_KEY_CORE_VERSION, this->info.version, | ||||||
| 					     NULL), | 					     NULL), | ||||||
| 				     global_bind, | 				     global_bind, | ||||||
| 				     this); | 				     this); | ||||||
|  |  | ||||||
|  | @ -95,17 +95,6 @@ struct pw_core_events { | ||||||
| 	void (*global_removed) (void *data, struct pw_global *global); | 	void (*global_removed) (void *data, struct pw_global *global); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** The user name that started the core */ |  | ||||||
| #define PW_CORE_PROP_USER_NAME	"pipewire.core.user-name" |  | ||||||
| /** The host name of the machine */ |  | ||||||
| #define PW_CORE_PROP_HOST_NAME	"pipewire.core.host-name" |  | ||||||
| /** The name of the core. Default is pipewire-<user-name>-<pid> */ |  | ||||||
| #define PW_CORE_PROP_NAME	"pipewire.core.name" |  | ||||||
| /** The version of the core. */ |  | ||||||
| #define PW_CORE_PROP_VERSION	"pipewire.core.version" |  | ||||||
| /** If the core should listen for connections, boolean default false */ |  | ||||||
| #define PW_CORE_PROP_DAEMON	"pipewire.daemon" |  | ||||||
| 
 |  | ||||||
| /** Make a new core object for a given main_loop. Ownership of the properties is taken */ | /** Make a new core object for a given main_loop. Ownership of the properties is taken */ | ||||||
| struct pw_core * pw_core_new(struct pw_loop *main_loop,		/**< a main loop to run in */ | struct pw_core * pw_core_new(struct pw_loop *main_loop,		/**< a main loop to run in */ | ||||||
| 			     struct pw_properties *props,	/**< extra properties */ | 			     struct pw_properties *props,	/**< extra properties */ | ||||||
|  |  | ||||||
|  | @ -31,6 +31,7 @@ | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| #include "pipewire/interfaces.h" | #include "pipewire/interfaces.h" | ||||||
| #include "pipewire/type.h" | #include "pipewire/type.h" | ||||||
|  | #include "pipewire/keys.h" | ||||||
| 
 | 
 | ||||||
| struct impl { | struct impl { | ||||||
| 	struct pw_device this; | 	struct pw_device this; | ||||||
|  | @ -287,9 +288,9 @@ int pw_device_register(struct pw_device *device, | ||||||
| 	if (properties == NULL) | 	if (properties == NULL) | ||||||
| 		return -ENOMEM; | 		return -ENOMEM; | ||||||
| 
 | 
 | ||||||
| 	pw_properties_set(properties, "device.name", device->info.name); | 	pw_properties_set(properties, PW_KEY_DEVICE_NAME, device->info.name); | ||||||
| 	if ((str = pw_properties_get(device->properties, "media.class")) != NULL) | 	if ((str = pw_properties_get(device->properties, PW_KEY_MEDIA_CLASS)) != NULL) | ||||||
| 		pw_properties_set(properties, "media.class", str); | 		pw_properties_set(properties, PW_KEY_MEDIA_CLASS, str); | ||||||
| 
 | 
 | ||||||
| 	spa_list_append(&core->device_list, &device->link); | 	spa_list_append(&core->device_list, &device->link); | ||||||
| 	device->registered = true; | 	device->registered = true; | ||||||
|  |  | ||||||
|  | @ -30,6 +30,7 @@ | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| #include "pipewire/type.h" | #include "pipewire/type.h" | ||||||
| #include "pipewire/interfaces.h" | #include "pipewire/interfaces.h" | ||||||
|  | #include "pipewire/keys.h" | ||||||
| 
 | 
 | ||||||
| #define pw_factory_resource_info(r,...) pw_resource_notify(r,struct pw_factory_proxy_events,info,0,__VA_ARGS__) | #define pw_factory_resource_info(r,...) pw_resource_notify(r,struct pw_factory_proxy_events,info,0,__VA_ARGS__) | ||||||
| 
 | 
 | ||||||
|  | @ -156,10 +157,10 @@ int pw_factory_register(struct pw_factory *factory, | ||||||
| 	if (properties == NULL) | 	if (properties == NULL) | ||||||
| 		return -ENOMEM; | 		return -ENOMEM; | ||||||
| 
 | 
 | ||||||
| 	pw_properties_set(properties, "factory.name", factory->info.name); | 	pw_properties_set(properties, PW_KEY_FACTORY_NAME, factory->info.name); | ||||||
| 	pw_properties_setf(properties, "factory.type.name", "%s", | 	pw_properties_setf(properties, PW_KEY_FACTORY_TYPE_NAME, "%s", | ||||||
| 			spa_debug_type_find_name(pw_type_info(), factory->info.type)); | 			spa_debug_type_find_name(pw_type_info(), factory->info.type)); | ||||||
| 	pw_properties_setf(properties, "factory.type.version", "%d", factory->info.version); | 	pw_properties_setf(properties, PW_KEY_FACTORY_TYPE_VERSION, "%d", factory->info.version); | ||||||
| 
 | 
 | ||||||
| 	spa_list_append(&core->factory_list, &factory->link); | 	spa_list_append(&core->factory_list, &factory->link); | ||||||
| 	factory->registered = true; | 	factory->registered = true; | ||||||
|  |  | ||||||
|  | @ -163,11 +163,6 @@ struct pw_core_proxy_events { | ||||||
| #define PW_CORE_PROXY_METHOD_DESTROY		7 | #define PW_CORE_PROXY_METHOD_DESTROY		7 | ||||||
| #define PW_CORE_PROXY_METHOD_NUM		8 | #define PW_CORE_PROXY_METHOD_NUM		8 | ||||||
| 
 | 
 | ||||||
| #define PW_LINK_OUTPUT_NODE_ID	"link.output_node.id" |  | ||||||
| #define PW_LINK_OUTPUT_PORT_ID	"link.output_port.id" |  | ||||||
| #define PW_LINK_INPUT_NODE_ID	"link.input_node.id" |  | ||||||
| #define PW_LINK_INPUT_PORT_ID	"link.input_port.id" |  | ||||||
| 
 |  | ||||||
| /**
 | /**
 | ||||||
|  * \struct pw_core_proxy_methods |  * \struct pw_core_proxy_methods | ||||||
|  * \brief Core methods |  * \brief Core methods | ||||||
|  |  | ||||||
							
								
								
									
										238
									
								
								src/pipewire/keys.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										238
									
								
								src/pipewire/keys.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,238 @@ | ||||||
|  | /* PipeWire
 | ||||||
|  |  * | ||||||
|  |  * Copyright © 2019 Wim Taymans | ||||||
|  |  * | ||||||
|  |  * Permission is hereby granted, free of charge, to any person obtaining a | ||||||
|  |  * copy of this software and associated documentation files (the "Software"), | ||||||
|  |  * to deal in the Software without restriction, including without limitation | ||||||
|  |  * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||
|  |  * and/or sell copies of the Software, and to permit persons to whom the | ||||||
|  |  * Software is furnished to do so, subject to the following conditions: | ||||||
|  |  * | ||||||
|  |  * The above copyright notice and this permission notice (including the next | ||||||
|  |  * paragraph) shall be included in all copies or substantial portions of the | ||||||
|  |  * Software. | ||||||
|  |  * | ||||||
|  |  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||||
|  |  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||
|  |  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL | ||||||
|  |  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||
|  |  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||||
|  |  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||||
|  |  * DEALINGS IN THE SOFTWARE. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef PIPEWIRE_KEYS_H | ||||||
|  | #define PIPEWIRE_KEYS_H | ||||||
|  | 
 | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" { | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * A collection of keys that are used to add extra information on objects. | ||||||
|  |  * | ||||||
|  |  * Keys that start with "pipewire." are in general set-once and then | ||||||
|  |  * read-only. They are usually used for security sensitive information that | ||||||
|  |  * needs to be fixed. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* Peroperties usually set on the core object */ | ||||||
|  | #define PW_KEY_USER_NAME		"pipewire.user-name"	/**< The user name that runs pipewire */ | ||||||
|  | #define PW_KEY_HOST_NAME		"pipewire.host-name"	/**< The host name of the machine */ | ||||||
|  | #define PW_KEY_CORE_NAME		"pipewire.core.name"	/**< The name of the core. Default is | ||||||
|  | 								  *  pipewire-<user-name>-<pid> */ | ||||||
|  | #define PW_KEY_CORE_VERSION		"pipewire.core.version"	/**< The version of the core. */ | ||||||
|  | #define PW_KEY_CORE_DAEMON		"pipewire.core.daemon"	/**< If the core is listening for connections. */ | ||||||
|  | 
 | ||||||
|  | /** The protocol key is usually set on a pw_client and contains a
 | ||||||
|  |  * string describing the protocol used by the client to access | ||||||
|  |  * PipeWire */ | ||||||
|  | #define PW_KEY_PROTOCOL			"pipewire.protocol" | ||||||
|  | #define PW_KEY_ACCESS			"pipewire.access"	/**< how the client access is controlled */ | ||||||
|  | 
 | ||||||
|  | /** Various keys related to the identity of a client process and its security.
 | ||||||
|  |  * Must be obtained from trusted sources by the protocol and placed as | ||||||
|  |  * read-only properties. */ | ||||||
|  | #define PW_KEY_SEC_PID			"pipewire.sec.pid"	/**< Client pid, set by protocol */ | ||||||
|  | #define PW_KEY_SEC_UID			"pipewire.sec.uid"	/**< Client uid, set by protocol*/ | ||||||
|  | #define PW_KEY_SEC_GID			"pipewire.sec.gid"	/**< client gid, set by protocol*/ | ||||||
|  | #define PW_KEY_SEC_LABEL		"pipewire.sec.label"	/**< client security label, set by protocol*/ | ||||||
|  | 
 | ||||||
|  | /* remote keys */ | ||||||
|  | #define PW_KEY_REMOTE_NAME		"remote.name"		/**< The name of the remote to connect to, | ||||||
|  | 								  *  default env(PIPEWIRE_REMOTE) or pipewire-0 */ | ||||||
|  | #define PW_KEY_REMOTE_INTENTION		"remote.intention"	/**< The intention of the remote connection, | ||||||
|  | 								  *  "generic", "screencast" */ | ||||||
|  | 
 | ||||||
|  | /** application keys */ | ||||||
|  | #define PW_KEY_APP_NAME			"application.name"	/**< application name. Ex: "Totem Music Player" */ | ||||||
|  | #define PW_KEY_APP_ID			"application.id"	/**< a textual id for identifying an | ||||||
|  | 								  *  application logically. Ex: "org.gnome.Totem" */ | ||||||
|  | #define PW_KEY_APP_VERSION		"application.version" | ||||||
|  | #define PW_KEY_APP_ICON			"application.icon"	/**< aa base64 blob with PNG image data */ | ||||||
|  | #define PW_KEY_APP_ICON_NAME		"application.icon-name"	/**< an XDG icon name for the application. | ||||||
|  | 								  *  Ex: "totem" */ | ||||||
|  | #define PW_KEY_APP_LANGUAGE		"application.language"	/**< application language if applicable, in | ||||||
|  | 								  *  standard POSIX format. Ex: "en_GB" */ | ||||||
|  | 
 | ||||||
|  | #define PW_KEY_APP_PROCESS_ID		"application.process.id"	/**< process id  (pid)*/ | ||||||
|  | #define PW_KEY_APP_PROCESS_BINARY	"application.process.binary"	/**< binary name */ | ||||||
|  | #define PW_KEY_APP_PROCESS_USER		"application.process.user"	/**< user name */ | ||||||
|  | #define PW_KEY_APP_PROCESS_HOST		"application.process.host"	/**< host name */ | ||||||
|  | #define PW_KEY_APP_PROCESS_MACHINE_ID	"application.process.machine-id" /**< the D-Bus host id the | ||||||
|  | 									   *  application runs on */ | ||||||
|  | #define PW_KEY_APP_PROCESS_SESSION_ID	"application.process.session-id" /**< login session of the | ||||||
|  | 									   *  application, on Unix the | ||||||
|  | 									   *  value of $XDG_SESSION_ID. */ | ||||||
|  | /** window system */ | ||||||
|  | #define PW_KEY_WINDOW_X11_DISPLAY	"window.x11.display"	/**< the X11 display string. Ex. ":0.0" */ | ||||||
|  | 
 | ||||||
|  | /** Client properties */ | ||||||
|  | #define PW_KEY_CLIENT_NAME		"client.name"		/**< the client name */ | ||||||
|  | #define PW_KEY_CLIENT_API		"client.api"		/**< the client api used to access | ||||||
|  | 								  *  PipeWire */ | ||||||
|  | 
 | ||||||
|  | /** Node keys */ | ||||||
|  | #define PW_KEY_NODE_ID			"node.id"		/**< node id */ | ||||||
|  | #define PW_KEY_NODE_NAME		"node.name"		/**< node name */ | ||||||
|  | #define PW_KEY_NODE_PLUGGED		"node.plugged"		/**< when the node was created. As a uint64 in | ||||||
|  | 								  *  nanoseconds. */ | ||||||
|  | #define PW_KEY_NODE_SESSION		"node.session"		/**< the session id this node is part of */ | ||||||
|  | #define PW_KEY_NODE_EXCLUSIVE		"node.exclusive"	/**< node wants exclusive access to resources */ | ||||||
|  | #define PW_KEY_NODE_AUTOCONNECT		"node.autoconnect"	/**< node wants to be automatically connected | ||||||
|  | 								  *  to a compatible node */ | ||||||
|  | #define PW_KEY_NODE_TARGET		"node.target"		/**< node want to be connected to the target | ||||||
|  | 								  *  node/session */ | ||||||
|  | #define PW_KEY_NODE_LATENCY		"node.latency"		/**< the requested latency of the node as | ||||||
|  | 								  *  a fraction. Ex: 128/48000 */ | ||||||
|  | #define PW_KEY_NODE_DONT_RECONNECT	"node.dont-reconnect"	/**< don't reconnect this node */ | ||||||
|  | #define PW_KEY_NODE_PAUSE_ON_IDLE	"node.pause-on-idle"	/**< pause the node when idle */ | ||||||
|  | #define PW_KEY_NODE_DRIVER		"node.driver"		/**< node can drive the graph */ | ||||||
|  | #define PW_KEY_NODE_STREAM		"node.stream"		/**< node is a stream, the server side should | ||||||
|  | 								  *  add a converter */ | ||||||
|  | /** Port keys */ | ||||||
|  | #define PW_KEY_PORT_ID			"port.id"		/**< port id */ | ||||||
|  | #define PW_KEY_PORT_NAME		"port.name"		/**< port name */ | ||||||
|  | #define PW_KEY_PORT_DIRECTION		"port.direction"	/**< the port direction, one of "in" or "out" | ||||||
|  | 								  *  or "control" and "notify" for control ports */ | ||||||
|  | #define PW_KEY_PORT_CHANNEL		"port.channel"		/**< port channel */ | ||||||
|  | #define PW_KEY_PORT_ALIAS1		"port.alias1"		/**< port alias1 */ | ||||||
|  | #define PW_KEY_PORT_ALIAS2		"port.alias2"		/**< port alias2 */ | ||||||
|  | #define PW_KEY_PORT_PHYSICAL		"port.physical"		/**< if this is a physical port */ | ||||||
|  | #define PW_KEY_PORT_TERMINAL		"port.terminal"		/**< if this port consumes the data */ | ||||||
|  | #define PW_KEY_PORT_CONTROL		"port.control"		/**< if this port is a control port */ | ||||||
|  | #define PW_KEY_PORT_MONITOR		"port.monitor"		/**< if this port is a monitor port */ | ||||||
|  | 
 | ||||||
|  | /** link properties */ | ||||||
|  | #define PW_KEY_LINK_INPUT_NODE		"link.input.node"	/**< input node id of a link */ | ||||||
|  | #define PW_KEY_LINK_INPUT_PORT		"link.input.port"	/**< input port id of a link */ | ||||||
|  | #define PW_KEY_LINK_OUTPUT_NODE		"link.output.node"	/**< output node id of a link */ | ||||||
|  | #define PW_KEY_LINK_OUTPUT_PORT		"link.output.port"	/**< output port id of a link */ | ||||||
|  | #define PW_KEY_LINK_PASSIVE		"link.passive"		/**< indicate that a link is passive and | ||||||
|  | 								  *  does not cause the graph to be | ||||||
|  | 								  *  runnable. */ | ||||||
|  | /** device properties */ | ||||||
|  | #define PW_KEY_DEVICE_NAME		"device.name"		/**< device name */ | ||||||
|  | #define PW_KEY_DEVICE_PLUGGED		"device.plugged"	/**< when the device was created. As a uint64 in | ||||||
|  | 								  *  nanoseconds. */ | ||||||
|  | #define PW_KEY_DEVICE_NICK		"device.nick"		/**< a short device nickname */ | ||||||
|  | #define PW_KEY_DEVICE_STRING		"device.string"		/**< device string in the underlying layer's | ||||||
|  | 								  *  format. Ex. "surround51:0" */ | ||||||
|  | #define PW_KEY_DEVICE_API		"device.api"		/**< API this device is accessed with. | ||||||
|  | 								  *  Ex. "alsa", "v4l2" */ | ||||||
|  | #define PW_KEY_DEVICE_DESCRIPTION	"device.description"	/**< localized human readable device one-line | ||||||
|  | 								  *  description. Ex. "Foobar USB Headset" */ | ||||||
|  | #define PW_KEY_DEVICE_BUS_PATH		"device.bus-path"	/**< bus path to the device in the OS' | ||||||
|  | 								  *  format. Ex. "pci-0000:00:14.0-usb-0:3.2:1.0" */ | ||||||
|  | #define PW_KEY_DEVICE_SERIAL		"device.serial"		/**< Serial number if applicable */ | ||||||
|  | #define PW_KEY_DEVICE_VENDOR_ID		"device.vendor.id"	/**< vendor ID if applicable */ | ||||||
|  | #define PW_KEY_DEVICE_VENDOR_NAME	"device.vendor.name"	/**< vendor name if applicable */ | ||||||
|  | #define PW_KEY_DEVICE_PRODUCT_ID	"device.product.id"	/**< product ID if applicable */ | ||||||
|  | #define PW_KEY_DEVICE_PRODUCT_NAME	"device.product.name"	/**< product name if applicable */ | ||||||
|  | #define PW_KEY_DEVICE_CLASS		"device.class"		/**< device class */ | ||||||
|  | #define PW_KEY_DEVICE_FORM_FACTOR	"device.form-factor"	/**< form factor if applicable. One of | ||||||
|  | 								  *  "internal", "speaker", "handset", "tv", | ||||||
|  | 								  *  "webcam", "microphone", "headset", | ||||||
|  | 								  *  "headphone", "hands-free", "car", "hifi", | ||||||
|  | 								  *  "computer", "portable" */ | ||||||
|  | #define PW_KEY_DEVICE_BUS		"device.bus"		/**< bus of the device if applicable. One of | ||||||
|  | 								  *  "isa", "pci", "usb", "firewire", | ||||||
|  | 								  *  "bluetooth" */ | ||||||
|  | #define PW_KEY_DEVICE_ICON		"device.icon"		/**< icon for the device. A base64 blob | ||||||
|  | 								  *  containing PNG image data */ | ||||||
|  | #define PW_KEY_DEVICE_ICON_NAME		"device.icon-name"	/**< an XDG icon name for the device. | ||||||
|  | 								  *  Ex. "sound-card-speakers-usb" */ | ||||||
|  | #define PW_KEY_DEVICE_INTENDED_ROLES	"device.intended-roles"	/**< intended use. A space separated list of | ||||||
|  | 								  *  roles (see PW_KEY_MEDIA_ROLE) this device | ||||||
|  | 								  *  is particularly well suited for, due to | ||||||
|  | 								  *  latency, quality or form factor. */ | ||||||
|  | 
 | ||||||
|  | /** module properties */ | ||||||
|  | #define PW_KEY_MODULE_NAME		"module.name"		/**< the name of the module */ | ||||||
|  | #define PW_KEY_MODULE_AUTHOR		"module.author"		/**< the author's name */ | ||||||
|  | #define PW_KEY_MODULE_DESCRIPTION	"module.description"	/**< a human readable one-line description | ||||||
|  | 								  *  of the module's purpose.*/ | ||||||
|  | #define PW_KEY_MODULE_USAGE		"module.usage"		/**< a human readable usage description of | ||||||
|  | 								  *  the module's arguments. */ | ||||||
|  | #define PW_KEY_MODULE_VERSION		"module.version"	/**< a version string for the module. */ | ||||||
|  | 
 | ||||||
|  | /** Factory properties */ | ||||||
|  | #define PW_KEY_FACTORY_NAME		"factory.name"		/**< the name of the factory */ | ||||||
|  | #define PW_KEY_FACTORY_TYPE_NAME	"factory.type.name"	/**< the name of the type created by a factory */ | ||||||
|  | #define PW_KEY_FACTORY_TYPE_VERSION	"factory.type.version"	/**< the version of the type created by a factory */ | ||||||
|  | 
 | ||||||
|  | /** Stream properties */ | ||||||
|  | #define PW_KEY_STREAM_IS_LIVE		"stream.is-live"	/**< Indicates that the stream is live. */ | ||||||
|  | #define PW_KEY_STREAM_LATENCY_MIN	"stream.latency.min"	/**< The minimum latency of the stream. */ | ||||||
|  | #define PW_KEY_STREAM_LATENCY_MAX	"stream.latency.max"	/**< The maximum latency of the stream */ | ||||||
|  | #define PW_KEY_STREAM_MONITOR		"stream.monitor"	/**< Indicates that the stream is monitoring | ||||||
|  | 								  *  and might select a less accurate but faster | ||||||
|  | 								  *  conversion algorithm. */ | ||||||
|  | 
 | ||||||
|  | /** object properties */ | ||||||
|  | #define PW_KEY_OBJECT_LINGER		"object.linger"		/**< the object lives on even after the client | ||||||
|  | 								  *  that created it has been destroyed */ | ||||||
|  | 
 | ||||||
|  | /** Media */ | ||||||
|  | #define PW_KEY_MEDIA_TYPE		"media.type"		/**< Media type, one of | ||||||
|  | 								  *  Audio, Video, Midi */ | ||||||
|  | #define PW_KEY_MEDIA_CATEGORY		"media.category"	/**< Media Category: | ||||||
|  | 								  *  Playback, Capture, Duplex, Monitor */ | ||||||
|  | #define PW_KEY_MEDIA_ROLE		"media.role"		/**< Role: Movie, Music, Camera, | ||||||
|  | 								  *  Screen, Communication, Game, | ||||||
|  | 								  *  Notification, DSP, Production, | ||||||
|  | 								  *  Accessibility, Test */ | ||||||
|  | #define PW_KEY_MEDIA_CLASS		"media.class"		/**< class Ex: "Video/Source" */ | ||||||
|  | #define PW_KEY_MEDIA_NAME		"media.name"		/**< media name. Ex: "Pink Floyd: Time" */ | ||||||
|  | #define PW_KEY_MEDIA_TITLE		"media.title"		/**< title. Ex: "Time" */ | ||||||
|  | #define PW_KEY_MEDIA_ARTIST		"media.artist"		/**< artist. Ex: "Pink Floyd" */ | ||||||
|  | #define PW_KEY_MEDIA_COPYRIGHT		"media.copyright"	/**< copyright string */ | ||||||
|  | #define PW_KEY_MEDIA_SOFTWARE		"media.software"	/**< generator software */ | ||||||
|  | #define PW_KEY_MEDIA_LANGUAGE		"media.language"	/**< language in POSIX format. Ex: en_GB */ | ||||||
|  | #define PW_KEY_MEDIA_FILENAME		"media.filename"	/**< filename */ | ||||||
|  | #define PW_KEY_MEDIA_ICON		"media.icon"		/**< icon for the media, a base64 blob with | ||||||
|  | 								  *  PNG image data */ | ||||||
|  | #define PW_KEY_MEDIA_ICON_NAME		"media.icon-name"	/**< an XDG icon name for the media. | ||||||
|  | 								  *  Ex: "audio-x-mp3" */ | ||||||
|  | 
 | ||||||
|  | /** format related properties */ | ||||||
|  | #define PW_KEY_FORMAT_DSP		"format.dsp"		/**< a dsp format. | ||||||
|  | 								  *  Ex: "32 bit float mono audio" */ | ||||||
|  | /** audio related properties */ | ||||||
|  | #define PW_KEY_AUDIO_CHANNEL		"audio.channel"		/**< an audio channel. Ex: "FL" */ | ||||||
|  | #define PW_KEY_AUDIO_RATE		"audio.samplerate"	/**< an audio samplerate */ | ||||||
|  | #define PW_KEY_AUDIO_CHANNELS		"audio.channels"	/**< number of audio channels */ | ||||||
|  | #define PW_KEY_AUDIO_FORMAT		"audio.format"		/**< an audio format. Ex: "S16LE" */ | ||||||
|  | 
 | ||||||
|  | /** video related properties */ | ||||||
|  | #define PW_KEY_VIDEO_RATE		"video.framerate"	/**< a video framerate */ | ||||||
|  | #define PW_KEY_VIDEO_FORMAT		"video.format"		/**< a video format */ | ||||||
|  | #define PW_KEY_VIDEO_SIZE		"video.size"		/**< a video size as "<width>x<height" */ | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | #ifdef __cplusplus | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #endif /* PIPEWIRE_KEYS_H */ | ||||||
|  | @ -33,6 +33,7 @@ | ||||||
| #include <spa/param/param.h> | #include <spa/param/param.h> | ||||||
| #include <spa/buffer/alloc.h> | #include <spa/buffer/alloc.h> | ||||||
| 
 | 
 | ||||||
|  | #include "pipewire/keys.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| #include "pipewire/interfaces.h" | #include "pipewire/interfaces.h" | ||||||
| #include "pipewire/control.h" | #include "pipewire/control.h" | ||||||
|  | @ -1289,7 +1290,7 @@ struct pw_link *pw_link_new(struct pw_core *core, | ||||||
| 	this->output = output; | 	this->output = output; | ||||||
| 
 | 
 | ||||||
| 	if (properties) { | 	if (properties) { | ||||||
| 		const char *str = pw_properties_get(properties, PW_LINK_PROP_PASSIVE); | 		const char *str = pw_properties_get(properties, PW_KEY_LINK_PASSIVE); | ||||||
| 		if (str && pw_properties_parse_bool(str)) | 		if (str && pw_properties_parse_bool(str)) | ||||||
| 			impl->passive = true; | 			impl->passive = true; | ||||||
| 	} | 	} | ||||||
|  | @ -1414,8 +1415,8 @@ int pw_link_register(struct pw_link *link, | ||||||
| 	link->info.input_node_id = input_node->global->id; | 	link->info.input_node_id = input_node->global->id; | ||||||
| 	link->info.input_port_id = link->input->global->id; | 	link->info.input_port_id = link->input->global->id; | ||||||
| 
 | 
 | ||||||
| 	pw_properties_setf(properties, "link.output", "%d", link->info.output_port_id); | 	pw_properties_setf(properties, PW_KEY_LINK_INPUT_PORT, "%d", link->info.input_port_id); | ||||||
| 	pw_properties_setf(properties, "link.input", "%d", link->info.input_port_id); | 	pw_properties_setf(properties, PW_KEY_LINK_OUTPUT_PORT, "%d", link->info.output_port_id); | ||||||
| 
 | 
 | ||||||
| 	spa_list_append(&core->link_list, &link->link); | 	spa_list_append(&core->link_list, &link->link); | ||||||
| 	link->registered = true; | 	link->registered = true; | ||||||
|  |  | ||||||
|  | @ -73,9 +73,6 @@ struct pw_link_events { | ||||||
| 	void (*port_unlinked) (void *data, struct pw_port *port); | 	void (*port_unlinked) (void *data, struct pw_port *port); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** Indicate that a link is passive, it does not cause the nodes to activate,
 |  | ||||||
|   * set to "1" or "0" */ |  | ||||||
| #define PW_LINK_PROP_PASSIVE	"pipewire.link.passive" |  | ||||||
| 
 | 
 | ||||||
| /** Make a new link between two ports \memberof pw_link
 | /** Make a new link between two ports \memberof pw_link
 | ||||||
|  * \return a newly allocated link */ |  * \return a newly allocated link */ | ||||||
|  |  | ||||||
|  | @ -9,6 +9,7 @@ pipewire_headers = [ | ||||||
|   'global.h', |   'global.h', | ||||||
|   'interfaces.h', |   'interfaces.h', | ||||||
|   'introspect.h', |   'introspect.h', | ||||||
|  |   'keys.h', | ||||||
|   'link.h', |   'link.h', | ||||||
|   'log.h', |   'log.h', | ||||||
|   'loop.h', |   'loop.h', | ||||||
|  |  | ||||||
|  | @ -33,6 +33,7 @@ | ||||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||||
| #include <errno.h> | #include <errno.h> | ||||||
| 
 | 
 | ||||||
|  | #include "pipewire/keys.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| #include "pipewire/interfaces.h" | #include "pipewire/interfaces.h" | ||||||
| #include "pipewire/utils.h" | #include "pipewire/utils.h" | ||||||
|  | @ -232,7 +233,7 @@ pw_module_load(struct pw_core *core, | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_init(&this->listener_list); | 	spa_hook_list_init(&this->listener_list); | ||||||
| 
 | 
 | ||||||
| 	pw_properties_set(properties, PW_MODULE_PROP_NAME, name); | 	pw_properties_set(properties, PW_KEY_MODULE_NAME, name); | ||||||
| 
 | 
 | ||||||
| 	this->info.name = name ? strdup(name) : NULL; | 	this->info.name = name ? strdup(name) : NULL; | ||||||
| 	this->info.filename = filename; | 	this->info.filename = filename; | ||||||
|  | @ -245,7 +246,7 @@ pw_module_load(struct pw_core *core, | ||||||
| 				     PW_TYPE_INTERFACE_Module, | 				     PW_TYPE_INTERFACE_Module, | ||||||
| 				     PW_VERSION_MODULE_PROXY, | 				     PW_VERSION_MODULE_PROXY, | ||||||
| 				     pw_properties_new( | 				     pw_properties_new( | ||||||
| 					     PW_MODULE_PROP_NAME, name, | 					     PW_KEY_MODULE_NAME, name, | ||||||
| 					     NULL), | 					     NULL), | ||||||
| 				     global_bind, | 				     global_bind, | ||||||
| 				     this); | 				     this); | ||||||
|  |  | ||||||
|  | @ -65,12 +65,6 @@ struct pw_module_events { | ||||||
| 	void (*destroy) (void *data); | 	void (*destroy) (void *data); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** The name of the module */ |  | ||||||
| #define PW_MODULE_PROP_NAME		"pipewire.module.name" |  | ||||||
| #define PW_MODULE_PROP_AUTHOR		"pipewire.module.author" |  | ||||||
| #define PW_MODULE_PROP_DESCRIPTION	"pipewire.module.description" |  | ||||||
| #define PW_MODULE_PROP_VERSION		"pipewire.module.version" |  | ||||||
| 
 |  | ||||||
| struct pw_module * | struct pw_module * | ||||||
| pw_module_load(struct pw_core *core, | pw_module_load(struct pw_core *core, | ||||||
| 	       const char *name,		/**< name of the module */ | 	       const char *name,		/**< name of the module */ | ||||||
|  |  | ||||||
|  | @ -37,6 +37,7 @@ | ||||||
| #include "pipewire/interfaces.h" | #include "pipewire/interfaces.h" | ||||||
| #include "pipewire/private.h" | #include "pipewire/private.h" | ||||||
| 
 | 
 | ||||||
|  | #include "pipewire/keys.h" | ||||||
| #include "pipewire/node.h" | #include "pipewire/node.h" | ||||||
| #include "pipewire/data-loop.h" | #include "pipewire/data-loop.h" | ||||||
| #include "pipewire/main-loop.h" | #include "pipewire/main-loop.h" | ||||||
|  | @ -489,13 +490,13 @@ int pw_node_register(struct pw_node *this, | ||||||
| 	if (properties == NULL) | 	if (properties == NULL) | ||||||
| 		return -ENOMEM; | 		return -ENOMEM; | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(this->properties, "media.class")) != NULL) | 	if ((str = pw_properties_get(this->properties, PW_KEY_MEDIA_CLASS)) != NULL) | ||||||
| 		pw_properties_set(properties, "media.class", str); | 		pw_properties_set(properties, PW_KEY_MEDIA_CLASS, str); | ||||||
| 	if ((str = pw_properties_get(this->properties, "media.role")) != NULL) | 	if ((str = pw_properties_get(this->properties, PW_KEY_MEDIA_ROLE)) != NULL) | ||||||
| 		pw_properties_set(properties, "media.role", str); | 		pw_properties_set(properties, PW_KEY_MEDIA_ROLE, str); | ||||||
| 	pw_properties_set(properties, "node.name", this->info.name); | 	pw_properties_set(properties, PW_KEY_NODE_NAME, this->info.name); | ||||||
| 	if ((str = pw_properties_get(this->properties, "node.session")) != NULL) | 	if ((str = pw_properties_get(this->properties, PW_KEY_NODE_SESSION)) != NULL) | ||||||
| 		pw_properties_set(properties, "node.session", str); | 		pw_properties_set(properties, PW_KEY_NODE_SESSION, str); | ||||||
| 
 | 
 | ||||||
| 	spa_list_append(&core->node_list, &this->link); | 	spa_list_append(&core->node_list, &this->link); | ||||||
| 	this->registered = true; | 	this->registered = true; | ||||||
|  | @ -511,7 +512,7 @@ int pw_node_register(struct pw_node *this, | ||||||
| 
 | 
 | ||||||
| 	this->info.id = this->global->id; | 	this->info.id = this->global->id; | ||||||
| 	this->rt.activation->position.clock.id = this->info.id; | 	this->rt.activation->position.clock.id = this->info.id; | ||||||
| 	pw_properties_setf(this->properties, "node.id", "%d", this->info.id); | 	pw_properties_setf(this->properties, PW_KEY_NODE_ID, "%d", this->info.id); | ||||||
| 
 | 
 | ||||||
| 	pw_node_initialized(this); | 	pw_node_initialized(this); | ||||||
| 
 | 
 | ||||||
|  | @ -604,12 +605,12 @@ static void check_properties(struct pw_node *node) | ||||||
| 	const char *str; | 	const char *str; | ||||||
| 	bool driver; | 	bool driver; | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(node->properties, "node.pause-on-idle"))) | 	if ((str = pw_properties_get(node->properties, PW_KEY_NODE_PAUSE_ON_IDLE))) | ||||||
| 		impl->pause_on_idle = pw_properties_parse_bool(str); | 		impl->pause_on_idle = pw_properties_parse_bool(str); | ||||||
| 	else | 	else | ||||||
| 		impl->pause_on_idle = true; | 		impl->pause_on_idle = true; | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(node->properties, "node.driver"))) | 	if ((str = pw_properties_get(node->properties, PW_KEY_NODE_DRIVER))) | ||||||
| 		driver = pw_properties_parse_bool(str); | 		driver = pw_properties_parse_bool(str); | ||||||
| 	else | 	else | ||||||
| 		driver = false; | 		driver = false; | ||||||
|  | @ -623,7 +624,7 @@ static void check_properties(struct pw_node *node) | ||||||
| 			spa_list_remove(&node->driver_link); | 			spa_list_remove(&node->driver_link); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if ((str = pw_properties_get(node->properties, "node.latency"))) { | 	if ((str = pw_properties_get(node->properties, PW_KEY_NODE_LATENCY))) { | ||||||
| 		uint32_t num, denom; | 		uint32_t num, denom; | ||||||
| 		pw_log_info("node %p: latency '%s'", node, str); | 		pw_log_info("node %p: latency '%s'", node, str); | ||||||
|                 if (sscanf(str, "%u/%u", &num, &denom) == 2 && denom != 0) { |                 if (sscanf(str, "%u/%u", &num, &denom) == 2 && denom != 0) { | ||||||
|  |  | ||||||
|  | @ -99,20 +99,6 @@ struct pw_node_events { | ||||||
| 	void (*peer_removed) (void *data, struct pw_node *peer); | 	void (*peer_removed) (void *data, struct pw_node *peer); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** Media type of the node, Audio, Video, Midi */ |  | ||||||
| #define PW_NODE_PROP_MEDIA		"pipewire.media" |  | ||||||
| /** Category: Playback, Capture, Duplex */ |  | ||||||
| #define PW_NODE_PROP_CATEGORY		"pipewire.category" |  | ||||||
| /** Role: Movie,Music, Camera, Screen, Communication, Game, Notification, DSP,
 |  | ||||||
|  *        Production, Accessibility, Test */ |  | ||||||
| #define PW_NODE_PROP_ROLE		"pipewire.role" |  | ||||||
| /** exclusive access to device */ |  | ||||||
| #define PW_NODE_PROP_EXCLUSIVE		"pipewire.exclusive" |  | ||||||
| /** Automatically connect this node to a compatible node */ |  | ||||||
| #define PW_NODE_PROP_AUTOCONNECT	"pipewire.autoconnect" |  | ||||||
| /** Try to connect the node to this node id */ |  | ||||||
| #define PW_NODE_PROP_TARGET_NODE	"pipewire.target.node" |  | ||||||
| 
 |  | ||||||
| /** Create a new node \memberof pw_node */ | /** Create a new node \memberof pw_node */ | ||||||
| struct pw_node * | struct pw_node * | ||||||
| pw_node_new(struct pw_core *core,		/**< the core */ | pw_node_new(struct pw_core *core,		/**< the core */ | ||||||
|  |  | ||||||
|  | @ -502,37 +502,37 @@ void pw_fill_remote_properties(struct pw_core *core, struct pw_properties *prope | ||||||
| { | { | ||||||
| 	const char *val; | 	const char *val; | ||||||
| 
 | 
 | ||||||
| 	if (!pw_properties_get(properties, "application.name")) | 	if (!pw_properties_get(properties, PW_KEY_APP_NAME)) | ||||||
| 		pw_properties_set(properties, "application.name", pw_get_client_name()); | 		pw_properties_set(properties, PW_KEY_APP_NAME, pw_get_client_name()); | ||||||
| 
 | 
 | ||||||
| 	if (!pw_properties_get(properties, "application.prgname")) | 	if (!pw_properties_get(properties, PW_KEY_APP_PROCESS_BINARY)) | ||||||
| 		pw_properties_set(properties, "application.prgname", pw_get_prgname()); | 		pw_properties_set(properties, PW_KEY_APP_PROCESS_BINARY, pw_get_prgname()); | ||||||
| 
 | 
 | ||||||
| 	if (!pw_properties_get(properties, "application.language")) { | 	if (!pw_properties_get(properties, PW_KEY_APP_LANGUAGE)) { | ||||||
| 		pw_properties_set(properties, "application.language", getenv("LANG")); | 		pw_properties_set(properties, PW_KEY_APP_LANGUAGE, getenv("LANG")); | ||||||
| 	} | 	} | ||||||
| 	if (!pw_properties_get(properties, "application.process.id")) { | 	if (!pw_properties_get(properties, PW_KEY_APP_PROCESS_ID)) { | ||||||
| 		pw_properties_setf(properties, "application.process.id", "%zd", (size_t) getpid()); | 		pw_properties_setf(properties, PW_KEY_APP_PROCESS_ID, "%zd", (size_t) getpid()); | ||||||
| 	} | 	} | ||||||
| 	if (!pw_properties_get(properties, "application.process.user")) | 	if (!pw_properties_get(properties, PW_KEY_APP_PROCESS_USER)) | ||||||
| 		pw_properties_set(properties, "application.process.user", pw_get_user_name()); | 		pw_properties_set(properties, PW_KEY_APP_PROCESS_USER, pw_get_user_name()); | ||||||
| 
 | 
 | ||||||
| 	if (!pw_properties_get(properties, "application.process.host")) | 	if (!pw_properties_get(properties, PW_KEY_APP_PROCESS_HOST)) | ||||||
| 		pw_properties_set(properties, "application.process.host", pw_get_host_name()); | 		pw_properties_set(properties, PW_KEY_APP_PROCESS_HOST, pw_get_host_name()); | ||||||
| 
 | 
 | ||||||
| 	if (!pw_properties_get(properties, "application.process.session_id")) { | 	if (!pw_properties_get(properties, PW_KEY_APP_PROCESS_SESSION_ID)) { | ||||||
| 		pw_properties_set(properties, "application.process.session_id", | 		pw_properties_set(properties, PW_KEY_APP_PROCESS_SESSION_ID, | ||||||
| 				  getenv("XDG_SESSION_ID")); | 				  getenv("XDG_SESSION_ID")); | ||||||
| 	} | 	} | ||||||
| 	if (!pw_properties_get(properties, "window.x11.display")) { | 	if (!pw_properties_get(properties, PW_KEY_WINDOW_X11_DISPLAY)) { | ||||||
| 		pw_properties_set(properties, "window.x11.display", | 		pw_properties_set(properties, PW_KEY_WINDOW_X11_DISPLAY, | ||||||
| 				  getenv("DISPLAY")); | 				  getenv("DISPLAY")); | ||||||
| 	} | 	} | ||||||
| 	pw_properties_set(properties, PW_CORE_PROP_VERSION, core->info.version); | 	pw_properties_set(properties, PW_KEY_CORE_VERSION, core->info.version); | ||||||
| 	pw_properties_set(properties, PW_CORE_PROP_NAME, core->info.name); | 	pw_properties_set(properties, PW_KEY_CORE_NAME, core->info.name); | ||||||
| 
 | 
 | ||||||
| 	if ((val = pw_properties_get(core->properties, PW_CORE_PROP_DAEMON))) | 	if ((val = pw_properties_get(core->properties, PW_KEY_CORE_DAEMON))) | ||||||
| 		pw_properties_set(properties, PW_CORE_PROP_DAEMON, val); | 		pw_properties_set(properties, PW_KEY_CORE_DAEMON, val); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Fill stream properties
 | /** Fill stream properties
 | ||||||
|  |  | ||||||
|  | @ -36,6 +36,7 @@ extern "C" { | ||||||
| #include <pipewire/device.h> | #include <pipewire/device.h> | ||||||
| #include <pipewire/interfaces.h> | #include <pipewire/interfaces.h> | ||||||
| #include <pipewire/introspect.h> | #include <pipewire/introspect.h> | ||||||
|  | #include <pipewire/keys.h> | ||||||
| #include <pipewire/link.h> | #include <pipewire/link.h> | ||||||
| #include <pipewire/log.h> | #include <pipewire/log.h> | ||||||
| #include <pipewire/loop.h> | #include <pipewire/loop.h> | ||||||
|  |  | ||||||
|  | @ -352,9 +352,9 @@ struct pw_port *pw_port_new(enum pw_direction direction, | ||||||
| 		goto no_mem; | 		goto no_mem; | ||||||
| 
 | 
 | ||||||
| 	if (SPA_FLAG_CHECK(info->flags, SPA_PORT_FLAG_PHYSICAL)) | 	if (SPA_FLAG_CHECK(info->flags, SPA_PORT_FLAG_PHYSICAL)) | ||||||
| 		pw_properties_set(properties, "port.physical", "1"); | 		pw_properties_set(properties, PW_KEY_PORT_PHYSICAL, "1"); | ||||||
| 	if (SPA_FLAG_CHECK(info->flags, SPA_PORT_FLAG_TERMINAL)) | 	if (SPA_FLAG_CHECK(info->flags, SPA_PORT_FLAG_TERMINAL)) | ||||||
| 		pw_properties_set(properties, "port.terminal", "1"); | 		pw_properties_set(properties, PW_KEY_PORT_TERMINAL, "1"); | ||||||
| 
 | 
 | ||||||
| 	this->direction = direction; | 	this->direction = direction; | ||||||
| 	this->port_id = port_id; | 	this->port_id = port_id; | ||||||
|  | @ -682,23 +682,24 @@ int pw_port_add(struct pw_port *port, struct pw_node *node) | ||||||
| 
 | 
 | ||||||
| 	pw_port_for_each_param(port, 0, SPA_PARAM_IO, 0, 0, NULL, check_param_io, port); | 	pw_port_for_each_param(port, 0, SPA_PARAM_IO, 0, 0, NULL, check_param_io, port); | ||||||
| 
 | 
 | ||||||
| 	dir = port->direction == PW_DIRECTION_INPUT ?  "in" : "out"; |  | ||||||
| 	pw_properties_set(port->properties, "port.direction", dir); |  | ||||||
| 
 |  | ||||||
| 	if ((str = pw_properties_get(port->properties, "port.name")) == NULL) { |  | ||||||
| 		if ((str = pw_properties_get(port->properties, "port.channel")) != NULL && |  | ||||||
| 		    strcmp(str, "UNK") != 0) { |  | ||||||
| 			pw_properties_setf(port->properties, "port.name", "%s_%s", dir, str); |  | ||||||
| 		} |  | ||||||
| 		else { |  | ||||||
| 			pw_properties_setf(port->properties, "port.name", "%s_%d", dir, port->port_id); |  | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	control = PW_PORT_IS_CONTROL(port); | 	control = PW_PORT_IS_CONTROL(port); | ||||||
| 	if (control) { | 	if (control) { | ||||||
| 		dir = port->direction == PW_DIRECTION_INPUT ?  "control" : "notify"; | 		dir = port->direction == PW_DIRECTION_INPUT ?  "control" : "notify"; | ||||||
| 		pw_properties_set(port->properties, "port.control", "1"); | 		pw_properties_set(port->properties, PW_KEY_PORT_CONTROL, "1"); | ||||||
|  | 	} | ||||||
|  | 	else { | ||||||
|  | 		dir = port->direction == PW_DIRECTION_INPUT ?  "in" : "out"; | ||||||
|  | 	} | ||||||
|  | 	pw_properties_set(port->properties, PW_KEY_PORT_DIRECTION, dir); | ||||||
|  | 
 | ||||||
|  | 	if ((str = pw_properties_get(port->properties, PW_KEY_PORT_NAME)) == NULL) { | ||||||
|  | 		if ((str = pw_properties_get(port->properties, PW_KEY_PORT_CHANNEL)) != NULL && | ||||||
|  | 		    strcmp(str, "UNK") != 0) { | ||||||
|  | 			pw_properties_setf(port->properties, PW_KEY_PORT_NAME, "%s_%s", dir, str); | ||||||
|  | 		} | ||||||
|  | 		else { | ||||||
|  | 			pw_properties_setf(port->properties, PW_KEY_PORT_NAME, "%s_%d", dir, port->port_id); | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (control) { | 	if (control) { | ||||||
|  |  | ||||||
|  | @ -190,7 +190,7 @@ struct pw_remote *pw_remote_new(struct pw_core *core, | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_init(&this->listener_list); | 	spa_hook_list_init(&this->listener_list); | ||||||
| 
 | 
 | ||||||
| 	if ((protocol_name = pw_properties_get(properties, PW_REMOTE_PROP_PROTOCOL)) == NULL) { | 	if ((protocol_name = pw_properties_get(properties, PW_KEY_PROTOCOL)) == NULL) { | ||||||
| 		if (!pw_module_load(core, "libpipewire-module-protocol-native", NULL, NULL, NULL, NULL)) | 		if (!pw_module_load(core, "libpipewire-module-protocol-native", NULL, NULL, NULL, NULL)) | ||||||
| 			goto no_protocol; | 			goto no_protocol; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -141,11 +141,6 @@ struct pw_remote_events { | ||||||
| 	void (*exported) (void *data, uint32_t proxy_id, uint32_t global_id); | 	void (*exported) (void *data, uint32_t proxy_id, uint32_t global_id); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** Specify the name of the protocol to use, default is using the native protocol */ |  | ||||||
| #define PW_REMOTE_PROP_PROTOCOL		"pipewire.protocol" |  | ||||||
| /** The name of the remote to connect to, default env(PIPEWIRE_REMOTE) or pipewire-0 */ |  | ||||||
| #define PW_REMOTE_PROP_REMOTE_NAME	"pipewire.remote.name" |  | ||||||
| 
 |  | ||||||
| /** Create a new unconnected remote \memberof pw_remote
 | /** Create a new unconnected remote \memberof pw_remote
 | ||||||
|  * \return a new unconnected remote */ |  * \return a new unconnected remote */ | ||||||
| struct pw_remote * | struct pw_remote * | ||||||
|  |  | ||||||
|  | @ -1057,22 +1057,22 @@ struct pw_stream * pw_stream_new(struct pw_remote *remote, const char *name, | ||||||
| 	pw_log_debug("stream %p: new \"%s\"", impl, name); | 	pw_log_debug("stream %p: new \"%s\"", impl, name); | ||||||
| 
 | 
 | ||||||
| 	if (props == NULL) { | 	if (props == NULL) { | ||||||
| 		props = pw_properties_new("media.name", name, NULL); | 		props = pw_properties_new(PW_KEY_MEDIA_NAME, name, NULL); | ||||||
| 	} else if (!pw_properties_get(props, "media.name")) { | 	} else if (pw_properties_get(props, PW_KEY_MEDIA_NAME) == NULL) { | ||||||
| 		pw_properties_set(props, "media.name", name); | 		pw_properties_set(props, PW_KEY_MEDIA_NAME, name); | ||||||
| 	} | 	} | ||||||
| 	if (props == NULL) | 	if (props == NULL) | ||||||
| 		goto no_mem; | 		goto no_mem; | ||||||
| 
 | 
 | ||||||
| 	if (!pw_properties_get(props, "node.name")) { | 	if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL) { | ||||||
| 		const struct pw_properties *p = pw_remote_get_properties(remote); | 		const struct pw_properties *p = pw_remote_get_properties(remote); | ||||||
| 
 | 
 | ||||||
| 		if ((str = pw_properties_get(p, "application.name")) != NULL) | 		if ((str = pw_properties_get(p, PW_KEY_APP_NAME)) != NULL) | ||||||
| 			pw_properties_set(props, "node.name", str); | 			pw_properties_set(props, PW_KEY_NODE_NAME, str); | ||||||
| 		else if ((str = pw_properties_get(p, "application.prgname")) != NULL) | 		else if ((str = pw_properties_get(p, PW_KEY_APP_PROCESS_BINARY)) != NULL) | ||||||
| 			pw_properties_set(props, "node.name", str); | 			pw_properties_set(props, PW_KEY_NODE_NAME, str); | ||||||
| 		else | 		else | ||||||
| 			pw_properties_set(props, "node.name", name); | 			pw_properties_set(props, PW_KEY_NODE_NAME, name); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	spa_hook_list_init(&impl->hooks); | 	spa_hook_list_init(&impl->hooks); | ||||||
|  | @ -1298,16 +1298,16 @@ pw_stream_connect(struct pw_stream *stream, | ||||||
| 	stream_set_state(stream, PW_STREAM_STATE_CONNECTING, NULL); | 	stream_set_state(stream, PW_STREAM_STATE_CONNECTING, NULL); | ||||||
| 
 | 
 | ||||||
| 	if (target_id != SPA_ID_INVALID) | 	if (target_id != SPA_ID_INVALID) | ||||||
| 		pw_properties_setf(stream->properties, PW_NODE_PROP_TARGET_NODE, "%d", target_id); | 		pw_properties_setf(stream->properties, PW_KEY_NODE_TARGET, "%d", target_id); | ||||||
| 	if (flags & PW_STREAM_FLAG_AUTOCONNECT) | 	if (flags & PW_STREAM_FLAG_AUTOCONNECT) | ||||||
| 		pw_properties_set(stream->properties, PW_NODE_PROP_AUTOCONNECT, "1"); | 		pw_properties_set(stream->properties, PW_KEY_NODE_AUTOCONNECT, "1"); | ||||||
| 	pw_properties_set(stream->properties, "node.stream", "1"); | 	pw_properties_set(stream->properties, PW_KEY_NODE_STREAM, "1"); | ||||||
| 	if (flags & PW_STREAM_FLAG_DRIVER) | 	if (flags & PW_STREAM_FLAG_DRIVER) | ||||||
| 		pw_properties_set(stream->properties, "node.driver", "1"); | 		pw_properties_set(stream->properties, PW_KEY_NODE_DRIVER, "1"); | ||||||
| 	if (flags & PW_STREAM_FLAG_EXCLUSIVE) | 	if (flags & PW_STREAM_FLAG_EXCLUSIVE) | ||||||
| 		pw_properties_set(stream->properties, PW_NODE_PROP_EXCLUSIVE, "1"); | 		pw_properties_set(stream->properties, PW_KEY_NODE_EXCLUSIVE, "1"); | ||||||
| 	if (flags & PW_STREAM_FLAG_DONT_RECONNECT) | 	if (flags & PW_STREAM_FLAG_DONT_RECONNECT) | ||||||
| 		pw_properties_set(stream->properties, "pipewire.dont-reconnect", "1"); | 		pw_properties_set(stream->properties, PW_KEY_NODE_DONT_RECONNECT, "1"); | ||||||
| 
 | 
 | ||||||
| 	state = pw_remote_get_state(stream->remote, NULL); | 	state = pw_remote_get_state(stream->remote, NULL); | ||||||
| 	impl->async_connect = (state == PW_REMOTE_STATE_UNCONNECTED || | 	impl->async_connect = (state == PW_REMOTE_STATE_UNCONNECTED || | ||||||
|  |  | ||||||
|  | @ -272,13 +272,6 @@ const char *pw_stream_get_name(struct pw_stream *stream); | ||||||
| 
 | 
 | ||||||
| struct pw_remote *pw_stream_get_remote(struct pw_stream *stream); | struct pw_remote *pw_stream_get_remote(struct pw_stream *stream); | ||||||
| 
 | 
 | ||||||
| /** Indicates that the stream is live, boolean default false */ |  | ||||||
| #define PW_STREAM_PROP_IS_LIVE		"pipewire.latency.is-live" |  | ||||||
| /** The minimum latency of the stream, int, default 0 */ |  | ||||||
| #define PW_STREAM_PROP_LATENCY_MIN	"pipewire.latency.min" |  | ||||||
| /** The maximum latency of the stream, int default MAXINT */ |  | ||||||
| #define PW_STREAM_PROP_LATENCY_MAX	"pipewire.latency.max" |  | ||||||
| 
 |  | ||||||
| const struct pw_properties *pw_stream_get_properties(struct pw_stream *stream); | const struct pw_properties *pw_stream_get_properties(struct pw_stream *stream); | ||||||
| 
 | 
 | ||||||
| int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict *dict); | int pw_stream_update_properties(struct pw_stream *stream, const struct spa_dict *dict); | ||||||
|  |  | ||||||
|  | @ -430,7 +430,7 @@ static bool do_connect(struct data *data, const char *cmd, char *args, char **er | ||||||
| 
 | 
 | ||||||
| 	n = pw_split_ip(args, WHITESPACE, 1, a); | 	n = pw_split_ip(args, WHITESPACE, 1, a); | ||||||
| 	if (n == 1) { | 	if (n == 1) { | ||||||
| 		props = pw_properties_new(PW_REMOTE_PROP_REMOTE_NAME, a[0], NULL); | 		props = pw_properties_new(PW_KEY_REMOTE_NAME, a[0], NULL); | ||||||
| 	} | 	} | ||||||
| 	remote = pw_remote_new(data->core, props, sizeof(struct remote_data)); | 	remote = pw_remote_new(data->core, props, sizeof(struct remote_data)); | ||||||
| 
 | 
 | ||||||
|  | @ -1092,10 +1092,10 @@ static bool do_create_link(struct data *data, const char *cmd, char *args, char | ||||||
| 	else | 	else | ||||||
| 		props = pw_properties_new(NULL, NULL); | 		props = pw_properties_new(NULL, NULL); | ||||||
| 
 | 
 | ||||||
| 	pw_properties_set(props, PW_LINK_OUTPUT_NODE_ID, a[0]); | 	pw_properties_set(props, PW_KEY_LINK_OUTPUT_NODE, a[0]); | ||||||
| 	pw_properties_set(props, PW_LINK_OUTPUT_PORT_ID, a[1]); | 	pw_properties_set(props, PW_KEY_LINK_OUTPUT_PORT, a[1]); | ||||||
| 	pw_properties_set(props, PW_LINK_INPUT_NODE_ID, a[2]); | 	pw_properties_set(props, PW_KEY_LINK_INPUT_NODE, a[2]); | ||||||
| 	pw_properties_set(props, PW_LINK_INPUT_PORT_ID, a[3]); | 	pw_properties_set(props, PW_KEY_LINK_INPUT_PORT, a[3]); | ||||||
| 
 | 
 | ||||||
| 	proxy = (struct pw_proxy*)pw_core_proxy_create_object(rd->core_proxy, | 	proxy = (struct pw_proxy*)pw_core_proxy_create_object(rd->core_proxy, | ||||||
| 					  "link-factory", | 					  "link-factory", | ||||||
|  | @ -1374,7 +1374,7 @@ int main(int argc, char *argv[]) | ||||||
| 	spa_list_init(&data.remotes); | 	spa_list_init(&data.remotes); | ||||||
| 	pw_map_init(&data.vars, 64, 16); | 	pw_map_init(&data.vars, 64, 16); | ||||||
| 
 | 
 | ||||||
| 	data.core = pw_core_new(l, pw_properties_new(PW_CORE_PROP_DAEMON, "1", NULL), 0); | 	data.core = pw_core_new(l, pw_properties_new(PW_KEY_CORE_DAEMON, "1", NULL), 0); | ||||||
| 	info = pw_core_get_info(data.core); | 	info = pw_core_get_info(data.core); | ||||||
| 
 | 
 | ||||||
| 	pw_module_load(data.core, "libpipewire-module-link-factory", NULL, NULL, NULL, NULL); | 	pw_module_load(data.core, "libpipewire-module-link-factory", NULL, NULL, NULL, NULL); | ||||||
|  |  | ||||||
|  | @ -746,7 +746,7 @@ int main(int argc, char *argv[]) | ||||||
| 		return -1; | 		return -1; | ||||||
| 
 | 
 | ||||||
| 	if (argc > 1) | 	if (argc > 1) | ||||||
| 		props = pw_properties_new(PW_REMOTE_PROP_REMOTE_NAME, argv[1], NULL); | 		props = pw_properties_new(PW_KEY_REMOTE_NAME, argv[1], NULL); | ||||||
| 
 | 
 | ||||||
| 	data.remote = pw_remote_new(data.core, props, 0); | 	data.remote = pw_remote_new(data.core, props, 0); | ||||||
| 	if (data.remote == NULL) | 	if (data.remote == NULL) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Wim Taymans
						Wim Taymans