[libcamera-devel] [PATCH v2 2/3] android: CameraDevice: Log rotation variables in camera3_stream

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Mar 29 06:31:26 CEST 2021


Hi Hiro,

Thank you for the patch.

On Mon, Mar 29, 2021 at 07:45:27AM +0900, Hirokazu Honda wrote:
> |rotation| and |crop_rotate_scale_degrees| are important info of
> a configuration. They should be logged.
> 
> Signed-off-by: Hirokazu Honda <hiroh at chromium.org>
> Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
> ---
>  src/android/camera_device.cpp | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index c5e55a18..d3368b19 100644
> --- a/src/android/camera_device.cpp
> +++ b/src/android/camera_device.cpp
> @@ -256,6 +256,20 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,
>  	unsortedConfigs = sortedConfigs;
>  }
> 
> +const char *rotationToString(int rotation)
> +{
> +	switch (rotation) {
> +	case CAMERA3_STREAM_ROTATION_0:
> +		return "ROTATION_0";
> +	case CAMERA3_STREAM_ROTATION_90:
> +		return "ROTATION_90";
> +	case CAMERA3_STREAM_ROTATION_180:
> +		return "ROTATION_180";
> +	case CAMERA3_STREAM_ROTATION_270:
> +		return "ROTATION_270";
> +	}
> +	return "ROTATION_INVALID";

How about dropping the ROTATION_ prefix in all of these ? The lines
printed to describe each stream are long enough already.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> +}
>  /*
>   * Returns where crop_rotate_scale_degrees in all camera3_stream in stream_list
>   * are valid.
> @@ -1625,6 +1639,9 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
>  			       << ", width: " << stream->width
>  			       << ", height: " << stream->height
>  			       << ", format: " << utils::hex(stream->format)
> +			       << ", rotation: " << rotationToString(stream->rotation)
> +			       << ", crop_rotate_scale_degrees: "
> +			       << rotationToString(stream->crop_rotate_scale_degrees)
>  			       << " (" << format.toString() << ")";
> 
>  		if (!format.isValid())

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list