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>
This commit is contained in:
@@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user