libcamera: camera_sensor: Relax restriction on sizes

The CameraSensor class assumes that camera sensors support the exact
same list of sizes of all media bus codes. While allowing a simpler API,
this assumption is incorrect and is blocking usage of some camera

Relaxing the constraint is possible without changes to the CameraSensor
API syntax, but requires changing its semantics. The sizes() function
now returns the list of all sizes for all media bus codes, and the
getFormat() function now searches in all supported media bus codes. The
former is likely not the most useful option for pipeline handlers, but
the sizes() function is currently unused. Designing a better API will
require inspecting current and expected future use cases in pipeline
handlers to determine proper heuristics.

While at it, fix a small typo in an unrelated comment.

Signed-off-by: Laurent Pinchart <>
Reviewed-by: Niklas Söderlund <>
2 files changed