summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-02 04:29:03 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-07 19:18:31 +0300
commit32635054bc76e2ababd8ea2177fca1f88229541a (patch)
tree8e263f2a14a1dd8ba7e1984693f7a5125c7e4837 /include
parent9df775c7574520632547c2f4db236b7d84f6e3c3 (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/framebuffer.h10
1 files changed, 9 insertions, 1 deletions
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 <vector>
#include <libcamera/base/class.h>
+#include <libcamera/base/span.h>
#include <libcamera/file_descriptor.h>
@@ -34,7 +35,14 @@ struct FrameMetadata {
Status status;
unsigned int sequence;
uint64_t timestamp;
- std::vector<Plane> planes;
+
+ Span<Plane> planes() { return planes_; }
+ Span<const Plane> planes() const { return planes_; }
+
+private:
+ friend class FrameBuffer;
+
+ std::vector<Plane> planes_;
};
class FrameBuffer final : public Extensible