libcamera: include/libcamera/request.h Source File

libcamera v0.7.0 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
request.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2019, Google Inc.
4 *
5 * Capture request handling
6 */
7
8#pragma once
9
10#include <map>
11#include <memory>
12#include <ostream>
13#include <stdint.h>
14#include <string>
15
16#include <libcamera/base/class.h>
17#include <libcamera/base/signal.h>
18
19#include <libcamera/controls.h>
20#include <libcamera/fence.h>
21
22namespace libcamera {
23
24class Camera;
25class CameraControlValidator;
26class FrameBuffer;
27class Stream;
28
29 class Request : public Extensible
30{
31 LIBCAMERA_DECLARE_PRIVATE()
32
33public:
34 enum Status {
35 RequestPending,
36 RequestComplete,
37 RequestCancelled,
38 };
39
40 enum ReuseFlag {
41 Default = 0,
42 ReuseBuffers = (1 << 0),
43 };
44
45 using BufferMap = std::map<const Stream *, FrameBuffer *>;
46
47 Request(Camera *camera, uint64_t cookie = 0);
48 ~Request();
49
50 void reuse(ReuseFlag flags = Default);
51
52 ControlList &controls() { return controls_; }
53 const ControlList &metadata() const;
54 const BufferMap &buffers() const { return bufferMap_; }
55 int addBuffer(const Stream *stream, FrameBuffer *buffer,
56 std::unique_ptr<Fence> &&fence = {});
57 FrameBuffer *findBuffer(const Stream *stream) const;
58
59 uint32_t sequence() const;
60 uint64_t cookie() const { return cookie_; }
61 Status status() const { return status_; }
62
63 bool hasPendingBuffers() const;
64
65 std::string toString() const;
66
67private:
68 LIBCAMERA_DISABLE_COPY(Request)
69
70 ControlList controls_;
71 BufferMap bufferMap_;
72
73 const uint64_t cookie_;
74 Status status_;
75};
76
77std::ostream &operator<<(std::ostream &out, const Request &r);
78
79} /* 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.