mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audio: remove layout from audio
Make special format types for planar and interleaved instead of having a field. Add enum for audio channel positions Add some default audio channel layouts Place the channel layout in the audio format when possible alsa: place audio channel positions in format Add sse optimized channel mixing for some common cases Remove name from port info, it's not mandatory and in the properties Add direction to port info
This commit is contained in:
		
							parent
							
								
									fb3379e587
								
							
						
					
					
						commit
						5196f7f053
					
				
					 38 changed files with 981 additions and 369 deletions
				
			
		| 
						 | 
				
			
			@ -115,7 +115,6 @@ int main(int argc, char *argv[])
 | 
			
		|||
	params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat,
 | 
			
		||||
			&SPA_AUDIO_INFO_RAW_INIT(
 | 
			
		||||
				.format = SPA_AUDIO_FORMAT_F32,
 | 
			
		||||
				.layout = SPA_AUDIO_LAYOUT_INTERLEAVED,
 | 
			
		||||
				.channels = DEFAULT_CHANNELS,
 | 
			
		||||
				.rate = DEFAULT_RATE ));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -179,14 +179,12 @@ static int port_enum_formats(struct spa_node *node,
 | 
			
		|||
		SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
 | 
			
		||||
		SPA_FORMAT_mediaType,      &SPA_POD_Id(SPA_MEDIA_TYPE_audio),
 | 
			
		||||
		SPA_FORMAT_mediaSubtype,   &SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
 | 
			
		||||
		SPA_FORMAT_AUDIO_format,   &SPA_POD_CHOICE_ENUM_Id(3,
 | 
			
		||||
		SPA_FORMAT_AUDIO_format,   &SPA_POD_CHOICE_ENUM_Id(5,
 | 
			
		||||
						SPA_AUDIO_FORMAT_S16,
 | 
			
		||||
						SPA_AUDIO_FORMAT_S16P,
 | 
			
		||||
						SPA_AUDIO_FORMAT_S16,
 | 
			
		||||
						SPA_AUDIO_FORMAT_F32P,
 | 
			
		||||
						SPA_AUDIO_FORMAT_F32),
 | 
			
		||||
		SPA_FORMAT_AUDIO_layout,   &SPA_POD_CHOICE_ENUM_Id(3,
 | 
			
		||||
						SPA_AUDIO_LAYOUT_INTERLEAVED,
 | 
			
		||||
						SPA_AUDIO_LAYOUT_INTERLEAVED,
 | 
			
		||||
						SPA_AUDIO_LAYOUT_NON_INTERLEAVED),
 | 
			
		||||
		SPA_FORMAT_AUDIO_channels, &SPA_POD_CHOICE_RANGE_Int(2, 1, INT32_MAX),
 | 
			
		||||
		SPA_FORMAT_AUDIO_rate,     &SPA_POD_CHOICE_RANGE_Int(44100, 1, INT32_MAX),
 | 
			
		||||
		0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -190,8 +190,8 @@ static void node_proxy_destroy(void *data)
 | 
			
		|||
	if (n->info)
 | 
			
		||||
		pw_node_info_free(n->info);
 | 
			
		||||
	if (n->session) {
 | 
			
		||||
		n->session = NULL;
 | 
			
		||||
		spa_list_remove(&n->session_link);
 | 
			
		||||
		n->session = NULL;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -276,6 +276,11 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id,
 | 
			
		|||
		sess->need_dsp = need_dsp;
 | 
			
		||||
		sess->enabled = true;
 | 
			
		||||
		sess->node = node;
 | 
			
		||||
		if ((str = spa_dict_lookup(props, "node.plugged")) != NULL)
 | 
			
		||||
			sess->plugged = pw_properties_parse_uint64(str);
 | 
			
		||||
		else
 | 
			
		||||
			sess->plugged = SPA_TIMESPEC_TO_TIME(&impl->now);
 | 
			
		||||
 | 
			
		||||
		spa_list_init(&sess->node_list);
 | 
			
		||||
		spa_list_append(&impl->session_list, &sess->l);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -397,8 +402,6 @@ registry_global(void *data,uint32_t id, uint32_t parent_id,
 | 
			
		|||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
 | 
			
		||||
	clock_gettime(CLOCK_MONOTONIC, &impl->now);
 | 
			
		||||
 | 
			
		||||
	pw_log_debug(NAME " %p: new global '%d'", impl, id);
 | 
			
		||||
 | 
			
		||||
	switch (type) {
 | 
			
		||||
| 
						 | 
				
			
			@ -699,7 +702,6 @@ static void dsp_node_event_info(void *object, struct pw_node_info *info)
 | 
			
		|||
	s->dsp = dsp;
 | 
			
		||||
	spa_hook_remove(&s->listener);
 | 
			
		||||
 | 
			
		||||
	dsp->session = s;
 | 
			
		||||
	dsp->direction = s->direction;
 | 
			
		||||
	dsp->type = NODE_TYPE_DSP;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -727,7 +729,7 @@ static void rescan_session(struct impl *impl, struct session *sess)
 | 
			
		|||
		props = pw_properties_new_dict(node->info->props);
 | 
			
		||||
		pw_properties_setf(props, "audio-dsp.direction", "%d", sess->direction);
 | 
			
		||||
		pw_properties_setf(props, "audio-dsp.channels", "%d", node->format.channels);
 | 
			
		||||
		pw_properties_setf(props, "audio-dsp.channelmask", "%"PRIu64, node->format.channel_mask);
 | 
			
		||||
		pw_properties_setf(props, "audio-dsp.channelmask", "%d", 0);
 | 
			
		||||
		pw_properties_setf(props, "audio-dsp.rate", "%d", node->format.rate);
 | 
			
		||||
		pw_properties_setf(props, "audio-dsp.maxbuffer", "%ld", MAX_QUANTUM_SIZE * sizeof(float));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -749,6 +751,8 @@ static void do_rescan(struct impl *impl)
 | 
			
		|||
	struct session *sess;
 | 
			
		||||
	struct node *node;
 | 
			
		||||
 | 
			
		||||
	clock_gettime(CLOCK_MONOTONIC, &impl->now);
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(sess, &impl->session_list, l)
 | 
			
		||||
		rescan_session(impl, sess);
 | 
			
		||||
	spa_list_for_each(node, &impl->node_list, l)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue