summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-01-21 10:51:05 +0100
committerJacopo Mondi <jacopo@jmondi.org>2021-01-22 10:35:53 +0100
commitdd1cd532caecc06f5e6d5b6ae4b6f4afd465ffb9 (patch)
tree82f88dea45ccd34d5631c8adc6e2f18fa86de922 /src
parent5e2596006bc662c1e565052728cd732d8f78bf1e (diff)
android: camera_device: Pass camera3 request to descriptor
The Camera3RequestDescriptor class can access the number of buffers and the frame number from the camera3_capture_request_t instead of having the caller passing them to the constructor. This change allows to access other fields of the capture request, such as the capture settings. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/android/camera_device.cpp13
-rw-r--r--src/android/camera_device.h3
2 files changed, 8 insertions, 8 deletions
diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
index a136f8e3..c349b7b0 100644
--- a/src/android/camera_device.cpp
+++ b/src/android/camera_device.cpp
@@ -295,16 +295,18 @@ MappedCamera3Buffer::MappedCamera3Buffer(const buffer_handle_t camera3buffer,
*/
CameraDevice::Camera3RequestDescriptor::Camera3RequestDescriptor(
- Camera *camera, unsigned int frameNumber, unsigned int numBuffers)
- : frameNumber_(frameNumber), numBuffers_(numBuffers)
+ Camera *camera, const camera3_capture_request_t *camera3Request)
{
- buffers_ = new camera3_stream_buffer_t[numBuffers];
+ frameNumber_ = camera3Request->frame_number;
+
+ numBuffers_ = camera3Request->num_output_buffers;
+ buffers_ = new camera3_stream_buffer_t[numBuffers_];
/*
* FrameBuffer instances created by wrapping a camera3 provided dmabuf
* are emplaced in this vector of unique_ptr<> for lifetime management.
*/
- frameBuffers_.reserve(numBuffers);
+ frameBuffers_.reserve(numBuffers_);
/*
* Create the libcamera::Request unique_ptr<> to tie its lifetime
@@ -1603,8 +1605,7 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques
* at request complete time.
*/
Camera3RequestDescriptor *descriptor =
- new Camera3RequestDescriptor(camera_.get(), camera3Request->frame_number,
- camera3Request->num_output_buffers);
+ new Camera3RequestDescriptor(camera_.get(), camera3Request);
LOG(HAL, Debug) << "Queueing Request to libcamera with "
<< descriptor->numBuffers_ << " HAL streams";
diff --git a/src/android/camera_device.h b/src/android/camera_device.h
index 07d3a846..c2afc9d3 100644
--- a/src/android/camera_device.h
+++ b/src/android/camera_device.h
@@ -75,8 +75,7 @@ private:
struct Camera3RequestDescriptor {
Camera3RequestDescriptor(libcamera::Camera *camera,
- unsigned int frameNumber,
- unsigned int numBuffers);
+ const camera3_capture_request_t *camera3Request);
~Camera3RequestDescriptor();
uint32_t frameNumber_;