libcamera: framebuffer: Enable attaching additional data to FrameBuffer
We cannot have a subclass of FrameBuffer because it is marked as final. This adds a FrameBuffer constructor with FrameBuffer::Private. So we can attach some additional resources with FrameBuffer through a customized FrameBuffer::Private class. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
parent
294663eece
commit
99bb610fd1
3 changed files with 25 additions and 2 deletions
|
@ -57,6 +57,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
|
FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
|
||||||
|
FrameBuffer(std::unique_ptr<Private> d,
|
||||||
|
const std::vector<Plane> &planes, unsigned int cookie = 0);
|
||||||
|
|
||||||
const std::vector<Plane> &planes() const { return planes_; }
|
const std::vector<Plane> &planes() const { return planes_; }
|
||||||
Request *request() const;
|
Request *request() const;
|
||||||
|
|
|
@ -19,6 +19,7 @@ class FrameBuffer::Private : public Extensible::Private
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Private();
|
Private();
|
||||||
|
virtual ~Private();
|
||||||
|
|
||||||
void setRequest(Request *request) { request_ = request; }
|
void setRequest(Request *request) { request_ = request; }
|
||||||
bool isContiguous() const { return isContiguous_; }
|
bool isContiguous() const { return isContiguous_; }
|
||||||
|
|
|
@ -119,6 +119,13 @@ FrameBuffer::Private::Private()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief FrameBuffer::Private destructor
|
||||||
|
*/
|
||||||
|
FrameBuffer::Private::~Private()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn FrameBuffer::Private::setRequest()
|
* \fn FrameBuffer::Private::setRequest()
|
||||||
* \brief Set the request this buffer belongs to
|
* \brief Set the request this buffer belongs to
|
||||||
|
@ -237,8 +244,21 @@ ino_t fileDescriptorInode(const SharedFD &fd)
|
||||||
* \param[in] cookie Cookie
|
* \param[in] cookie Cookie
|
||||||
*/
|
*/
|
||||||
FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)
|
FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)
|
||||||
: Extensible(std::make_unique<Private>()), planes_(planes),
|
: FrameBuffer(std::make_unique<Private>(), planes, cookie)
|
||||||
cookie_(cookie)
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Construct a FrameBuffer with an extensible private class and an array
|
||||||
|
* of planes
|
||||||
|
* \param[in] d The extensible private class
|
||||||
|
* \param[in] planes The frame memory planes
|
||||||
|
* \param[in] cookie Cookie
|
||||||
|
*/
|
||||||
|
FrameBuffer::FrameBuffer(std::unique_ptr<Private> d,
|
||||||
|
const std::vector<Plane> &planes,
|
||||||
|
unsigned int cookie)
|
||||||
|
: Extensible(std::move(d)), planes_(planes), cookie_(cookie)
|
||||||
{
|
{
|
||||||
metadata_.planes_.resize(planes_.size());
|
metadata_.planes_.resize(planes_.size());
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue