request.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* request.h - Capture request handling
*/
#ifndef __LIBCAMERA_REQUEST_H__
#define __LIBCAMERA_REQUEST_H__
#include <map>
#include <memory>
#include <stdint.h>
#include <unordered_set>
#include <libcamera/controls.h>
#include <libcamera/signal.h>
namespace libcamera {
class Camera;
class CameraControlValidator;
class FrameBuffer;
class Stream;
class Request
{
public:
enum Status {
RequestPending,
RequestComplete,
RequestCancelled,
};
Request(Camera *camera, uint64_t cookie = 0);
Request(const Request &) = delete;
Request &operator=(const Request &) = delete;
~Request();
ControlList &controls() { return *controls_; }
ControlList &metadata() { return *metadata_; }
const std::map<Stream *, FrameBuffer *> &buffers() const { return bufferMap_; }
int addBuffer(Stream *stream, FrameBuffer *buffer);
FrameBuffer *findBuffer(Stream *stream) const;
uint64_t cookie() const { return cookie_; }
Status status() const { return status_; }
bool hasPendingBuffers() const { return !pending_.empty(); }
private:
friend class PipelineHandler;
void complete();
bool completeBuffer(FrameBuffer *buffer);
Camera *camera_;
CameraControlValidator *validator_;
ControlList *controls_;
ControlList *metadata_;
std::map<Stream *, FrameBuffer *> bufferMap_;
std::unordered_set<FrameBuffer *> pending_;
const uint64_t cookie_;
Status status_;
bool cancelled_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_REQUEST_H__ */
libcamera::CameraControlValidator
A control validator for Camera instances.
Definition: camera_controls.h:17
libcamera::Camera
Camera device.
Definition: camera.h:70
libcamera::ControlList
Associate a list of ControlId with their values for an object.
Definition: controls.h:342
libcamera::FrameBuffer
Frame buffer data and its associated dynamic metadata.
Definition: buffer.h:37
libcamera::PipelineHandler
Create and manage cameras based on a set of media devices.
Definition: pipeline_handler.h:59
libcamera::Request
A frame capture request.
Definition: request.h:26
libcamera::Request::Status
Status
Definition: request.h:28
libcamera::Request::RequestPending
@ RequestPending
Definition: request.h:29
libcamera::Request::RequestCancelled
@ RequestCancelled
Definition: request.h:31
libcamera::Request::RequestComplete
@ RequestComplete
Definition: request.h:30
libcamera::Request::addBuffer
int addBuffer(Stream *stream, FrameBuffer *buffer)
Add a FrameBuffer with its associated Stream to the Request.
Definition: request.cpp:125
libcamera::Request::buffers
const std::map< Stream *, FrameBuffer * > & buffers() const
Retrieve the request's streams to buffers map.
Definition: request.h:41
libcamera::Request::cookie
uint64_t cookie() const
Retrieve the cookie set when the request was created.
Definition: request.h:45
libcamera::Request::status
Status status() const
Retrieve the request completion status.
Definition: request.h:46
libcamera::Request::metadata
ControlList & metadata()
Retrieve the request's metadata.
Definition: request.h:40
libcamera::Request::findBuffer
FrameBuffer * findBuffer(Stream *stream) const
Return the buffer associated with a stream.
Definition: request.cpp:160
libcamera::Request::hasPendingBuffers
bool hasPendingBuffers() const
Check if a request has buffers yet to be completed.
Definition: request.h:48
libcamera::Request::Request
Request(Camera *camera, uint64_t cookie=0)
Create a capture request for a camera.
Definition: request.cpp:59
libcamera::Request::controls
ControlList & controls()
Retrieve the request's ControlList.
Definition: request.h:39
libcamera::Stream
Video stream for a camera.
Definition: stream.h:70
controls.h
Framework to manage controls related to an object.
signal.h
Signal & slot implementation.