libcamera: include/libcamera/internal/request.h Source File

libcamera v0.5.1 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 <stdint.h>
14#include <unordered_set>
15
16#include <libcamera/base/event_notifier.h>
17#include <libcamera/base/timer.h>
18
19#include <libcamera/request.h>
20
21using namespace std::chrono_literals;
22
23namespace libcamera {
24
25class Camera;
26class FrameBuffer;
27
28 class Request::Private : public Extensible::Private
29{
30 LIBCAMERA_DECLARE_PUBLIC(Request)
31
32public:
33 Private(Camera *camera);
34 ~Private();
35
36 Camera *camera() const { return camera_; }
37 bool hasPendingBuffers() const;
38
39 bool completeBuffer(FrameBuffer *buffer);
40 void complete();
41 void cancel();
42 void reset();
43
44 void prepare(std::chrono::milliseconds timeout = 0ms);
45 Signal<> prepared;
46
47private:
48 friend class PipelineHandler;
49 friend std::ostream &operator<<(std::ostream &out, const Request &r);
50
51 void doCancelRequest();
52 void emitPrepareCompleted();
53 void notifierActivated(FrameBuffer *buffer);
54 void timeout();
55
56 Camera *camera_;
57 bool cancelled_;
58 uint32_t sequence_ = 0;
59 bool prepared_ = false;
60
61 std::unordered_set<FrameBuffer *> pending_;
62 std::map<FrameBuffer *, std::unique_ptr<EventNotifier>> notifiers_;
63 std::unique_ptr<Timer> timer_;
64};
65
66} /* 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::Request::Private
Request private data.
Definition request.h:29
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::Private
Private(Camera *camera)
Create a Request::Private.
Definition request.cpp:57
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:45
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:36
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:606
libcamera::Request::Private::hasPendingBuffers
bool hasPendingBuffers() const
Check if a request has buffers yet to be completed.
Definition request.cpp:80
libcamera::Request::Request
Request(Camera *camera, uint64_t cookie=0)
Create a capture request for a camera.
Definition request.cpp:355
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.