mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	audioconvert2: add beginnings of control ports
This commit is contained in:
		
							parent
							
								
									d3baa16559
								
							
						
					
					
						commit
						7fe15ee5db
					
				
					 1 changed files with 86 additions and 35 deletions
				
			
		| 
						 | 
					@ -144,6 +144,7 @@ struct port {
 | 
				
			||||||
	unsigned int have_format:1;
 | 
						unsigned int have_format:1;
 | 
				
			||||||
	unsigned int is_dsp:1;
 | 
						unsigned int is_dsp:1;
 | 
				
			||||||
	unsigned int is_monitor:1;
 | 
						unsigned int is_monitor:1;
 | 
				
			||||||
 | 
						unsigned int is_control:1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t blocks;
 | 
						uint32_t blocks;
 | 
				
			||||||
	uint32_t stride;
 | 
						uint32_t stride;
 | 
				
			||||||
| 
						 | 
					@ -167,6 +168,7 @@ struct dir {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct convert conv;
 | 
						struct convert conv;
 | 
				
			||||||
	unsigned int is_passthrough:1;
 | 
						unsigned int is_passthrough:1;
 | 
				
			||||||
 | 
						unsigned int control:1;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct impl {
 | 
					struct impl {
 | 
				
			||||||
| 
						 | 
					@ -227,7 +229,8 @@ struct impl {
 | 
				
			||||||
#define GET_IN_PORT(this,p)		GET_PORT(this,SPA_DIRECTION_INPUT,p)
 | 
					#define GET_IN_PORT(this,p)		GET_PORT(this,SPA_DIRECTION_INPUT,p)
 | 
				
			||||||
#define GET_OUT_PORT(this,p)		GET_PORT(this,SPA_DIRECTION_OUTPUT,p)
 | 
					#define GET_OUT_PORT(this,p)		GET_PORT(this,SPA_DIRECTION_OUTPUT,p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define PORT_IS_DSP(this,d,p) (GET_PORT(this,d,p)->is_dsp)
 | 
					#define PORT_IS_DSP(this,d,p)		(GET_PORT(this,d,p)->is_dsp)
 | 
				
			||||||
 | 
					#define PORT_IS_CONTROL(this,d,p)	(GET_PORT(this,d,p)->is_control)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void set_volume(struct impl *this);
 | 
					static void set_volume(struct impl *this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -268,6 +271,9 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
 | 
				
			||||||
			items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNEL, port->position);
 | 
								items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_AUDIO_CHANNEL, port->position);
 | 
				
			||||||
			if (port->is_monitor)
 | 
								if (port->is_monitor)
 | 
				
			||||||
				items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_MONITOR, "true");
 | 
									items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_MONITOR, "true");
 | 
				
			||||||
 | 
							} else if (PORT_IS_CONTROL(this, port->direction, port->id)) {
 | 
				
			||||||
 | 
								items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_PORT_NAME, "control");
 | 
				
			||||||
 | 
								items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_FORMAT_DSP, "8 bit raw midi");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		port->info.props = &SPA_DICT_INIT(items, n_items);
 | 
							port->info.props = &SPA_DICT_INIT(items, n_items);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -285,7 +291,7 @@ static void emit_port_info(struct impl *this, struct port *port, bool full)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int init_port(struct impl *this, enum spa_direction direction, uint32_t port_id,
 | 
					static int init_port(struct impl *this, enum spa_direction direction, uint32_t port_id,
 | 
				
			||||||
		uint32_t position, bool is_dsp, bool is_monitor)
 | 
							uint32_t position, bool is_dsp, bool is_monitor, bool is_control)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct port *port = GET_PORT(this, direction, port_id);
 | 
						struct port *port = GET_PORT(this, direction, port_id);
 | 
				
			||||||
	const char *name;
 | 
						const char *name;
 | 
				
			||||||
| 
						 | 
					@ -328,10 +334,17 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p
 | 
				
			||||||
		port->blocks = 1;
 | 
							port->blocks = 1;
 | 
				
			||||||
		port->stride = 4;
 | 
							port->stride = 4;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						port->is_control = is_control;
 | 
				
			||||||
 | 
						if (port->is_control) {
 | 
				
			||||||
 | 
							port->format.media_type = SPA_MEDIA_TYPE_application;
 | 
				
			||||||
 | 
							port->format.media_subtype = SPA_MEDIA_SUBTYPE_control;
 | 
				
			||||||
 | 
							port->blocks = 1;
 | 
				
			||||||
 | 
							port->stride = 1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	spa_list_init(&port->queue);
 | 
						spa_list_init(&port->queue);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_info(this->log, "%p: add port %d:%d position:%s %d %d",
 | 
						spa_log_info(this->log, "%p: add port %d:%d position:%s %d %d %d",
 | 
				
			||||||
			this, direction, port_id, port->position, is_dsp, is_monitor);
 | 
								this, direction, port_id, port->position, is_dsp, is_monitor, is_control);
 | 
				
			||||||
	emit_port_info(this, port, true);
 | 
						emit_port_info(this, port, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -858,7 +871,7 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode mode,
 | 
					static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode mode,
 | 
				
			||||||
		enum spa_direction direction, bool monitor, struct spa_audio_info *info)
 | 
							enum spa_direction direction, bool monitor, bool control, struct spa_audio_info *info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct dir *dir;
 | 
						struct dir *dir;
 | 
				
			||||||
	uint32_t i;
 | 
						uint32_t i;
 | 
				
			||||||
| 
						 | 
					@ -866,6 +879,7 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
 | 
				
			||||||
	dir = &this->dir[direction];
 | 
						dir = &this->dir[direction];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (dir->have_profile && this->monitor == monitor && dir->mode == mode &&
 | 
						if (dir->have_profile && this->monitor == monitor && dir->mode == mode &&
 | 
				
			||||||
 | 
						    dir->control == control &&
 | 
				
			||||||
	    (info == NULL || memcmp(&dir->format, info, sizeof(*info)) == 0))
 | 
						    (info == NULL || memcmp(&dir->format, info, sizeof(*info)) == 0))
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -879,6 +893,7 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->monitor = monitor;
 | 
						this->monitor = monitor;
 | 
				
			||||||
 | 
						dir->control = control;
 | 
				
			||||||
	dir->have_profile = true;
 | 
						dir->have_profile = true;
 | 
				
			||||||
	dir->mode = mode;
 | 
						dir->mode = mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -899,10 +914,10 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
 | 
				
			||||||
			this->dir[SPA_DIRECTION_OUTPUT].n_ports = dir->n_ports + 1;
 | 
								this->dir[SPA_DIRECTION_OUTPUT].n_ports = dir->n_ports + 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (i = 0; i < dir->n_ports; i++) {
 | 
							for (i = 0; i < dir->n_ports; i++) {
 | 
				
			||||||
			init_port(this, direction, i, info->info.raw.position[i], true, false);
 | 
								init_port(this, direction, i, info->info.raw.position[i], true, false, false);
 | 
				
			||||||
			if (this->monitor && direction == SPA_DIRECTION_INPUT)
 | 
								if (this->monitor && direction == SPA_DIRECTION_INPUT)
 | 
				
			||||||
				init_port(this, SPA_DIRECTION_OUTPUT, i+1,
 | 
									init_port(this, SPA_DIRECTION_OUTPUT, i+1,
 | 
				
			||||||
					info->info.raw.position[i], true, true);
 | 
										info->info.raw.position[i], true, true, false);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -910,7 +925,7 @@ static int reconfigure_mode(struct impl *this, enum spa_param_port_config_mode m
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		dir->n_ports = 1;
 | 
							dir->n_ports = 1;
 | 
				
			||||||
		dir->have_format = false;
 | 
							dir->have_format = false;
 | 
				
			||||||
		init_port(this, direction, 0, 0, false, false);
 | 
							init_port(this, direction, 0, 0, false, false, false);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
| 
						 | 
					@ -941,7 +956,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
		struct spa_pod *format = NULL;
 | 
							struct spa_pod *format = NULL;
 | 
				
			||||||
		enum spa_direction direction;
 | 
							enum spa_direction direction;
 | 
				
			||||||
		enum spa_param_port_config_mode mode;
 | 
							enum spa_param_port_config_mode mode;
 | 
				
			||||||
		bool monitor = false;
 | 
							bool monitor = false, control = false;
 | 
				
			||||||
		int res;
 | 
							int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (spa_pod_parse_object(param,
 | 
							if (spa_pod_parse_object(param,
 | 
				
			||||||
| 
						 | 
					@ -949,6 +964,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
				SPA_PARAM_PORT_CONFIG_direction,	SPA_POD_Id(&direction),
 | 
									SPA_PARAM_PORT_CONFIG_direction,	SPA_POD_Id(&direction),
 | 
				
			||||||
				SPA_PARAM_PORT_CONFIG_mode,		SPA_POD_Id(&mode),
 | 
									SPA_PARAM_PORT_CONFIG_mode,		SPA_POD_Id(&mode),
 | 
				
			||||||
				SPA_PARAM_PORT_CONFIG_monitor,		SPA_POD_OPT_Bool(&monitor),
 | 
									SPA_PARAM_PORT_CONFIG_monitor,		SPA_POD_OPT_Bool(&monitor),
 | 
				
			||||||
 | 
									SPA_PARAM_PORT_CONFIG_control,		SPA_POD_OPT_Bool(&control),
 | 
				
			||||||
				SPA_PARAM_PORT_CONFIG_format,		SPA_POD_OPT_Pod(&format)) < 0)
 | 
									SPA_PARAM_PORT_CONFIG_format,		SPA_POD_OPT_Pod(&format)) < 0)
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -969,7 +985,7 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
 | 
				
			||||||
			infop = &info;
 | 
								infop = &info;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((res = reconfigure_mode(this, mode, direction, monitor, infop)) < 0)
 | 
							if ((res = reconfigure_mode(this, mode, direction, monitor, control, infop)) < 0)
 | 
				
			||||||
			return res;
 | 
								return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		emit_node_info(this, false);
 | 
							emit_node_info(this, false);
 | 
				
			||||||
| 
						 | 
					@ -1456,6 +1472,11 @@ static int port_enum_formats(void *object,
 | 
				
			||||||
			info.format = SPA_AUDIO_FORMAT_DSP_F32;
 | 
								info.format = SPA_AUDIO_FORMAT_DSP_F32;
 | 
				
			||||||
			*param = spa_format_audio_dsp_build(builder,
 | 
								*param = spa_format_audio_dsp_build(builder,
 | 
				
			||||||
				SPA_PARAM_EnumFormat, &info);
 | 
									SPA_PARAM_EnumFormat, &info);
 | 
				
			||||||
 | 
							} else if (PORT_IS_CONTROL(this, direction, port_id)) {
 | 
				
			||||||
 | 
								*param = spa_pod_builder_add_object(builder,
 | 
				
			||||||
 | 
									SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
 | 
				
			||||||
 | 
									SPA_FORMAT_mediaType,      SPA_POD_Id(SPA_MEDIA_TYPE_application),
 | 
				
			||||||
 | 
									SPA_FORMAT_mediaSubtype,   SPA_POD_Id(SPA_MEDIA_SUBTYPE_control));
 | 
				
			||||||
		} else if (port->have_format) {
 | 
							} else if (port->have_format) {
 | 
				
			||||||
			*param = spa_format_audio_raw_build(builder,
 | 
								*param = spa_format_audio_raw_build(builder,
 | 
				
			||||||
				SPA_PARAM_EnumFormat, &this->dir[direction].format.info.raw);
 | 
									SPA_PARAM_EnumFormat, &this->dir[direction].format.info.raw);
 | 
				
			||||||
| 
						 | 
					@ -1551,6 +1572,11 @@ impl_node_port_enum_params(void *object, int seq,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (PORT_IS_DSP(this, direction, port_id))
 | 
							if (PORT_IS_DSP(this, direction, port_id))
 | 
				
			||||||
			param = spa_format_audio_dsp_build(&b, id, &port->format.info.dsp);
 | 
								param = spa_format_audio_dsp_build(&b, id, &port->format.info.dsp);
 | 
				
			||||||
 | 
							else if (PORT_IS_CONTROL(this, direction, port_id))
 | 
				
			||||||
 | 
								param = spa_pod_builder_add_object(&b,
 | 
				
			||||||
 | 
									SPA_TYPE_OBJECT_Format,  id,
 | 
				
			||||||
 | 
									SPA_FORMAT_mediaType,    SPA_POD_Id(SPA_MEDIA_TYPE_application),
 | 
				
			||||||
 | 
									SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control));
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			param = spa_format_audio_raw_build(&b, id, &port->format.info.raw);
 | 
								param = spa_format_audio_raw_build(&b, id, &port->format.info.raw);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -1738,6 +1764,16 @@ static int port_set_format(void *object,
 | 
				
			||||||
			port->blocks = 1;
 | 
								port->blocks = 1;
 | 
				
			||||||
			port->stride = 4;
 | 
								port->stride = 4;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							else if (PORT_IS_CONTROL(this, direction, port_id)) {
 | 
				
			||||||
 | 
								if (info.media_type != SPA_MEDIA_TYPE_application ||
 | 
				
			||||||
 | 
								    info.media_subtype != SPA_MEDIA_SUBTYPE_control) {
 | 
				
			||||||
 | 
									spa_log_error(this->log, "unexpected types %d/%d",
 | 
				
			||||||
 | 
											info.media_type, info.media_subtype);
 | 
				
			||||||
 | 
									return -EINVAL;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								port->blocks = 1;
 | 
				
			||||||
 | 
								port->stride = 1;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			if (info.media_type != SPA_MEDIA_TYPE_audio ||
 | 
								if (info.media_type != SPA_MEDIA_TYPE_audio ||
 | 
				
			||||||
			    info.media_subtype != SPA_MEDIA_SUBTYPE_raw) {
 | 
								    info.media_subtype != SPA_MEDIA_SUBTYPE_raw) {
 | 
				
			||||||
| 
						 | 
					@ -2048,30 +2084,41 @@ static int impl_node_process(void *object)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (buf == NULL) {
 | 
							if (buf == NULL) {
 | 
				
			||||||
			for (j = 0; j < port->blocks; j++) {
 | 
								for (j = 0; j < port->blocks; j++) {
 | 
				
			||||||
				remap = dir->src_remap[n_src_datas++];
 | 
									if (port->is_control) {
 | 
				
			||||||
				src_datas[remap] = SPA_PTR_ALIGN(this->empty, MAX_ALIGN, void);
 | 
										spa_log_trace_fp(this->log, "%p: empty control %d", this,
 | 
				
			||||||
				spa_log_trace_fp(this->log, "%p: empty input %d->%d", this,
 | 
												i * port->blocks + j);
 | 
				
			||||||
						i * port->blocks + j, remap);
 | 
									} else {
 | 
				
			||||||
				max_in = SPA_MIN(max_in, this->empty_size / port->stride);
 | 
										remap = dir->src_remap[n_src_datas++];
 | 
				
			||||||
 | 
										src_datas[remap] = SPA_PTR_ALIGN(this->empty, MAX_ALIGN, void);
 | 
				
			||||||
 | 
										spa_log_trace_fp(this->log, "%p: empty input %d->%d", this,
 | 
				
			||||||
 | 
												i * port->blocks + j, remap);
 | 
				
			||||||
 | 
										max_in = SPA_MIN(max_in, this->empty_size / port->stride);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			in_avail = true;
 | 
								in_avail = true;
 | 
				
			||||||
			for (j = 0; j < port->blocks; j++) {
 | 
								for (j = 0; j < port->blocks; j++) {
 | 
				
			||||||
				uint32_t offs, size;
 | 
									uint32_t offs, size;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				remap = dir->src_remap[n_src_datas++];
 | 
					 | 
				
			||||||
				bd = &buf->buf->datas[j];
 | 
									bd = &buf->buf->datas[j];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				offs = SPA_MIN(bd->chunk->offset, bd->maxsize);
 | 
									offs = SPA_MIN(bd->chunk->offset, bd->maxsize);
 | 
				
			||||||
				size = SPA_MIN(bd->maxsize - offs, bd->chunk->size);
 | 
									size = SPA_MIN(bd->maxsize - offs, bd->chunk->size);
 | 
				
			||||||
				max_in = SPA_MIN(max_in, size / port->stride);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				offs += this->in_offset * port->stride;
 | 
									if (port->is_control) {
 | 
				
			||||||
				src_datas[remap] = SPA_PTROFF(bd->data, offs, void);
 | 
										spa_log_trace_fp(this->log, "%p: control %d", this,
 | 
				
			||||||
 | 
												i * port->blocks + j);
 | 
				
			||||||
 | 
									} else  {
 | 
				
			||||||
 | 
										max_in = SPA_MIN(max_in, size / port->stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				spa_log_trace_fp(this->log, "%p: input %d:%d:%d %d %d %d->%d", this,
 | 
										remap = dir->src_remap[n_src_datas++];
 | 
				
			||||||
						offs, size, port->stride, this->in_offset, max_in,
 | 
										offs += this->in_offset * port->stride;
 | 
				
			||||||
						i * port->blocks + j, remap);
 | 
										src_datas[remap] = SPA_PTROFF(bd->data, offs, void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										spa_log_trace_fp(this->log, "%p: input %d:%d:%d %d %d %d->%d", this,
 | 
				
			||||||
 | 
												offs, size, port->stride, this->in_offset, max_in,
 | 
				
			||||||
 | 
												i * port->blocks + j, remap);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -2154,6 +2201,8 @@ static int impl_node_process(void *object)
 | 
				
			||||||
					remap = n_mon_datas++;
 | 
										remap = n_mon_datas++;
 | 
				
			||||||
					spa_log_trace_fp(this->log, "%p: empty monitor %d", this,
 | 
										spa_log_trace_fp(this->log, "%p: empty monitor %d", this,
 | 
				
			||||||
						remap);
 | 
											remap);
 | 
				
			||||||
 | 
									} else if (port->is_control) {
 | 
				
			||||||
 | 
										spa_log_trace_fp(this->log, "%p: empty control %d", this, j);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					remap = dir->dst_remap[n_dst_datas++];
 | 
										remap = dir->dst_remap[n_dst_datas++];
 | 
				
			||||||
					dst_datas[remap] = SPA_PTR_ALIGN(this->scratch, MAX_ALIGN, void);
 | 
										dst_datas[remap] = SPA_PTR_ALIGN(this->scratch, MAX_ALIGN, void);
 | 
				
			||||||
| 
						 | 
					@ -2191,6 +2240,8 @@ static int impl_node_process(void *object)
 | 
				
			||||||
					io->status = SPA_STATUS_HAVE_DATA;
 | 
										io->status = SPA_STATUS_HAVE_DATA;
 | 
				
			||||||
					io->buffer_id = buf->id;
 | 
										io->buffer_id = buf->id;
 | 
				
			||||||
					res |= SPA_STATUS_HAVE_DATA;
 | 
										res |= SPA_STATUS_HAVE_DATA;
 | 
				
			||||||
 | 
									} else if (port->is_control) {
 | 
				
			||||||
 | 
										spa_log_trace_fp(this->log, "%p: control %d", this, j);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					remap = dir->dst_remap[n_dst_datas++];
 | 
										remap = dir->dst_remap[n_dst_datas++];
 | 
				
			||||||
					dst_datas[remap] = SPA_PTROFF(bd->data,
 | 
										dst_datas[remap] = SPA_PTROFF(bd->data,
 | 
				
			||||||
| 
						 | 
					@ -2271,10 +2322,12 @@ static int impl_node_process(void *object)
 | 
				
			||||||
		/* return input buffers */
 | 
							/* return input buffers */
 | 
				
			||||||
		for (i = 0; i < dir->n_ports; i++) {
 | 
							for (i = 0; i < dir->n_ports; i++) {
 | 
				
			||||||
			port = GET_IN_PORT(this, i);
 | 
								port = GET_IN_PORT(this, i);
 | 
				
			||||||
			if ((io = port->io) != NULL) {
 | 
								if (port->is_control)
 | 
				
			||||||
				spa_log_trace_fp(this->log, "return: input %d %d", port->id, io->buffer_id);
 | 
									continue;
 | 
				
			||||||
				io->status = SPA_STATUS_NEED_DATA;
 | 
								if (SPA_UNLIKELY((io = port->io) == NULL))
 | 
				
			||||||
			}
 | 
									continue;
 | 
				
			||||||
 | 
								spa_log_trace_fp(this->log, "return: input %d %d", port->id, io->buffer_id);
 | 
				
			||||||
 | 
								io->status = SPA_STATUS_NEED_DATA;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		this->in_offset = 0;
 | 
							this->in_offset = 0;
 | 
				
			||||||
		max_in = 0;
 | 
							max_in = 0;
 | 
				
			||||||
| 
						 | 
					@ -2286,16 +2339,14 @@ static int impl_node_process(void *object)
 | 
				
			||||||
		/* queue output buffers */
 | 
							/* queue output buffers */
 | 
				
			||||||
		for (i = 0; i < dir->n_ports; i++) {
 | 
							for (i = 0; i < dir->n_ports; i++) {
 | 
				
			||||||
			port = GET_OUT_PORT(this, i);
 | 
								port = GET_OUT_PORT(this, i);
 | 
				
			||||||
			if (port->is_monitor)
 | 
								if (port->is_monitor || port->is_control)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
 | 
					 | 
				
			||||||
			buf = out_bufs[i];
 | 
					 | 
				
			||||||
			if (buf == NULL)
 | 
					 | 
				
			||||||
				continue;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (SPA_UNLIKELY((io = port->io) == NULL))
 | 
								if (SPA_UNLIKELY((io = port->io) == NULL))
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if ((buf = out_bufs[i]) == NULL)
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			dequeue_buffer(this, port, buf);
 | 
								dequeue_buffer(this, port, buf);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for (j = 0; j < port->blocks; j++) {
 | 
								for (j = 0; j < port->blocks; j++) {
 | 
				
			||||||
| 
						 | 
					@ -2313,7 +2364,7 @@ static int impl_node_process(void *object)
 | 
				
			||||||
	if (n_samples == 0 && this->peaks) {
 | 
						if (n_samples == 0 && this->peaks) {
 | 
				
			||||||
		for (i = 0; i < dir->n_ports; i++) {
 | 
							for (i = 0; i < dir->n_ports; i++) {
 | 
				
			||||||
			port = GET_OUT_PORT(this, i);
 | 
								port = GET_OUT_PORT(this, i);
 | 
				
			||||||
			if (port->is_monitor)
 | 
								if (port->is_monitor || port->is_control)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			if (SPA_UNLIKELY((io = port->io) == NULL))
 | 
								if (SPA_UNLIKELY((io = port->io) == NULL))
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
| 
						 | 
					@ -2476,8 +2527,8 @@ impl_init(const struct spa_handle_factory *factory,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->rate_scale = 1.0;
 | 
						this->rate_scale = 1.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	reconfigure_mode(this, SPA_PARAM_PORT_CONFIG_MODE_convert, SPA_DIRECTION_INPUT, false, NULL);
 | 
						reconfigure_mode(this, SPA_PARAM_PORT_CONFIG_MODE_convert, SPA_DIRECTION_INPUT, false, false, NULL);
 | 
				
			||||||
	reconfigure_mode(this, SPA_PARAM_PORT_CONFIG_MODE_convert, SPA_DIRECTION_OUTPUT, false, NULL);
 | 
						reconfigure_mode(this, SPA_PARAM_PORT_CONFIG_MODE_convert, SPA_DIRECTION_OUTPUT, false, false, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue