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

Hirokazu Honda hiroh at chromium.org
Sat Apr 3 15:10:14 CEST 2021


|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>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/android/camera_device.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index 3f7cce8e..ddac56da 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -256,6 +256,21 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,
 	unsortedConfigs = sortedConfigs;
 }
 
+const char *rotationToString(int rotation)
+{
+	switch (rotation) {
+	case CAMERA3_STREAM_ROTATION_0:
+		return "0";
+	case CAMERA3_STREAM_ROTATION_90:
+		return "90";
+	case CAMERA3_STREAM_ROTATION_180:
+		return "180";
+	case CAMERA3_STREAM_ROTATION_270:
+		return "270";
+	}
+	return "INVALID";
+}
+
 #if defined(OS_CHROMEOS)
 /*
  * Check whether the crop_rotate_scale_degrees values for all streams in
@@ -1631,6 +1646,11 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)
 			       << ", width: " << stream->width
 			       << ", height: " << stream->height
 			       << ", format: " << utils::hex(stream->format)
+			       << ", rotation: " << rotationToString(stream->rotation)
+#if defined(OS_CHROMEOS)
+			       << ", crop_rotate_scale_degrees: "
+			       << rotationToString(stream->crop_rotate_scale_degrees)
+#endif
 			       << " (" << format.toString() << ")";
 
 		if (!format.isValid())
-- 
2.31.0.208.g409f899ff0-goog



More information about the libcamera-devel mailing list