mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	filter-graph: add a LATENCY hint for control ports
Some ports can have latency information about the plugin, mark those ports with the LATENCY HINT. Also decouple the LADSPA hint flags from the SPA ones.
This commit is contained in:
		
							parent
							
								
									5a4e8bb45e
								
							
						
					
					
						commit
						d277b3b62e
					
				
					 3 changed files with 21 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -33,9 +33,10 @@ struct spa_fga_port {
 | 
			
		|||
#define SPA_FGA_PORT_AUDIO	(1ULL << 3)
 | 
			
		||||
	uint64_t flags;
 | 
			
		||||
 | 
			
		||||
#define SPA_FGA_HINT_BOOLEAN		(1ULL << 2)
 | 
			
		||||
#define SPA_FGA_HINT_SAMPLE_RATE	(1ULL << 3)
 | 
			
		||||
#define SPA_FGA_HINT_INTEGER		(1ULL << 5)
 | 
			
		||||
#define SPA_FGA_HINT_BOOLEAN		(1ULL << 0)
 | 
			
		||||
#define SPA_FGA_HINT_SAMPLE_RATE	(1ULL << 1)
 | 
			
		||||
#define SPA_FGA_HINT_INTEGER		(1ULL << 2)
 | 
			
		||||
#define SPA_FGA_HINT_LATENCY		(1ULL << 3)
 | 
			
		||||
	uint64_t hint;
 | 
			
		||||
	float def;
 | 
			
		||||
	float min;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -116,7 +116,15 @@ static void ladspa_port_update_ranges(struct descriptor *dd, struct spa_fga_port
 | 
			
		|||
	lower = d->PortRangeHints[p].LowerBound;
 | 
			
		||||
	upper = d->PortRangeHints[p].UpperBound;
 | 
			
		||||
 | 
			
		||||
	port->hint = hint;
 | 
			
		||||
	port->hint = 0;
 | 
			
		||||
	if (hint & LADSPA_HINT_TOGGLED)
 | 
			
		||||
		port->hint |= SPA_FGA_HINT_BOOLEAN;
 | 
			
		||||
	if (hint & LADSPA_HINT_SAMPLE_RATE)
 | 
			
		||||
		port->hint |= SPA_FGA_HINT_SAMPLE_RATE;
 | 
			
		||||
	if (hint & LADSPA_HINT_INTEGER)
 | 
			
		||||
		port->hint |= SPA_FGA_HINT_INTEGER;
 | 
			
		||||
	if (spa_streq(port->name, "latency"))
 | 
			
		||||
		port->hint |= SPA_FGA_HINT_LATENCY;
 | 
			
		||||
	port->def = get_default(port, hint, lower, upper);
 | 
			
		||||
	port->min = lower;
 | 
			
		||||
	port->max = upper;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -399,6 +399,8 @@ static const struct spa_fga_descriptor *lv2_plugin_make_desc(void *plugin, const
 | 
			
		|||
	struct descriptor *desc;
 | 
			
		||||
	uint32_t i;
 | 
			
		||||
	float *mins, *maxes, *controls;
 | 
			
		||||
	bool latent;
 | 
			
		||||
	uint32_t latency_index;
 | 
			
		||||
 | 
			
		||||
	desc = calloc(1, sizeof(*desc));
 | 
			
		||||
	if (desc == NULL)
 | 
			
		||||
| 
						 | 
				
			
			@ -424,6 +426,9 @@ static const struct spa_fga_descriptor *lv2_plugin_make_desc(void *plugin, const
 | 
			
		|||
	maxes = alloca(desc->desc.n_ports * sizeof(float));
 | 
			
		||||
	controls = alloca(desc->desc.n_ports * sizeof(float));
 | 
			
		||||
 | 
			
		||||
	latent = lilv_plugin_has_latency(p->p);
 | 
			
		||||
	latency_index = latent ? lilv_plugin_get_latency_port_index(p->p) : 0;
 | 
			
		||||
 | 
			
		||||
	lilv_plugin_get_port_ranges_float(p->p, mins, maxes, controls);
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < desc->desc.n_ports; i++) {
 | 
			
		||||
| 
						 | 
				
			
			@ -445,6 +450,9 @@ static const struct spa_fga_descriptor *lv2_plugin_make_desc(void *plugin, const
 | 
			
		|||
			fp->flags |= SPA_FGA_PORT_AUDIO;
 | 
			
		||||
 | 
			
		||||
		fp->hint = 0;
 | 
			
		||||
		if (latent && latency_index == i)
 | 
			
		||||
			fp->flags |= SPA_FGA_HINT_LATENCY;
 | 
			
		||||
 | 
			
		||||
		fp->min = mins[i];
 | 
			
		||||
		fp->max = maxes[i];
 | 
			
		||||
		fp->def = controls[i];
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue