[libcamera-devel,2/3] android: CameraDevice: Log rotation variables in camera3_stream
diff mbox series

Message ID 20210325051931.3748204-3-hiroh@chromium.org
State Superseded
Headers show
Series
  • Regard crop_rotate_scale_degrees in configuration
Related show

Commit Message

Hirokazu Honda March 25, 2021, 5:19 a.m. UTC
|rotation| and |crop_rotate_scale_degrees| are important info of
a configuration. They should be logged.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
---
 src/android/camera_device.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

--
2.31.0.291.g576ba9dcdaf-goog

Comments

Jacopo Mondi March 25, 2021, 10:51 a.m. UTC | #1
Hi Hiro,

On Thu, Mar 25, 2021 at 02:19:30PM +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@chromium.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 1414bfef..d24b0b23 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";
> +}
>  /*
>   *  verifyCropRotateScaleDegrees returns where |crop_rotate_scale_degrees| in
>   * all camera3_stream in stream_list are valid.
> @@ -1635,6 +1649,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)

Ok, we also have rotation, not only crop_rotate_scale_degrees /-.-\
headache++

for the patch
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j


>  			       << " (" << format.toString() << ")";
>
>  		if (!format.isValid())
> --
> 2.31.0.291.g576ba9dcdaf-goog
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 1414bfef..d24b0b23 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";
+}
 /*
  *  verifyCropRotateScaleDegrees returns where |crop_rotate_scale_degrees| in
  * all camera3_stream in stream_list are valid.
@@ -1635,6 +1649,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())