[libcamera-devel] read/write ControlValue of type Span

Christian Rauch Rauch.Christian at gmx.de
Sun Mar 13 19:59:36 CET 2022


Hello,

I am encountering issues with ControlValue that stores a "Span". An
example for this is "FrameDurationLimits" which is defined as
"Control<Span<const int64_t>>".

tl;dr, How do I:
1. detect if a "ControlValue" is storing a "Span"?
2. read the def/min/max values from a "Control<Span<>>"?
3. set the value of a ControlValue for a ControlList?

The 'ControlValue' class implements two 'get' methods:
- a "scalar" version, defined if "!details::is_span<T>::value"
- an "array" version, defined if "details::is_span<T>::value"

Both implementations are also further guarded by an `assert(!isArray_)`
and `assert(isArray_)`, respectively.
This assumes that if "is_span<T>" is false (scalar version) then
"isArray_" is supposed to be false too. Vice versa, if "is_span<T>" is
true (array version) then "isArray_" is supposed to be true, too.

However, it seems that "Span" types do not set "isArray_" correctly. If
I try reading the default (def) value from a "FrameDurationLimits" via
"Span<const int64_t> v = info.def().get<Span<const int64_t>>();", then
the assertion is triggered because "isArray_" is apparently false.

See also https://bugs.libcamera.org/show_bug.cgi?id=101 for an example
that reproduced this on a Raspberry Pi with the OV5647.

I also noticed that the def/min/max values can have different types,
e.g. for the "FrameDurationLimits" "def" is "ControlTypeInteger32" while
min and max are "ControlTypeInteger64". Additionally, the default value
can be outside the min/max range. Is this intended?

Best,
Christian



More information about the libcamera-devel mailing list