mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	pulse: parse and fill up the array of formats
A sink and source can have an array of pa_format_info structures that contain the possible formats of the device. Parse them from the EnumFormat and return them when introspecting.
This commit is contained in:
		
							parent
							
								
									8406ad8a4e
								
							
						
					
					
						commit
						023281fd0b
					
				
					 6 changed files with 333 additions and 180 deletions
				
			
		| 
						 | 
				
			
			@ -102,8 +102,6 @@ static int sink_callback(pa_context *c, struct global *g, struct sink_data *d)
 | 
			
		|||
	uint32_t n, j;
 | 
			
		||||
	char monitor_name[1024];
 | 
			
		||||
	pa_sink_info i;
 | 
			
		||||
	pa_format_info ii[1];
 | 
			
		||||
	pa_format_info *ip[1];
 | 
			
		||||
 | 
			
		||||
	spa_zero(i);
 | 
			
		||||
	if (info->props && (str = spa_dict_lookup(info->props, PW_KEY_NODE_NAME)))
 | 
			
		||||
| 
						 | 
				
			
			@ -184,14 +182,10 @@ static int sink_callback(pa_context *c, struct global *g, struct sink_data *d)
 | 
			
		|||
		else
 | 
			
		||||
			i.ports[j] = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	i.n_formats = 1;
 | 
			
		||||
	ii[0].encoding = PA_ENCODING_PCM;
 | 
			
		||||
	ii[0].plist = pa_proplist_new();
 | 
			
		||||
	ip[0] = ii;
 | 
			
		||||
	i.formats = ip;
 | 
			
		||||
	i.n_formats = pw_array_get_len(&g->node_info.formats, pa_format_info *);
 | 
			
		||||
	i.formats = g->node_info.formats.data;
 | 
			
		||||
	d->cb(c, &i, 0, d->userdata);
 | 
			
		||||
	pa_proplist_free(i.proplist);
 | 
			
		||||
	pa_proplist_free(ii[0].plist);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -817,8 +811,6 @@ static int source_callback(pa_context *c, struct global *g, struct source_data *
 | 
			
		|||
	const char *str;
 | 
			
		||||
	uint32_t n, j;
 | 
			
		||||
	pa_source_info i;
 | 
			
		||||
	pa_format_info ii[1];
 | 
			
		||||
	pa_format_info *ip[1];
 | 
			
		||||
	enum pa_source_flags flags;
 | 
			
		||||
	bool monitor;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -917,14 +909,10 @@ static int source_callback(pa_context *c, struct global *g, struct source_data *
 | 
			
		|||
		else
 | 
			
		||||
			i.ports[j] = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	i.n_formats = 1;
 | 
			
		||||
	ii[0].encoding = PA_ENCODING_PCM;
 | 
			
		||||
	ii[0].plist = pa_proplist_new();
 | 
			
		||||
	ip[0] = ii;
 | 
			
		||||
	i.formats = ip;
 | 
			
		||||
	i.n_formats = pw_array_get_len(&g->node_info.formats, pa_format_info *);
 | 
			
		||||
	i.formats = g->node_info.formats.data;
 | 
			
		||||
	d->cb(c, &i, 0, d->userdata);
 | 
			
		||||
	pa_proplist_free(i.proplist);
 | 
			
		||||
	pa_proplist_free(ii[0].plist);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue