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>
62 lines
1.3 KiB
C++
62 lines
1.3 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2019-2021, Google Inc.
|
|
*
|
|
* camera_request.h - libcamera Android Camera Request Descriptor
|
|
*/
|
|
#ifndef __ANDROID_CAMERA_REQUEST_H__
|
|
#define __ANDROID_CAMERA_REQUEST_H__
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include <libcamera/base/class.h>
|
|
|
|
#include <libcamera/camera.h>
|
|
#include <libcamera/framebuffer.h>
|
|
|
|
#include <hardware/camera3.h>
|
|
|
|
#include "camera_metadata.h"
|
|
#include "camera_worker.h"
|
|
|
|
class Camera3RequestDescriptor
|
|
{
|
|
public:
|
|
enum class Status {
|
|
Pending,
|
|
Success,
|
|
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();
|
|
|
|
bool isPending() const { return status_ == Status::Pending; }
|
|
|
|
uint32_t frameNumber_ = 0;
|
|
|
|
std::vector<StreamBuffer> buffers_;
|
|
|
|
CameraMetadata settings_;
|
|
std::unique_ptr<CaptureRequest> request_;
|
|
std::unique_ptr<CameraMetadata> resultMetadata_;
|
|
|
|
Status status_ = Status::Pending;
|
|
|
|
private:
|
|
LIBCAMERA_DISABLE_COPY(Camera3RequestDescriptor)
|
|
};
|
|
|
|
#endif /* __ANDROID_CAMERA_REQUEST_H__ */
|