[libcamera-devel] [PATCH v2 2/4] android: camera_hal_manager: Set camera module callbacks
Umang Jain
email at uajain.com
Mon Aug 10 14:04:13 CEST 2020
camera_module_callbacks are invoked to inform the framework about
the events occuring module-wide. Allow to set these callbacks in
camera_hal_manager as this will be used to integration camera hotplug
support via camera_module_callbacks::camera_device_status_change in
subsequent commit.
Signed-off-by: Umang Jain <email at uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
---
src/android/camera3_hal.cpp | 2 ++
src/android/camera_hal_manager.cpp | 5 +++++
src/android/camera_hal_manager.h | 3 +++
3 files changed, 10 insertions(+)
diff --git a/src/android/camera3_hal.cpp b/src/android/camera3_hal.cpp
index 716e36c..c2cba29 100644
--- a/src/android/camera3_hal.cpp
+++ b/src/android/camera3_hal.cpp
@@ -34,6 +34,8 @@ static int hal_get_camera_info(int id, struct camera_info *info)
static int hal_set_callbacks(const camera_module_callbacks_t *callbacks)
{
+ cameraManager.setCallbacks(callbacks);
+
return 0;
}
diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp
index 02b6418..3d6d2b4 100644
--- a/src/android/camera_hal_manager.cpp
+++ b/src/android/camera_hal_manager.cpp
@@ -120,3 +120,8 @@ int CameraHalManager::getCameraInfo(unsigned int id, struct camera_info *info)
return 0;
}
+
+void CameraHalManager::setCallbacks(const camera_module_callbacks_t *callbacks)
+{
+ callbacks_ = callbacks;
+}
diff --git a/src/android/camera_hal_manager.h b/src/android/camera_hal_manager.h
index 0619037..a582f04 100644
--- a/src/android/camera_hal_manager.h
+++ b/src/android/camera_hal_manager.h
@@ -10,6 +10,7 @@
#include <stddef.h>
#include <vector>
+#include <hardware/camera_common.h>
#include <hardware/hardware.h>
#include <system/camera_metadata.h>
@@ -29,10 +30,12 @@ public:
unsigned int numCameras() const;
int getCameraInfo(unsigned int id, struct camera_info *info);
+ void setCallbacks(const camera_module_callbacks_t *callbacks);
private:
libcamera::CameraManager *cameraManager_;
+ const camera_module_callbacks_t *callbacks_;
std::vector<std::unique_ptr<CameraDevice>> cameras_;
};
--
2.26.2
More information about the libcamera-devel
mailing list