From 5c180a57a5c30f8ec65ecb455c2419a7a66ff59a Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 2 Mar 2023 11:55:04 +0100 Subject: [PATCH] audioconvert: copy follower port flags Copy the follower port flags to the adapter ports. This is mostly interesting to mark the ports of a device as physical and terminal. --- spa/plugins/audioconvert/audioadapter.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index cdfac716d..a0b2fe82e 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -48,14 +48,14 @@ struct impl { struct spa_node *follower; struct spa_hook follower_listener; - uint32_t follower_flags; + uint64_t follower_flags; struct spa_audio_info follower_current_format; struct spa_audio_info default_format; struct spa_handle *hnd_convert; struct spa_node *convert; struct spa_hook convert_listener; - uint32_t convert_flags; + uint64_t convert_flags; uint32_t n_buffers; struct spa_buffer **buffers; @@ -78,6 +78,7 @@ struct impl { struct spa_param_info params[N_NODE_PARAMS]; uint32_t convert_params_flags[N_NODE_PARAMS]; uint32_t follower_params_flags[N_NODE_PARAMS]; + uint64_t follower_port_flags; struct spa_hook_list hooks; struct spa_callbacks callbacks; @@ -352,7 +353,7 @@ static int negotiate_buffers(struct impl *this) uint32_t i, size, buffers, blocks, align, flags, stride = 0; uint32_t *aligns; struct spa_data *datas; - uint32_t follower_flags, conv_flags; + uint64_t follower_flags, conv_flags; spa_log_debug(this->log, "%p: n_buffers:%d", this, this->n_buffers); @@ -932,12 +933,19 @@ static void convert_port_info(void *data, const struct spa_port_info *info) { struct impl *this = data; + struct spa_port_info pi; if (direction != this->direction) { + /* skip the converter output port into the follower */ if (port_id == 0) return; else + /* the monitor ports are exposed */ port_id--; + } else if (info) { + pi = *info; + pi.flags = this->follower_port_flags; + info = π } spa_log_debug(this->log, "%p: port info %d:%d", this, @@ -1086,6 +1094,11 @@ static void follower_port_info(void *data, return; } + this->follower_port_flags = info->flags & + (SPA_PORT_FLAG_LIVE | + SPA_PORT_FLAG_PHYSICAL | + SPA_PORT_FLAG_TERMINAL); + spa_log_debug(this->log, "%p: follower port info %s %p %08"PRIx64, this, this->direction == SPA_DIRECTION_INPUT ? "Input" : "Output", info, info->change_mask);