Loading...
Searching...
No Matches
request.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* Capture request handling
*/
#pragma once
#include <map>
#include <memory>
#include <ostream>
#include <stdint.h>
#include <string>
#include <libcamera/base/class.h>
#include <libcamera/base/signal.h>
#include <libcamera/controls.h>
#include <libcamera/fence.h>
namespace libcamera {
class Camera;
class CameraControlValidator;
class FrameBuffer;
class Stream;
class Request : public Extensible
{
LIBCAMERA_DECLARE_PRIVATE()
public:
enum Status {
RequestPending,
RequestComplete,
RequestCancelled,
};
enum ReuseFlag {
Default = 0,
ReuseBuffers = (1 << 0),
};
using BufferMap = std::map<const Stream *, FrameBuffer *>;
Request(Camera *camera, uint64_t cookie = 0);
~Request();
void reuse(ReuseFlag flags = Default);
ControlList &controls() { return controls_; }
const ControlList &metadata() const;
const BufferMap &buffers() const { return bufferMap_; }
int addBuffer(const Stream *stream, FrameBuffer *buffer,
std::unique_ptr<Fence> &&fence = {});
FrameBuffer *findBuffer(const Stream *stream) const;
uint32_t sequence() const;
uint64_t cookie() const { return cookie_; }
Status status() const { return status_; }
bool hasPendingBuffers() const;
std::string toString() const;
private:
LIBCAMERA_DISABLE_COPY(Request)
ControlList controls_;
BufferMap bufferMap_;
const uint64_t cookie_;
Status status_;
};
std::ostream &operator<<(std::ostream &out, const Request &r);
} /* namespace libcamera */
libcamera::Camera
Camera device.
Definition camera.h:115
libcamera::ControlList
Associate a list of ControlId with their values for an object.
Definition controls.h:409
libcamera::FrameBuffer
Frame buffer data and its associated dynamic metadata.
Definition framebuffer.h:50
libcamera::Request
A frame capture request.
Definition request.h:30
libcamera::Request::status
Status status() const
Retrieve the request completion status.
Definition request.h:61
libcamera::Request::Status
Status
Definition request.h:34
libcamera::Request::RequestCancelled
@ RequestCancelled
Definition request.h:37
libcamera::Request::RequestComplete
@ RequestComplete
Definition request.h:36
libcamera::Request::RequestPending
@ RequestPending
Definition request.h:35
libcamera::Request::buffers
const BufferMap & buffers() const
Retrieve the request's streams to buffers map.
Definition request.h:54
libcamera::Request::hasPendingBuffers
bool hasPendingBuffers() const
Check if a request has buffers yet to be completed.
Definition request.cpp:580
libcamera::Request::controls
ControlList & controls()
Retrieve the request's ControlList.
Definition request.h:52
libcamera::Request::toString
std::string toString() const
Generate a string representation of the Request internals.
Definition request.cpp:593
libcamera::Request::metadata
const ControlList & metadata() const
Retrieve the request's metadata.
Definition request.cpp:430
libcamera::Request::addBuffer
int addBuffer(const Stream *stream, FrameBuffer *buffer, std::unique_ptr< Fence > &&fence={})
Add a FrameBuffer with its associated Stream to the Request.
Definition request.cpp:479
libcamera::Request::BufferMap
std::map< const Stream *, FrameBuffer * > BufferMap
A map of Stream to FrameBuffer pointers.
Definition request.h:45
libcamera::Request::sequence
uint32_t sequence() const
Retrieve the sequence number for the request.
Definition request.cpp:550
libcamera::Request::ReuseFlag
ReuseFlag
Definition request.h:40
libcamera::Request::Default
@ Default
Definition request.h:41
libcamera::Request::ReuseBuffers
@ ReuseBuffers
Definition request.h:42
libcamera::Request::cookie
uint64_t cookie() const
Retrieve the cookie set when the request was created.
Definition request.h:60
libcamera::Request::findBuffer
FrameBuffer * findBuffer(const Stream *stream) const
Return the buffer associated with a stream.
Definition request.cpp:526
libcamera::Request::Request
Request(Camera *camera, uint64_t cookie=0)
Create a capture request for a camera.
Definition request.cpp:363
libcamera::Request::reuse
void reuse(ReuseFlag flags=Default)
Reset the request for reuse.
Definition request.cpp:388
libcamera::Stream
Video stream for a camera.
Definition stream.h:76
controls.h
Framework to manage controls related to an object.
fence.h
Definition of the Fence class.
libcamera
Top-level libcamera namespace.
Definition bound_method.h:15
libcamera::operator<<
std::ostream & operator<<(std::ostream &out, const Point &p)
Insert a text representation of a Point into an output stream.
Definition geometry.cpp:91
signal.h
Signal & slot implementation.