libcamera  v0.3.2+116-83c5ad0f
Supporting cameras in Linux since 2019
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 
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 
28 {
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);
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 */
Base class for private data managed through a d-pointer.
Definition: class.h:64
Signal prepared
Request preparation completed Signal.
Definition: request.h:44
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:607
Camera * camera() const
Retrieve the camera this request has been queued to.
Definition: request.h:35
Frame buffer data and its associated dynamic metadata.
Definition: framebuffer.h:48
#define LIBCAMERA_DECLARE_PUBLIC(klass)
Declare public data for a private class.
Generic timer.
A frame capture request.
Definition: request.h:29
Create and manage cameras based on a set of media devices.
Definition: pipeline_handler.h:33
Camera device.
Definition: camera.h:113
File descriptor event notifier.
Request private data.
Definition: request.h:27
Generic signal and slot communication mechanism.
Definition: object.h:20
Describes a frame capture request to be processed by a camera.