diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 7783a943d..36b299aca 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -108,6 +108,30 @@ struct impl { /** \endcond */ +static void follower_enum_params(struct impl *this, + uint32_t id, + uint32_t idx, + struct spa_result_node_params *result, + const struct spa_pod *filter, + struct spa_pod_builder *builder, + int *res) +{ + if (result->next < 0x10000) { + if ((*res = spa_node_enum_params_sync(this->convert, + id, &result->next, filter, &result->param, builder)) == 1) + return; + result->next = 0x10000; + } + if (result->next >= 0x10000 && this->follower_params_flags[idx] & SPA_PARAM_INFO_READ) { + result->next &= 0xffff; + if ((*res = spa_node_enum_params_sync(this->follower, + id, &result->next, filter, &result->param, builder)) == 1) { + result->next |= 0x10000; + return; + } + } +} + static int impl_node_enum_params(void *object, int seq, uint32_t id, uint32_t start, uint32_t num, const struct spa_pod *filter) @@ -137,25 +161,20 @@ next: res = spa_node_enum_params(this->convert, seq, id, start, num, filter); return res; case SPA_PARAM_PropInfo: - case SPA_PARAM_Props: - case SPA_PARAM_ProcessLatency: - { - if (result.next < 0x10000) { - if ((res = spa_node_enum_params_sync(this->convert, - id, &result.next, filter, &result.param, &b)) == 1) - break; - result.next = 0x10000; - } - if (result.next >= 0x10000) { - result.next &= 0xffff; - if ((res = spa_node_enum_params_sync(this->follower, - id, &result.next, filter, &result.param, &b)) == 1) { - result.next |= 0x10000; - break; - } - } + follower_enum_params(this, id, IDX_PropInfo, &result, filter, &b, &res); + if (res == 1) + break; + return res; + case SPA_PARAM_Props: + follower_enum_params(this, id, IDX_Props, &result, filter, &b, &res); + if (res == 1) + break; + return res; + case SPA_PARAM_ProcessLatency: + follower_enum_params(this, id, IDX_ProcessLatency, &result, filter, &b, &res); + if (res == 1) + break; return res; - } case SPA_PARAM_EnumFormat: case SPA_PARAM_Format: case SPA_PARAM_Latency: