[libcamera-devel] [PATCH v2 1/3] android: camera_device: Prepare for none-mandatory formats

Jacopo Mondi jacopo at jmondi.org
Wed Jul 29 18:19:14 CEST 2020


Hi Niklas,

On Wed, Jul 29, 2020 at 01:12:00PM +0200, Niklas Söderlund wrote:
> When probing what formats a libcamera Camera supports we want to allow
> to probe for none-mandatory formats. Add a new flag to indicate if a

s/none/not

> format in camera3FormatsMap is mandatory or not.
>
> All current defined formats are mandatory.

Nice, this makes sense. In the future we might want to define if a
format is mandatory depending on the reported hw level, but at this
time this is a good step forward

Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j

>
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  src/android/camera_device.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index b49d6681e5a52d32..ce37fcb8cf5cd4b3 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -46,6 +46,7 @@ const std::vector<Size> camera3Resolutions = {
>   */
>  struct Camera3Format {
>  	std::vector<PixelFormat> libcameraFormats;
> +	bool mandatory;
>  	const char *name;
>  };
>
> @@ -57,11 +58,13 @@ const std::map<int, const Camera3Format> camera3FormatsMap = {
>  	{
>  		HAL_PIXEL_FORMAT_BLOB, {
>  			{ formats::MJPEG },
> +			true,
>  			"BLOB"
>  		}
>  	}, {
>  		HAL_PIXEL_FORMAT_YCbCr_420_888, {
>  			{ formats::NV12, formats::NV21 },
> +			true,
>  			"YCbCr_420_888"
>  		}
>  	}, {
> @@ -71,6 +74,7 @@ const std::map<int, const Camera3Format> camera3FormatsMap = {
>  		 */
>  		HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED, {
>  			{ formats::NV12, formats::NV21 },
> +			true,
>  			"IMPLEMENTATION_DEFINED"
>  		}
>  	},
> @@ -281,7 +285,7 @@ int CameraDevice::initializeStreamConfigurations()
>  				break;
>  			}
>  		}
> -		if (!mappedFormat.isValid()) {
> +		if (format.mandatory && !mappedFormat.isValid()) {
>  			LOG(HAL, Error) << "Failed to map Android format "
>  					<< camera3Format.name << " ("
>  					<< utils::hex(androidFormat) << ")";
> --
> 2.27.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list