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

libcamera v0.2.0 Supporting cameras in Linux since 2019

Loading...
Searching...
No Matches
request.h
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2019, Google Inc.
4 *
5 * request.h - Request class private data
6 */
7
8#pragma once
9
10#include <chrono>
11#include <map>
12#include <memory>
13
14#include <libcamera/base/event_notifier.h>
15#include <libcamera/base/timer.h>
16
17#include <libcamera/request.h>
18
19using namespace std::chrono_literals;
20
21namespace libcamera {
22
23class Camera;
24class FrameBuffer;
25
26 class Request::Private : public Extensible::Private
27{
28 LIBCAMERA_DECLARE_PUBLIC(Request)
29
30public:
31 Private(Camera *camera);
32 ~Private();
33
34 Camera *camera() const { return camera_; }
35 bool hasPendingBuffers() const;
36
37 bool completeBuffer(FrameBuffer *buffer);
38 void complete();
39 void cancel();
40 void reset();
41
42 void prepare(std::chrono::milliseconds timeout = 0ms);
43 Signal<> prepared;
44
45private:
46 friend class PipelineHandler;
47 friend std::ostream &operator<<(std::ostream &out, const Request &r);
48
49 void doCancelRequest();
50 void emitPrepareCompleted();
51 void notifierActivated(FrameBuffer *buffer);
52 void timeout();
53
54 Camera *camera_;
55 bool cancelled_;
56 uint32_t sequence_ = 0;
57 bool prepared_ = false;
58
59 std::unordered_set<FrameBuffer *> pending_;
60 std::map<FrameBuffer *, std::unique_ptr<EventNotifier>> notifiers_;
61 std::unique_ptr<Timer> timer_;
62};
63
64} /* 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:50
libcamera::PipelineHandler
Create and manage cameras based on a set of media devices.
Definition pipeline_handler.h:39
libcamera::Request::Private
Request private data.
Definition request.h:27
libcamera::Request::Private::prepare
void prepare(std::chrono::milliseconds timeout=0ms)
Prepare the Request to be queued to the device.
Definition request.cpp:216
libcamera::Request::Private::reset
void reset()
Reset the request internal data to default values.
Definition request.cpp:166
libcamera::Request::Private::cancel
void cancel()
Cancel a queued request.
Definition request.cpp:150
libcamera::Request::Private::completeBuffer
bool completeBuffer(FrameBuffer *buffer)
Complete a buffer for the request.
Definition request.cpp:91
libcamera::Request::Private::camera
Camera * camera() const
Retrieve the camera this request has been queued to.
Definition request.h:34
libcamera::Request::Private::complete
void complete()
Complete a queued request.
Definition request.cpp:113
libcamera::Request::Private::prepared
Signal prepared
Request preparation completed Signal.
Definition request.h:43
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:599
libcamera::Request::Private::hasPendingBuffers
bool hasPendingBuffers() const
Check if a request has buffers yet to be completed.
Definition request.cpp:73
libcamera::Request
A frame capture request.
Definition request.h:31
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.