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

Message ID 20210330052521.381550-4-hiroh@chromium.org
State Changes Requested
Headers show
Series
  • Regard crop_rotate_scale_degrees in configuration
Related show

Commit Message

Hirokazu Honda March 30, 2021, 5:25 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>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/android/camera_device.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Patch
diff mbox series

diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index f88e94bc..e0eaa3b5 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(CHROMEOS)
 /*
  * Check whether the crop_rotate_scale_degrees values for all streams in
@@ -1632,6 +1647,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(CHROMEOS)
+			       << ", crop_rotate_scale_degrees: "
+			       << rotationToString(stream->crop_rotate_scale_degrees)
+#endif
 			       << " (" << format.toString() << ")";
 
 		if (!format.isValid())