libcamera  v0.3.0
Supporting cameras in Linux since 2019
request.h
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 
15 #include <libcamera/base/timer.h>
16 
17 #include <libcamera/request.h>
18 
19 using namespace std::chrono_literals;
20 
21 namespace libcamera {
22 
23 class Camera;
24 class FrameBuffer;
25 
27 {
29 
30 public:
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);
44 
45 private:
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 */
Base class for private data managed through a d-pointer.
Definition: class.h:64
Signal prepared
Request preparation completed Signal.
Definition: request.h:43
Top-level libcamera namespace.
Definition: backtrace.h:17
std::ostream & operator<<(std::ostream &out, const Request &r)
Insert a text representation of a Request into an output stream.
Definition: request.cpp:599
Camera * camera() const
Retrieve the camera this request has been queued to.
Definition: request.h:34
Frame buffer data and its associated dynamic metadata.
Definition: framebuffer.h:49
#define LIBCAMERA_DECLARE_PUBLIC(klass)
Declare public data for a private class.
Generic timer.
A frame capture request.
Definition: request.h:30
Create and manage cameras based on a set of media devices.
Definition: pipeline_handler.h:37
Camera device.
Definition: camera.h:113
File descriptor event notifier.
Request private data.
Definition: request.h:26
Generic signal and slot communication mechanism.
Definition: object.h:20
Describes a frame capture request to be processed by a camera.