mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	channelmix: improve disabled flag
Also parse updates to the disabled flag when disabled so that we can enabled it again.
This commit is contained in:
		
							parent
							
								
									2653e9f129
								
							
						
					
					
						commit
						c7de69eac7
					
				
					 1 changed files with 5 additions and 8 deletions
				
			
		| 
						 | 
					@ -292,7 +292,8 @@ static void set_volume(struct impl *this)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct volumes *vol;
 | 
						struct volumes *vol;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->mix.set_volume == NULL)
 | 
						if (this->mix.set_volume == NULL ||
 | 
				
			||||||
 | 
						    this->props.disabled)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->props.have_soft_volume)
 | 
						if (this->props.have_soft_volume)
 | 
				
			||||||
| 
						 | 
					@ -691,7 +692,7 @@ static int parse_prop_params(struct impl *this, struct spa_pod *params)
 | 
				
			||||||
		spa_log_info(this->log, "key:'%s' val:'%s'", name, value);
 | 
							spa_log_info(this->log, "key:'%s' val:'%s'", name, value);
 | 
				
			||||||
		changed += channelmix_set_param(this, name, value);
 | 
							changed += channelmix_set_param(this, name, value);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (changed)
 | 
						if (changed && !this->props.disabled)
 | 
				
			||||||
		channelmix_init(&this->mix);
 | 
							channelmix_init(&this->mix);
 | 
				
			||||||
	return changed;
 | 
						return changed;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -709,9 +710,6 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
 | 
				
			||||||
	if (param == NULL)
 | 
						if (param == NULL)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->props.disabled)
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	SPA_POD_OBJECT_FOREACH(obj, prop) {
 | 
						SPA_POD_OBJECT_FOREACH(obj, prop) {
 | 
				
			||||||
		switch (prop->key) {
 | 
							switch (prop->key) {
 | 
				
			||||||
		case SPA_PROP_volume:
 | 
							case SPA_PROP_volume:
 | 
				
			||||||
| 
						 | 
					@ -771,6 +769,7 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (changed) {
 | 
						if (changed) {
 | 
				
			||||||
		struct port *port = GET_PORT(this, this->direction, 0);
 | 
							struct port *port = GET_PORT(this, this->direction, 0);
 | 
				
			||||||
		if (have_soft_volume)
 | 
							if (have_soft_volume)
 | 
				
			||||||
| 
						 | 
					@ -780,6 +779,7 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (port->have_format)
 | 
							if (port->have_format)
 | 
				
			||||||
			remap_volumes(this, &port->format);
 | 
								remap_volumes(this, &port->format);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		set_volume(this);
 | 
							set_volume(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return changed;
 | 
						return changed;
 | 
				
			||||||
| 
						 | 
					@ -794,9 +794,6 @@ static int apply_midi(struct impl *this, const struct spa_pod *value)
 | 
				
			||||||
	if (size < 3)
 | 
						if (size < 3)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this->props.disabled)
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if ((val[0] & 0xf0) != 0xb0 || val[1] != 7)
 | 
						if ((val[0] & 0xf0) != 0xb0 || val[1] != 7)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue