[libcamera-devel] [PATCH 2/7] android: camera_device: Pass camera3 request to descriptor
paul.elder at ideasonboard.com
paul.elder at ideasonboard.com
Fri Jan 22 04:43:55 CET 2021
Hi Jacopo,
On Thu, Jan 21, 2021 at 05:53:00PM +0100, Jacopo Mondi wrote:
> 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.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
> ---
> src/android/camera_device.cpp | 13 +++++++------
> src/android/camera_device.h | 3 +--
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp
> index 7c70a0b314e6..f10b572749eb 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
> @@ -1683,8 +1685,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 912e54a60d4b..ab3c848edd0a 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_;
> --
> 2.29.2
>
More information about the libcamera-devel
mailing list