mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	
							parent
							
								
									b0a7e4a267
								
							
						
					
					
						commit
						895e516a75
					
				
					 2 changed files with 27 additions and 1 deletions
				
			
		| 
						 | 
					@ -19,6 +19,8 @@ struct module_raop_discover_data {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct spa_hook mod_listener;
 | 
						struct spa_hook mod_listener;
 | 
				
			||||||
	struct pw_impl_module *mod;
 | 
						struct pw_impl_module *mod;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						uint32_t latency_msec;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void module_destroy(void *data)
 | 
					static void module_destroy(void *data)
 | 
				
			||||||
| 
						 | 
					@ -37,10 +39,25 @@ static const struct pw_impl_module_events module_events = {
 | 
				
			||||||
static int module_raop_discover_load(struct module *module)
 | 
					static int module_raop_discover_load(struct module *module)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct module_raop_discover_data *data = module->user_data;
 | 
						struct module_raop_discover_data *data = module->user_data;
 | 
				
			||||||
 | 
						FILE *f;
 | 
				
			||||||
 | 
						char *args;
 | 
				
			||||||
 | 
						size_t size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if ((f = open_memstream(&args, &size)) == NULL)
 | 
				
			||||||
 | 
							return -errno;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fprintf(f, "{");
 | 
				
			||||||
 | 
						if (data->latency_msec > 0)
 | 
				
			||||||
 | 
							fprintf(f, " raop.latency.ms = %u ", data->latency_msec);
 | 
				
			||||||
 | 
						fprintf(f, "}");
 | 
				
			||||||
 | 
						fclose(f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data->mod = pw_context_load_module(module->impl->context,
 | 
						data->mod = pw_context_load_module(module->impl->context,
 | 
				
			||||||
			"libpipewire-module-raop-discover",
 | 
								"libpipewire-module-raop-discover",
 | 
				
			||||||
			NULL, NULL);
 | 
								args, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						free(args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (data->mod == NULL)
 | 
						if (data->mod == NULL)
 | 
				
			||||||
		return -errno;
 | 
							return -errno;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,9 +92,12 @@ static int module_raop_discover_prepare(struct module * const module)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	PW_LOG_TOPIC_INIT(mod_topic);
 | 
						PW_LOG_TOPIC_INIT(mod_topic);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						struct pw_properties * const props = module->props;
 | 
				
			||||||
	struct module_raop_discover_data * const data = module->user_data;
 | 
						struct module_raop_discover_data * const data = module->user_data;
 | 
				
			||||||
	data->module = module;
 | 
						data->module = module;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_properties_fetch_uint32(props, "latency_msec", &data->latency_msec);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,6 +41,8 @@
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Options specific to the behavior of this module
 | 
					 * Options specific to the behavior of this module
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 | 
					 * - `raop.latency.ms` = latency for all streams in microseconds. This
 | 
				
			||||||
 | 
					 *    can be overwritten in the stream rules.
 | 
				
			||||||
 * - `stream.rules` = <rules>: match rules, use create-stream actions. See
 | 
					 * - `stream.rules` = <rules>: match rules, use create-stream actions. See
 | 
				
			||||||
 *   \ref page_module_raop_sink for module properties.
 | 
					 *   \ref page_module_raop_sink for module properties.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
| 
						 | 
					@ -50,6 +52,7 @@
 | 
				
			||||||
 * context.modules = [
 | 
					 * context.modules = [
 | 
				
			||||||
 * {   name = libpipewire-raop-discover
 | 
					 * {   name = libpipewire-raop-discover
 | 
				
			||||||
 *     args = {
 | 
					 *     args = {
 | 
				
			||||||
 | 
					 *         #raop.latency.ms = 1000
 | 
				
			||||||
 *         stream.rules = [
 | 
					 *         stream.rules = [
 | 
				
			||||||
 *             {   matches = [
 | 
					 *             {   matches = [
 | 
				
			||||||
 *                     {    raop.ip = "~.*"
 | 
					 *                     {    raop.ip = "~.*"
 | 
				
			||||||
| 
						 | 
					@ -410,6 +413,9 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
 | 
				
			||||||
		avahi_free(value);
 | 
							avahi_free(value);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if ((str = pw_properties_get(impl->properties, "raop.latency.ms")) != NULL)
 | 
				
			||||||
 | 
							pw_properties_set(props, "raop.latency.ms", str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((str = pw_properties_get(impl->properties, "stream.rules")) == NULL)
 | 
						if ((str = pw_properties_get(impl->properties, "stream.rules")) == NULL)
 | 
				
			||||||
		str = DEFAULT_CREATE_RULES;
 | 
							str = DEFAULT_CREATE_RULES;
 | 
				
			||||||
	if (str != NULL) {
 | 
						if (str != NULL) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue