mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-07-21 18:26:24 +00:00
params: count params per id from 0
Only increment the index when we find the requirested param, this makes the params go from index 0 to the last instead of starting at some random index. The random index is not really a problem but it is also no so nice.
This commit is contained in:
parent
f0328a1f8d
commit
552d4516b6
|
@ -419,16 +419,16 @@ static int enum_params(struct filter *d, struct spa_list *param_list, int seq,
|
|||
spa_list_for_each(p, param_list, link) {
|
||||
struct spa_pod *param;
|
||||
|
||||
result.index = result.next++;
|
||||
if (result.index < start)
|
||||
continue;
|
||||
|
||||
param = p->param;
|
||||
if (param == NULL || p->id != id)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
|
||||
result.index = result.next++;
|
||||
if (result.index < start)
|
||||
continue;
|
||||
|
||||
spa_pod_dynamic_builder_init(&b, buffer, sizeof(buffer), 4096);
|
||||
if (spa_pod_filter(&b.b, &result.param, param, filter) == 0) {
|
||||
spa_node_emit_result(&d->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
|
||||
|
|
|
@ -328,15 +328,18 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
|
|||
struct spa_pod_dynamic_builder b;
|
||||
struct spa_result_device_params result;
|
||||
uint32_t count = 0;
|
||||
bool found = false;
|
||||
|
||||
result.id = param_id;
|
||||
result.next = 0;
|
||||
|
||||
spa_list_for_each(p, &impl->param_list, link) {
|
||||
result.index = result.next++;
|
||||
if (p->id != param_id)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
|
||||
result.index = result.next++;
|
||||
if (result.index < index)
|
||||
continue;
|
||||
|
||||
|
@ -351,7 +354,7 @@ int pw_impl_device_for_each_param(struct pw_impl_device *device,
|
|||
if (count == max)
|
||||
break;
|
||||
}
|
||||
res = 0;
|
||||
res = found ? 0 : -ENOENT;
|
||||
} else {
|
||||
user_data.cache = impl->cache_params &&
|
||||
(filter == NULL && index == 0 && max == UINT32_MAX);
|
||||
|
|
|
@ -2015,15 +2015,18 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
|
|||
struct spa_pod_dynamic_builder b;
|
||||
struct spa_result_node_params result;
|
||||
uint32_t count = 0;
|
||||
bool found = false;
|
||||
|
||||
result.id = param_id;
|
||||
result.next = 0;
|
||||
|
||||
spa_list_for_each(p, &impl->param_list, link) {
|
||||
result.index = result.next++;
|
||||
if (p->id != param_id)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
|
||||
result.index = result.next++;
|
||||
if (result.index < index)
|
||||
continue;
|
||||
|
||||
|
@ -2039,7 +2042,7 @@ int pw_impl_node_for_each_param(struct pw_impl_node *node,
|
|||
if (count == max)
|
||||
break;
|
||||
}
|
||||
res = 0;
|
||||
res = found ? 0 : -ENOENT;
|
||||
} else {
|
||||
user_data.cache = impl->cache_params &&
|
||||
(filter == NULL && index == 0 && max == UINT32_MAX);
|
||||
|
|
|
@ -1248,15 +1248,18 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
|
|||
struct spa_pod_dynamic_builder b;
|
||||
struct spa_result_node_params result;
|
||||
uint32_t count = 0;
|
||||
bool found = false;
|
||||
|
||||
result.id = param_id;
|
||||
result.next = 0;
|
||||
|
||||
spa_list_for_each(p, &impl->param_list, link) {
|
||||
result.index = result.next++;
|
||||
if (p->id != param_id)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
|
||||
result.index = result.next++;
|
||||
if (result.index < index)
|
||||
continue;
|
||||
|
||||
|
@ -1272,7 +1275,7 @@ int pw_impl_port_for_each_param(struct pw_impl_port *port,
|
|||
if (count == max)
|
||||
break;
|
||||
}
|
||||
res = 0;
|
||||
res = found ? 0 : -ENOENT;
|
||||
} else {
|
||||
user_data.cache = impl->cache_params &&
|
||||
(filter == NULL && index == 0 && max == UINT32_MAX);
|
||||
|
|
|
@ -544,16 +544,16 @@ static int enum_params(void *object, bool is_port, int seq, uint32_t id, uint32_
|
|||
spa_list_for_each(p, &d->param_list, link) {
|
||||
struct spa_pod *param;
|
||||
|
||||
result.index = result.next++;
|
||||
if (result.index < start)
|
||||
continue;
|
||||
|
||||
param = p->param;
|
||||
if (param == NULL || p->id != id)
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
|
||||
result.index = result.next++;
|
||||
if (result.index < start)
|
||||
continue;
|
||||
|
||||
spa_pod_dynamic_builder_init(&b, buffer, sizeof(buffer), 4096);
|
||||
if (spa_pod_filter(&b.b, &result.param, param, filter) == 0) {
|
||||
spa_node_emit_result(&d->hooks, seq, 0, SPA_RESULT_TYPE_NODE_PARAMS, &result);
|
||||
|
|
Loading…
Reference in a new issue