mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
spa: libcamera: source: rework bool control type info
`SPA_POD_CHOICE_Bool()` assumes that both true and false are available, which may not be the case for libcamera controls, so manualy construct the enumerated choice object and only add the actually available options.
This commit is contained in:
parent
44c05cfa7b
commit
66cc01ee2d
1 changed files with 13 additions and 9 deletions
|
|
@ -755,16 +755,20 @@ spa_pod *control_details_to_pod(spa_pod_builder& b,
|
|||
|
||||
switch (cid.type()) {
|
||||
case ControlTypeBool: {
|
||||
bool def;
|
||||
if (cinfo.def().isNone())
|
||||
def = cinfo.min().get<bool>();
|
||||
else
|
||||
def = cinfo.def().get<bool>();
|
||||
auto min = cinfo.min().get<bool>();
|
||||
auto max = cinfo.max().get<bool>();
|
||||
auto def = !cinfo.def().isNone()
|
||||
? cinfo.def().get<bool>()
|
||||
: min;
|
||||
spa_pod_frame f;
|
||||
|
||||
spa_pod_builder_add(&b,
|
||||
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(
|
||||
def),
|
||||
0);
|
||||
spa_pod_builder_prop(&b, SPA_PROP_INFO_type, 0);
|
||||
spa_pod_builder_push_choice(&b, &f, SPA_CHOICE_Enum, 0);
|
||||
spa_pod_builder_bool(&b, def);
|
||||
spa_pod_builder_bool(&b, min);
|
||||
if (max != min)
|
||||
spa_pod_builder_bool(&b, max);
|
||||
spa_pod_builder_pop(&b, &f);
|
||||
} break;
|
||||
case ControlTypeFloat: {
|
||||
float min = cinfo.min().get<float>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue