diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-09-02 04:29:03 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-09-07 19:18:31 +0300 |
commit | 32635054bc76e2ababd8ea2177fca1f88229541a (patch) | |
tree | 8e263f2a14a1dd8ba7e1984693f7a5125c7e4837 /src/cam | |
parent | 9df775c7574520632547c2f4db236b7d84f6e3c3 (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 'src/cam')
-rw-r--r-- | src/cam/camera_session.cpp | 4 | ||||
-rw-r--r-- | src/cam/file_sink.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp index 60d640f2..32a373a9 100644 --- a/src/cam/camera_session.cpp +++ b/src/cam/camera_session.cpp @@ -374,9 +374,9 @@ void CameraSession::processRequest(Request *request) << " bytesused: "; unsigned int nplane = 0; - for (const FrameMetadata::Plane &plane : metadata.planes) { + for (const FrameMetadata::Plane &plane : metadata.planes()) { info << plane.bytesused; - if (++nplane < metadata.planes.size()) + if (++nplane < metadata.planes().size()) info << "/"; } } diff --git a/src/cam/file_sink.cpp b/src/cam/file_sink.cpp index 0b529e3e..0fc7d621 100644 --- a/src/cam/file_sink.cpp +++ b/src/cam/file_sink.cpp @@ -110,7 +110,7 @@ void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer) for (unsigned int i = 0; i < buffer->planes().size(); ++i) { const FrameBuffer::Plane &plane = buffer->planes()[i]; - const FrameMetadata::Plane &meta = buffer->metadata().planes[i]; + const FrameMetadata::Plane &meta = buffer->metadata().planes()[i]; uint8_t *data = planeData_[&plane]; unsigned int length = std::min(meta.bytesused, plane.length); |