mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-20 00:11:31 +00:00
audioconvert: listen for merger and channelmix for params
List all the params of the merger and resampler.
This commit is contained in:
parent
5d85e85ba7
commit
401e56699d
|
@ -451,6 +451,33 @@ static int setup_buffers(struct impl *this, enum spa_direction direction)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int enum_params(struct impl *this,
|
||||||
|
uint32_t id,
|
||||||
|
struct spa_result_node_params *result,
|
||||||
|
const struct spa_pod *filter,
|
||||||
|
struct spa_pod_builder *builder)
|
||||||
|
{
|
||||||
|
int res;
|
||||||
|
result->param = NULL;
|
||||||
|
result->next = result->index;
|
||||||
|
if (result->next < 0x1000) {
|
||||||
|
if (this->fmt[SPA_DIRECTION_INPUT] == this->merger &&
|
||||||
|
(res = spa_node_enum_params_sync(this->merger,
|
||||||
|
id, &result->next, filter, &result->param, builder)) == 1) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
result->next = 0x1000;
|
||||||
|
}
|
||||||
|
if (result->next >= 0x1000) {
|
||||||
|
result->next &= 0xfff;
|
||||||
|
if ((res = spa_node_enum_params_sync(this->channelmix,
|
||||||
|
id, &result->next, filter, &result->param, builder)) == 1) {
|
||||||
|
result->next |= 0x1000;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
static int impl_node_enum_params(void *object, int seq,
|
static int impl_node_enum_params(void *object, int seq,
|
||||||
uint32_t id, uint32_t start, uint32_t num,
|
uint32_t id, uint32_t start, uint32_t num,
|
||||||
const struct spa_pod *filter)
|
const struct spa_pod *filter)
|
||||||
|
@ -461,6 +488,7 @@ static int impl_node_enum_params(void *object, int seq,
|
||||||
uint8_t buffer[1024];
|
uint8_t buffer[1024];
|
||||||
struct spa_result_node_params result;
|
struct spa_result_node_params result;
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
int res;
|
||||||
|
|
||||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(num != 0, -EINVAL);
|
spa_return_val_if_fail(num != 0, -EINVAL);
|
||||||
|
@ -468,6 +496,7 @@ static int impl_node_enum_params(void *object, int seq,
|
||||||
result.id = id;
|
result.id = id;
|
||||||
result.next = start;
|
result.next = start;
|
||||||
next:
|
next:
|
||||||
|
res = 0;
|
||||||
result.index = result.next++;
|
result.index = result.next++;
|
||||||
|
|
||||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||||
|
@ -524,21 +553,23 @@ static int impl_node_enum_params(void *object, int seq,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPA_PARAM_PropInfo:
|
case SPA_PARAM_PropInfo:
|
||||||
return spa_node_enum_params(this->channelmix, seq, id, start, num, filter);
|
if ((res = enum_params(this, id, &result, filter, &b)) != 1)
|
||||||
|
return res;
|
||||||
|
break;
|
||||||
|
|
||||||
case SPA_PARAM_Props:
|
case SPA_PARAM_Props:
|
||||||
if (this->fmt[SPA_DIRECTION_INPUT] == this->merger)
|
if ((res = enum_params(this, id, &result, filter, &b)) != 1)
|
||||||
return spa_node_enum_params(this->merger, seq, id, start, num, filter);
|
return res;
|
||||||
else
|
break;
|
||||||
return spa_node_enum_params(this->channelmix, seq, id, start, num, filter);
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (res == 0) {
|
||||||
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
if (spa_pod_filter(&b, &result.param, param, filter) < 0)
|
||||||
goto next;
|
goto next;
|
||||||
|
}
|
||||||
spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
|
spa_node_emit_result(&this->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
|
||||||
|
|
||||||
if (++count != num)
|
if (++count != num)
|
||||||
|
@ -665,7 +696,7 @@ static const struct spa_node_events channelmix_events = {
|
||||||
.result = on_node_result,
|
.result = on_node_result,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct spa_node_events resample_events = {
|
static const struct spa_node_events proxy_events = {
|
||||||
SPA_VERSION_NODE_EVENTS,
|
SPA_VERSION_NODE_EVENTS,
|
||||||
.result = on_node_result,
|
.result = on_node_result,
|
||||||
};
|
};
|
||||||
|
@ -1378,8 +1409,8 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
|
|
||||||
spa_node_add_listener(this->channelmix,
|
spa_node_add_listener(this->channelmix,
|
||||||
&this->listener[0], &channelmix_events, this);
|
&this->listener[0], &channelmix_events, this);
|
||||||
spa_node_add_listener(this->resample,
|
spa_node_add_listener(this->merger,
|
||||||
&this->listener[1], &resample_events, this);
|
&this->listener[1], &proxy_events, this);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue