Loading...
Searching...
No Matches
request.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* Request class private data
*/
#pragma once
#include <chrono>
#include <map>
#include <memory>
#include <stdint.h>
#include <unordered_set>
#include <libcamera/base/event_notifier.h>
#include <libcamera/base/timer.h>
#include <libcamera/request.h>
using namespace std::chrono_literals;
namespace libcamera {
class Camera;
class FrameBuffer;
class Request::Private : public Extensible::Private
{
LIBCAMERA_DECLARE_PUBLIC(Request)
public:
Private(Camera *camera);
~Private();
Camera *camera() const { return camera_; }
bool hasPendingBuffers() const;
ControlList &metadata() { return metadata_; }
bool completeBuffer(FrameBuffer *buffer);
void complete();
void cancel();
void reset();
void prepare(std::chrono::milliseconds timeout = 0ms);
Signal<> prepared;
private:
friend class PipelineHandler;
friend std::ostream &operator<<(std::ostream &out, const Request &r);
void doCancelRequest();
void emitPrepareCompleted();
void notifierActivated(FrameBuffer *buffer);
void timeout();
Camera *camera_;
bool cancelled_;
uint32_t sequence_ = 0;
bool prepared_ = false;
std::unordered_set<FrameBuffer *> pending_;
std::map<FrameBuffer *, EventNotifier> notifiers_;
std::unique_ptr<Timer> timer_;
ControlList metadata_;
};
} /* 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::ControlList
Associate a list of ControlId with their values for an object.
Definition controls.h:409
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::Request::Private
Request private data.
Definition request.h:29
libcamera::Request::Private::metadata
ControlList & metadata()
Retrieve the request's metadata.
Definition request.h:39
libcamera::Request::Private::prepare
void prepare(std::chrono::milliseconds timeout=0ms)
Prepare the Request to be queued to the device.
Definition request.cpp:231
libcamera::Request::Private::reset
void reset()
Reset the request internal data to default values.
Definition request.cpp:181
libcamera::Request::Private::Private
Private(Camera *camera)
Create a Request::Private.
Definition request.cpp:59
libcamera::Request::Private::cancel
void cancel()
Cancel a queued request.
Definition request.cpp:165
libcamera::Request::Private::completeBuffer
bool completeBuffer(FrameBuffer *buffer)
Complete a buffer for the request.
Definition request.cpp:106
libcamera::Request::Private::prepared
Signal prepared
Request preparation completed Signal.
Definition request.h:47
libcamera::Request::Private::complete
void complete()
Complete a queued request.
Definition request.cpp:128
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:607
libcamera::Request::Private::hasPendingBuffers
bool hasPendingBuffers() const
Check if a request has buffers yet to be completed.
Definition request.cpp:82
libcamera::Request::Request
Request(Camera *camera, uint64_t cookie=0)
Create a capture request for a camera.
Definition request.cpp:363
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.