From 64f4f667ed1c58d4889a3b00c6750a2ddfc625f2 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Mon, 25 May 2020 16:08:22 +0200 Subject: android: hal_manager: Do not hardcode properties The CameraHalManager::getCameraInfo() method hardcodes the camera facing side and orientation (which corresponds, confusingly, to libcamera's location and rotation properties). Instead of hard-coding the values based on the camera id, inspect the libcamera properties that report the camera location and rotation in a new initialize() method, and use them to report the android camera info and to populate the static metadata buffer. Reviewed-by: Laurent Pinchart Signed-off-by: Jacopo Mondi --- src/android/camera_device.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/android/camera_device.h') diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 9d5c6952..a87f7623 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -27,12 +27,17 @@ public: CameraDevice(unsigned int id, const std::shared_ptr &camera); ~CameraDevice(); + int initialize(); + int open(const hw_module_t *hardwareModule); void close(); unsigned int id() const { return id_; } camera3_device_t *camera3Device() { return &camera3Device_; } + int facing() const { return facing_; } + int orientation() const { return orientation_; } + void setCallbacks(const camera3_callback_ops_t *callbacks); const camera_metadata_t *getStaticMetadata(); const camera_metadata_t *constructDefaultRequestSettings(int type); @@ -69,6 +74,9 @@ private: CameraMetadata *staticMetadata_; std::map requestTemplates_; const camera3_callback_ops_t *callbacks_; + + int facing_; + int orientation_; }; #endif /* __ANDROID_CAMERA_DEVICE_H__ */ -- cgit v1.2.1