From 32635054bc76e2ababd8ea2177fca1f88229541a Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 2 Sep 2021 04:29:03 +0300 Subject: 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 Reviewed-by: Kieran Bingham Reviewed-by: Jean-Michel Hautbois Reviewed-by: Hirokazu Honda --- include/libcamera/framebuffer.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h index fd68ed0a..7f2f176a 100644 --- a/include/libcamera/framebuffer.h +++ b/include/libcamera/framebuffer.h @@ -13,6 +13,7 @@ #include #include +#include #include @@ -34,7 +35,14 @@ struct FrameMetadata { Status status; unsigned int sequence; uint64_t timestamp; - std::vector planes; + + Span planes() { return planes_; } + Span planes() const { return planes_; } + +private: + friend class FrameBuffer; + + std::vector planes_; }; class FrameBuffer final : public Extensible -- cgit v1.2.1