diff options
author | Umang Jain <umang.jain@ideasonboard.com> | 2021-10-19 17:17:55 +0530 |
---|---|---|
committer | Umang Jain <umang.jain@ideasonboard.com> | 2021-10-19 19:15:30 +0530 |
commit | 573fcb94d6443d103ee7be84cdc8a04463692196 (patch) | |
tree | 65e5e05299d63adda9eb91230d256246dd31538f /src/android/camera_request.h | |
parent | 1976179623b832052c37e577b2f375f569d28ab0 (diff) |
android: camera_device: Create struct to track per stream buffer
The Camera3RequestDescriptor structure stores, for each stream, the
camera3_stream_buffer_t and the libcamera FrameBuffer in two separate
vectors. This complicates buffer handling, as the code needs to keep
both vectors in sync. Create a new structure to group all data about
per-stream buffers to simplify this.
As a side effect, we need to create a local vector of
camera3_stream_buffer_t in CameraDevice::sendCaptureResults() as the
camera3_stream_buffer_t instances stored in the new structure in
Camera3RequestDescriptor are not contiguous anymore. This is a small
price to pay for easier handling of buffers, and will be refactored in
subsequent commits anyway.
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src/android/camera_request.h')
-rw-r--r-- | src/android/camera_request.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/android/camera_request.h b/src/android/camera_request.h index db13f624..a030febf 100644 --- a/src/android/camera_request.h +++ b/src/android/camera_request.h @@ -29,6 +29,16 @@ public: Error, }; + struct StreamBuffer { + camera3_stream_buffer_t buffer; + /* + * FrameBuffer instances created by wrapping a camera3 provided + * dmabuf are emplaced in this vector of unique_ptr<> for + * lifetime management. + */ + std::unique_ptr<libcamera::FrameBuffer> frameBuffer; + }; + Camera3RequestDescriptor(libcamera::Camera *camera, const camera3_capture_request_t *camera3Request); ~Camera3RequestDescriptor(); @@ -36,8 +46,9 @@ public: bool isPending() const { return status_ == Status::Pending; } uint32_t frameNumber_ = 0; - std::vector<camera3_stream_buffer_t> buffers_; - std::vector<std::unique_ptr<libcamera::FrameBuffer>> frameBuffers_; + + std::vector<StreamBuffer> buffers_; + CameraMetadata settings_; std::unique_ptr<CaptureRequest> request_; std::unique_ptr<CameraMetadata> resultMetadata_; |