mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 23:39:44 +03:00
Implement the D-Pointer design pattern in the Request class to allow changing internal data without affecting the public ABI. Move the internal fields that are not needed to implement the public API to the Request::Private class already. This allows to remove the friend class declaration for the PipelineHandler class, which can now use the Request::Private API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> [Move all internal fields to Request::Private and remove friend declaration] Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
76 lines
1.4 KiB
C++
76 lines
1.4 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2019, Google Inc.
|
|
*
|
|
* request.h - Capture request handling
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include <unordered_set>
|
|
|
|
#include <libcamera/base/class.h>
|
|
#include <libcamera/base/signal.h>
|
|
|
|
#include <libcamera/controls.h>
|
|
|
|
namespace libcamera {
|
|
|
|
class Camera;
|
|
class CameraControlValidator;
|
|
class FrameBuffer;
|
|
class Stream;
|
|
|
|
class Request : public Extensible
|
|
{
|
|
LIBCAMERA_DECLARE_PRIVATE()
|
|
|
|
public:
|
|
enum Status {
|
|
RequestPending,
|
|
RequestComplete,
|
|
RequestCancelled,
|
|
};
|
|
|
|
enum ReuseFlag {
|
|
Default = 0,
|
|
ReuseBuffers = (1 << 0),
|
|
};
|
|
|
|
using BufferMap = std::map<const Stream *, FrameBuffer *>;
|
|
|
|
Request(Camera *camera, uint64_t cookie = 0);
|
|
~Request();
|
|
|
|
void reuse(ReuseFlag flags = Default);
|
|
|
|
ControlList &controls() { return *controls_; }
|
|
ControlList &metadata() { return *metadata_; }
|
|
const BufferMap &buffers() const { return bufferMap_; }
|
|
int addBuffer(const Stream *stream, FrameBuffer *buffer);
|
|
FrameBuffer *findBuffer(const Stream *stream) const;
|
|
|
|
uint32_t sequence() const;
|
|
uint64_t cookie() const { return cookie_; }
|
|
Status status() const { return status_; }
|
|
|
|
bool hasPendingBuffers() const;
|
|
|
|
std::string toString() const;
|
|
|
|
private:
|
|
LIBCAMERA_DISABLE_COPY(Request)
|
|
|
|
ControlList *controls_;
|
|
ControlList *metadata_;
|
|
BufferMap bufferMap_;
|
|
|
|
const uint64_t cookie_;
|
|
Status status_;
|
|
};
|
|
|
|
} /* namespace libcamera */
|