spa: libcamera: source: use union for transferring control value

Use a union since only one member is active at a time, and use the
proper `libcamera::ControlType` enum to store the type instead of a
bare number. Also remove an unnecessary cast.

(cherry picked from commit 0022fc90b7)
This commit is contained in:
Barnabás Pőcze 2025-07-12 18:53:35 +02:00 committed by Robert Mader
parent 8181e2e051
commit 7414d948ad

View file

@ -861,11 +861,13 @@ enum_end:
}
struct val {
uint32_t type;
float f_val;
int32_t i_val;
bool b_val;
ControlType type;
uint32_t id;
union {
bool b_val;
int32_t i_val;
float f_val;
};
};
static int do_update_ctrls(struct spa_loop *loop,
@ -885,7 +887,7 @@ static int do_update_ctrls(struct spa_loop *loop,
impl->ctrls.set(d->id, d->f_val);
break;
case ControlTypeInteger32:
impl->ctrls.set(d->id, (int32_t)d->i_val);
impl->ctrls.set(d->id, d->i_val);
break;
default:
break;