mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse-server: add sink/source_properties
Support setting extra properties on the sink and source with the sink/source_properties. Fix construction of the module arguments, the sink/source.props needs to be inside the object.. Fixes #2201
This commit is contained in:
		
							parent
							
								
									8fa4d5c43f
								
							
						
					
					
						commit
						f06ee28140
					
				
					 2 changed files with 12 additions and 2 deletions
				
			
		| 
						 | 
					@ -78,7 +78,7 @@ static int module_roc_sink_load(struct client *client, struct module *module)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fprintf(f, "{");
 | 
						fprintf(f, "{");
 | 
				
			||||||
	pw_properties_serialize_dict(f, &data->roc_props->dict, 0);
 | 
						pw_properties_serialize_dict(f, &data->roc_props->dict, 0);
 | 
				
			||||||
	fprintf(f, " } sink.props = {");
 | 
						fprintf(f, " sink.props = {");
 | 
				
			||||||
	pw_properties_serialize_dict(f, &data->sink_props->dict, 0);
 | 
						pw_properties_serialize_dict(f, &data->sink_props->dict, 0);
 | 
				
			||||||
	fprintf(f, " } }");
 | 
						fprintf(f, " } }");
 | 
				
			||||||
	fclose(f);
 | 
						fclose(f);
 | 
				
			||||||
| 
						 | 
					@ -125,6 +125,7 @@ static const struct spa_dict_item module_roc_sink_info[] = {
 | 
				
			||||||
	{ PW_KEY_MODULE_AUTHOR, "Sanchayan Maity <sanchayan@asymptotic.io>" },
 | 
						{ PW_KEY_MODULE_AUTHOR, "Sanchayan Maity <sanchayan@asymptotic.io>" },
 | 
				
			||||||
	{ PW_KEY_MODULE_DESCRIPTION, "roc sink" },
 | 
						{ PW_KEY_MODULE_DESCRIPTION, "roc sink" },
 | 
				
			||||||
	{ PW_KEY_MODULE_USAGE, "sink_name=<name for the sink> "
 | 
						{ PW_KEY_MODULE_USAGE, "sink_name=<name for the sink> "
 | 
				
			||||||
 | 
									"sink_properties=<properties for the sink> "
 | 
				
			||||||
				"local_ip=<local sender ip> "
 | 
									"local_ip=<local sender ip> "
 | 
				
			||||||
				"remote_ip=<remote receiver ip> "
 | 
									"remote_ip=<remote receiver ip> "
 | 
				
			||||||
				"remote_source_port=<remote receiver port for source packets> "
 | 
									"remote_source_port=<remote receiver port for source packets> "
 | 
				
			||||||
| 
						 | 
					@ -156,6 +157,10 @@ struct module *create_module_roc_sink(struct impl *impl, const char *argument)
 | 
				
			||||||
		pw_properties_set(sink_props, PW_KEY_NODE_NAME, str);
 | 
							pw_properties_set(sink_props, PW_KEY_NODE_NAME, str);
 | 
				
			||||||
		pw_properties_set(props, "sink_name", NULL);
 | 
							pw_properties_set(props, "sink_name", NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if ((str = pw_properties_get(props, "sink_properties")) != NULL) {
 | 
				
			||||||
 | 
							module_args_add_props(sink_props, str);
 | 
				
			||||||
 | 
							pw_properties_set(props, "sink_properties", NULL);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = pw_properties_get(props, PW_KEY_MEDIA_CLASS)) == NULL) {
 | 
						if ((str = pw_properties_get(props, PW_KEY_MEDIA_CLASS)) == NULL) {
 | 
				
			||||||
		pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
 | 
							pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Sink");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ static int module_roc_source_load(struct client *client, struct module *module)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fprintf(f, "{");
 | 
						fprintf(f, "{");
 | 
				
			||||||
	pw_properties_serialize_dict(f, &data->roc_props->dict, 0);
 | 
						pw_properties_serialize_dict(f, &data->roc_props->dict, 0);
 | 
				
			||||||
	fprintf(f, " } source.props = {");
 | 
						fprintf(f, " source.props = {");
 | 
				
			||||||
	pw_properties_serialize_dict(f, &data->source_props->dict, 0);
 | 
						pw_properties_serialize_dict(f, &data->source_props->dict, 0);
 | 
				
			||||||
	fprintf(f, " } }");
 | 
						fprintf(f, " } }");
 | 
				
			||||||
	fclose(f);
 | 
						fclose(f);
 | 
				
			||||||
| 
						 | 
					@ -125,6 +125,7 @@ static const struct spa_dict_item module_roc_source_info[] = {
 | 
				
			||||||
	{ PW_KEY_MODULE_AUTHOR, "Sanchayan Maity <sanchayan@asymptotic.io>" },
 | 
						{ PW_KEY_MODULE_AUTHOR, "Sanchayan Maity <sanchayan@asymptotic.io>" },
 | 
				
			||||||
	{ PW_KEY_MODULE_DESCRIPTION, "roc source" },
 | 
						{ PW_KEY_MODULE_DESCRIPTION, "roc source" },
 | 
				
			||||||
	{ PW_KEY_MODULE_USAGE, "source_name=<name for the source> "
 | 
						{ PW_KEY_MODULE_USAGE, "source_name=<name for the source> "
 | 
				
			||||||
 | 
									"source_properties=<properties for the source> "
 | 
				
			||||||
				"resampler_profile=<empty>|disable|high|medium|low "
 | 
									"resampler_profile=<empty>|disable|high|medium|low "
 | 
				
			||||||
				"sess_latency_msec=<target network latency in milliseconds> "
 | 
									"sess_latency_msec=<target network latency in milliseconds> "
 | 
				
			||||||
				"local_ip=<local receiver ip> "
 | 
									"local_ip=<local receiver ip> "
 | 
				
			||||||
| 
						 | 
					@ -158,6 +159,10 @@ struct module *create_module_roc_source(struct impl *impl, const char *argument)
 | 
				
			||||||
		pw_properties_set(source_props, PW_KEY_NODE_NAME, str);
 | 
							pw_properties_set(source_props, PW_KEY_NODE_NAME, str);
 | 
				
			||||||
		pw_properties_set(props, "source_name", NULL);
 | 
							pw_properties_set(props, "source_name", NULL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if ((str = pw_properties_get(props, "source_properties")) != NULL) {
 | 
				
			||||||
 | 
							module_args_add_props(source_props, str);
 | 
				
			||||||
 | 
							pw_properties_set(props, "source_properties", NULL);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = pw_properties_get(props, PW_KEY_MEDIA_CLASS)) == NULL) {
 | 
						if ((str = pw_properties_get(props, PW_KEY_MEDIA_CLASS)) == NULL) {
 | 
				
			||||||
		pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Source");
 | 
							pw_properties_set(props, PW_KEY_MEDIA_CLASS, "Audio/Source");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue