summaryrefslogtreecommitdiff
path: root/src/android/camera_device.h
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-10-06 17:56:50 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-10-14 20:11:26 +0200
commit4b1aa21db09df16d1a23d074e1b1c915b1b36ae4 (patch)
tree5f5126b6ca339bb27171034f1787c1ac96d356bf /src/android/camera_device.h
parent8806863b0bc4498d098e16dda657ab6f8293d208 (diff)
android: camera_device: Queue request using Worker
Add a CameraWorker class member to the CameraDevice class and queue capture requests to it to delegate its handling. Start and stop the CameraWorker when the libcamera::Camera is started or stopped. Tie the CaptureRequest lifetime to the Camera3RequestDescriptor's one by storing it as unique_ptr<> in the descriptor to simplify handling of request creation and deletion. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/camera_device.h')
-rw-r--r--src/android/camera_device.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 777d1a35..86f2b897 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -25,6 +25,7 @@
#include "libcamera/internal/message.h"
#include "camera_stream.h"
+#include "camera_worker.h"
#include "jpeg/encoder.h"
class CameraMetadata;
@@ -73,7 +74,8 @@ private:
CameraDevice(unsigned int id, const std::shared_ptr<libcamera::Camera> &camera);
struct Camera3RequestDescriptor {
- Camera3RequestDescriptor(unsigned int frameNumber,
+ Camera3RequestDescriptor(libcamera::Camera *camera,
+ unsigned int frameNumber,
unsigned int numBuffers);
~Camera3RequestDescriptor();
@@ -81,6 +83,7 @@ private:
uint32_t numBuffers;
camera3_stream_buffer_t *buffers;
std::vector<std::unique_ptr<libcamera::FrameBuffer>> frameBuffers;
+ std::unique_ptr<CaptureRequest> request;
};
struct Camera3StreamConfiguration {
@@ -108,6 +111,8 @@ private:
unsigned int id_;
camera3_device_t camera3Device_;
+ CameraWorker worker_;
+
bool running_;
std::shared_ptr<libcamera::Camera> camera_;
std::unique_ptr<libcamera::CameraConfiguration> config_;