mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05: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()) {
|
switch (cid.type()) {
|
||||||
case ControlTypeBool: {
|
case ControlTypeBool: {
|
||||||
bool def;
|
auto min = cinfo.min().get<bool>();
|
||||||
if (cinfo.def().isNone())
|
auto max = cinfo.max().get<bool>();
|
||||||
def = cinfo.min().get<bool>();
|
auto def = !cinfo.def().isNone()
|
||||||
else
|
? cinfo.def().get<bool>()
|
||||||
def = cinfo.def().get<bool>();
|
: min;
|
||||||
|
spa_pod_frame f;
|
||||||
|
|
||||||
spa_pod_builder_add(&b,
|
spa_pod_builder_prop(&b, SPA_PROP_INFO_type, 0);
|
||||||
SPA_PROP_INFO_type, SPA_POD_CHOICE_Bool(
|
spa_pod_builder_push_choice(&b, &f, SPA_CHOICE_Enum, 0);
|
||||||
def),
|
spa_pod_builder_bool(&b, def);
|
||||||
0);
|
spa_pod_builder_bool(&b, min);
|
||||||
|
if (max != min)
|
||||||
|
spa_pod_builder_bool(&b, max);
|
||||||
|
spa_pod_builder_pop(&b, &f);
|
||||||
} break;
|
} break;
|
||||||
case ControlTypeFloat: {
|
case ControlTypeFloat: {
|
||||||
float min = cinfo.min().get<float>();
|
float min = cinfo.min().get<float>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue