libcamera: framebuffer: Prevent modifying the number of metadata planes

The number of metadata planes should always match the number of frame
buffer planes. Enforce this by making the vector private and providing
accessor functions.

As this changes the public API, update all in-tree users accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
This commit is contained in:
Laurent Pinchart
2021-09-02 04:29:03 +03:00
parent 9df775c757
commit 32635054bc
10 changed files with 34 additions and 20 deletions

View File

@@ -91,8 +91,14 @@ LOG_DEFINE_CATEGORY(Buffer)
*/
/**
* \var FrameMetadata::planes
* \brief Array of per-plane metadata
* \fn FrameMetadata::planes()
* \copydoc FrameMetadata::planes() const
*/
/**
* \fn FrameMetadata::planes() const
* \brief Retrieve the array of per-plane metadata
* \return The array of per-plane metadata
*/
/**
@@ -210,7 +216,7 @@ FrameBuffer::FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie)
: Extensible(std::make_unique<Private>()), planes_(planes),
cookie_(cookie)
{
metadata_.planes.resize(planes_.size());
metadata_.planes_.resize(planes_.size());
unsigned int offset = 0;
bool isContiguous = true;