Support libcamera's new SensorConfiguration #560
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds support for the new SensorConfiguration within libcamera's CameraConfiguration object. We have to use this now to force the choice of particular sensor modes in case of future extensions where the raw stream format is no longer sufficient.
There are quite a few changes:
We now populate the list of sensor modes always, even when no framerate was given. Though we don't fill in the mode's framerate unless that's going to be something we use to select the mode.
The selectModeForFramerate function has been generalised and turned into selectMode. This now supports mode selection based on width, height, bitrate as well as (optionally) framerate.
Raw streams are always requested now, as this means we always get the same buffer management behaviour. It also simplifies the code slightly.
We always fill in a Mode structure (using the user's values if given) that we can pass to the amended selectMode function. This will return the correct sensor mode for us, that we can use to program the SensorConfiguration. So a SensorConfiguration is now always supplied to libcamera.
Everywhere where the code was running through the available modes and configuring them, it has been amended to program the SensorConfiguration too - otherwise you may not be able to get non-default bit-depths. To make this easier, the SensorMode class has been made public.
The "rawfull" option has been removed. It was only ever a temporary hack from the very early days, and trying to keep it seems to add more complexity that would be warranted.