mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: libcamera: source: use union for transferring control value
				
					
				
			Use a union since only one member is active at a time, and use the
proper `libcamera::ControlType` enum to store the type instead of a
bare number. Also remove an unnecessary cast.
(cherry picked from commit 0022fc90b7)
			
			
This commit is contained in:
		
							parent
							
								
									8181e2e051
								
							
						
					
					
						commit
						7414d948ad
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -861,11 +861,13 @@ enum_end:
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
struct val {
 | 
			
		||||
	uint32_t type;
 | 
			
		||||
	float f_val;
 | 
			
		||||
	int32_t i_val;
 | 
			
		||||
	bool b_val;
 | 
			
		||||
	ControlType type;
 | 
			
		||||
	uint32_t id;
 | 
			
		||||
	union {
 | 
			
		||||
		bool b_val;
 | 
			
		||||
		int32_t i_val;
 | 
			
		||||
		float f_val;
 | 
			
		||||
	};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int do_update_ctrls(struct spa_loop *loop,
 | 
			
		||||
| 
						 | 
				
			
			@ -885,7 +887,7 @@ static int do_update_ctrls(struct spa_loop *loop,
 | 
			
		|||
		impl->ctrls.set(d->id, d->f_val);
 | 
			
		||||
		break;
 | 
			
		||||
	case ControlTypeInteger32:
 | 
			
		||||
		impl->ctrls.set(d->id, (int32_t)d->i_val);
 | 
			
		||||
		impl->ctrls.set(d->id, d->i_val);
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue