mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: libcamera: source: use dynamic builder for controls
Use a dynamic spa pod builder when enumerating controls since previous
changes can report more information from any given control. Also increase
the stack buffer size to 4096 bytes.
(cherry picked from commit e6f767d41d)
This commit is contained in:
parent
dbc376fc2f
commit
d76fee1353
1 changed files with 10 additions and 5 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include <spa/param/param.h>
|
||||
#include <spa/param/latency-utils.h>
|
||||
#include <spa/control/control.h>
|
||||
#include <spa/pod/dynamic.h>
|
||||
#include <spa/pod/filter.h>
|
||||
|
||||
#include <libcamera/camera.h>
|
||||
|
|
@ -882,8 +883,9 @@ spa_libcamera_enum_controls(struct impl *impl, struct port *port, int seq,
|
|||
const struct spa_pod *filter)
|
||||
{
|
||||
const ControlInfoMap &info = impl->camera->controls();
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b = { 0 };
|
||||
spa_auto(spa_pod_dynamic_builder) b = {};
|
||||
spa_pod_builder_state state;
|
||||
uint8_t buffer[4096];
|
||||
spa_result_node_params result = {
|
||||
.id = SPA_PARAM_PropInfo,
|
||||
};
|
||||
|
|
@ -892,18 +894,21 @@ spa_libcamera_enum_controls(struct impl *impl, struct port *port, int seq,
|
|||
for (auto skip = start - offset; skip && it != info.end(); skip--)
|
||||
it++;
|
||||
|
||||
spa_pod_dynamic_builder_init(&b, buffer, sizeof(buffer), 4096);
|
||||
spa_pod_builder_get_state(&b.b, &state);
|
||||
|
||||
for (result.index = start; num > 0 && it != info.end(); ++it, result.index++) {
|
||||
spa_log_debug(impl->log, "%p: controls[%" PRIu32 "]: %s::%s",
|
||||
impl, result.index, it->first->vendor().c_str(),
|
||||
it->first->name().c_str());
|
||||
|
||||
spa_pod_builder_init(&b, buffer, sizeof(buffer));
|
||||
spa_pod_builder_reset(&b.b, &state);
|
||||
|
||||
const auto *ctrl = control_details_to_pod(b, *it->first, it->second);
|
||||
const auto *ctrl = control_details_to_pod(b.b, *it->first, it->second);
|
||||
if (!ctrl)
|
||||
continue;
|
||||
|
||||
if (spa_pod_filter(&b, &result.param, ctrl, filter) < 0)
|
||||
if (spa_pod_filter(&b.b, &result.param, ctrl, filter) < 0)
|
||||
continue;
|
||||
|
||||
result.next = result.index + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue