libcamera v0.3.2 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 * Request class private data
6 */
7
8#pragma once
9
10#include <chrono>
11#include <map>
12#include <memory>
13#include <unordered_set>
14
15#include <libcamera/base/event_notifier.h>
16#include <libcamera/base/timer.h>
17
18#include <libcamera/request.h>
19
20 using namespace std::chrono_literals;
21
22 namespace libcamera {
23
24 class Camera;
25 class FrameBuffer;
26
27 class Request::Private : public Extensible::Private
28{
29 LIBCAMERA_DECLARE_PUBLIC(Request)
30
31 public:
32 Private(Camera *camera);
33 ~Private();
34
35 Camera *camera() const { return camera_; }
36 bool hasPendingBuffers() const;
37
38 bool completeBuffer(FrameBuffer *buffer);
39 void complete();
40 void cancel();
41 void reset();
42
43 void prepare(std::chrono::milliseconds timeout = 0ms);
44 Signal<> prepared;
45
46 private:
47 friend class PipelineHandler;
48 friend std::ostream &operator<<(std::ostream &out, const Request &r);
49
50 void doCancelRequest();
51 void emitPrepareCompleted();
52 void notifierActivated(FrameBuffer *buffer);
53 void timeout();
54
55 Camera *camera_;
56 bool cancelled_;
57 uint32_t sequence_ = 0;
58 bool prepared_ = false;
59
60 std::unordered_set<FrameBuffer *> pending_;
61 std::map<FrameBuffer *, std::unique_ptr<EventNotifier>> notifiers_;
62 std::unique_ptr<Timer> timer_;
63};
64
65} /* namespace libcamera */
LIBCAMERA_DECLARE_PUBLIC
#define LIBCAMERA_DECLARE_PUBLIC(klass)
Declare public data for a private class.
Definition class.h:57
libcamera::Camera
Camera device.
Definition camera.h:115
libcamera::Extensible::Private
Base class for private data managed through a d-pointer.
Definition class.h:65
libcamera::Extensible::Private::Private
Private()
Construct an instance of an Extensible class private data.
Definition class.cpp:194
libcamera::FrameBuffer
Frame buffer data and its associated dynamic metadata.
Definition framebuffer.h:49
libcamera::PipelineHandler
Create and manage cameras based on a set of media devices.
Definition pipeline_handler.h:35
libcamera::Request::Private
Request private data.
Definition request.h:28
libcamera::Request::Private::prepare
void prepare(std::chrono::milliseconds timeout=0ms)
Prepare the Request to be queued to the device.
Definition request.cpp:223
libcamera::Request::Private::reset
void reset()
Reset the request internal data to default values.
Definition request.cpp:173
libcamera::Request::Private::cancel
void cancel()
Cancel a queued request.
Definition request.cpp:157
libcamera::Request::Private::completeBuffer
bool completeBuffer(FrameBuffer *buffer)
Complete a buffer for the request.
Definition request.cpp:98
libcamera::Request::Private::prepared
Signal prepared
Request preparation completed Signal.
Definition request.h:44
libcamera::Request::Private::complete
void complete()
Complete a queued request.
Definition request.cpp:120
libcamera::Request::Private::camera
Camera * camera() const
Retrieve the camera this request has been queued to.
Definition request.h:35
libcamera::Request::Private::operator<<
friend std::ostream & operator<<(std::ostream &out, const Request &r)
Insert a text representation of a Request into an output stream.
Definition request.cpp:607
libcamera::Request::Private::hasPendingBuffers
bool hasPendingBuffers() const
Check if a request has buffers yet to be completed.
Definition request.cpp:80
libcamera::Request
A frame capture request.
Definition request.h:30
libcamera::Signal
Generic signal and slot communication mechanism.
Definition signal.h:39
event_notifier.h
File descriptor event notifier.
libcamera
Top-level libcamera namespace.
Definition backtrace.h:17
request.h
Describes a frame capture request to be processed by a camera.
timer.h
Generic timer.