From a13676f2bb9a86ced75ed640f571512cf1a76afe Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 6 Sep 2021 01:35:22 +0300 Subject: qcam: Use Image class to access pixel data Replace the manual implementation of frame buffer mapping with the Image class to improve code sharing. The ViewFinder API is updated to take an Image pointer in the render() function to prepare for multi-planar buffer support. Signed-off-by: Laurent Pinchart Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- src/qcam/viewfinder_qt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/qcam/viewfinder_qt.cpp') diff --git a/src/qcam/viewfinder_qt.cpp b/src/qcam/viewfinder_qt.cpp index a0bf99b0..fef6d53e 100644 --- a/src/qcam/viewfinder_qt.cpp +++ b/src/qcam/viewfinder_qt.cpp @@ -19,6 +19,7 @@ #include +#include "../cam/image.h" #include "format_converter.h" static const QMap nativeFormats @@ -78,15 +79,14 @@ int ViewFinderQt::setFormat(const libcamera::PixelFormat &format, return 0; } -void ViewFinderQt::render(libcamera::FrameBuffer *buffer, - libcamera::Span mem) +void ViewFinderQt::render(libcamera::FrameBuffer *buffer, Image *image) { if (buffer->planes().size() != 1) { qWarning() << "Multi-planar buffers are not supported"; return; } - unsigned char *memory = mem.data(); + unsigned char *memory = image->data(0).data(); size_t size = buffer->metadata().planes()[0].bytesused; { -- cgit v1.2.1