diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-10-18 14:54:31 +0300 |
---|---|---|
committer | Jacopo Mondi <jacopo@jmondi.org> | 2021-12-11 17:53:40 +0100 |
commit | db37335ee0ee78f7e5562a9617c1b4f17451fc3a (patch) | |
tree | e604b451f9a060b6b73b1efee2965b0527e2b9b2 /include/libcamera/internal/request.h | |
parent | 6705596e29ef3b8d990ff5b851bf3338118198e6 (diff) |
libcamera: request: Make Request class Extensible
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>
Diffstat (limited to 'include/libcamera/internal/request.h')
-rw-r--r-- | include/libcamera/internal/request.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h new file mode 100644 index 00000000..1340ffa2 --- /dev/null +++ b/include/libcamera/internal/request.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * request.h - Request class private data + */ +#ifndef __LIBCAMERA_INTERNAL_REQUEST_H__ +#define __LIBCAMERA_INTERNAL_REQUEST_H__ + +#include <memory> + +#include <libcamera/request.h> + +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; + + bool completeBuffer(FrameBuffer *buffer); + void complete(); + void cancel(); + void reuse(); + +private: + friend class PipelineHandler; + + void doCancelRequest(); + + Camera *camera_; + bool cancelled_; + uint32_t sequence_ = 0; + + std::unordered_set<FrameBuffer *> pending_; +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_INTERNAL_REQUEST_H__ */ |