mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: make helper to init spa_audio_info_raw from dict
Make a function that can initialize raw audio info from a dict and fill in the defaults. We can use this in many of the modules when the audio format is parsed.
This commit is contained in:
		
							parent
							
								
									d932e52d5b
								
							
						
					
					
						commit
						e3a7035e8f
					
				
					 19 changed files with 204 additions and 255 deletions
				
			
		| 
						 | 
				
			
			@ -1424,18 +1424,13 @@ static void parse_devices(struct impl *impl, const char *val, size_t len)
 | 
			
		|||
 | 
			
		||||
static void parse_audio_info(const struct pw_properties *props, struct spa_audio_info_raw *info)
 | 
			
		||||
{
 | 
			
		||||
	const char *str;
 | 
			
		||||
 | 
			
		||||
	spa_zero(*info);
 | 
			
		||||
	info->format = SPA_AUDIO_FORMAT_F32P;
 | 
			
		||||
	info->rate = 0;
 | 
			
		||||
	info->channels = pw_properties_get_uint32(props, PW_KEY_AUDIO_CHANNELS, info->channels);
 | 
			
		||||
	info->channels = SPA_MIN(info->channels, SPA_AUDIO_MAX_CHANNELS);
 | 
			
		||||
	if ((str = pw_properties_get(props, SPA_KEY_AUDIO_POSITION)) != NULL)
 | 
			
		||||
		spa_audio_parse_position(str, strlen(str), info->position, &info->channels);
 | 
			
		||||
	if (info->channels == 0)
 | 
			
		||||
		spa_audio_parse_position(DEFAULT_POSITION, strlen(DEFAULT_POSITION),
 | 
			
		||||
				info->position, &info->channels);
 | 
			
		||||
	spa_audio_info_raw_init_dict_keys(info,
 | 
			
		||||
			&SPA_DICT_ITEMS(
 | 
			
		||||
				 SPA_DICT_ITEM(SPA_KEY_AUDIO_FORMAT, "F32P"),
 | 
			
		||||
				 SPA_DICT_ITEM(SPA_KEY_AUDIO_POSITION, DEFAULT_POSITION)),
 | 
			
		||||
			&props->dict,
 | 
			
		||||
			SPA_KEY_AUDIO_CHANNELS,
 | 
			
		||||
			SPA_KEY_AUDIO_POSITION, NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void copy_props(struct impl *impl, struct pw_properties *props, const char *key)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue