summaryrefslogtreecommitdiff
path: root/src/qcam/viewfinder_qt.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-06 01:43:36 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-09-07 19:18:54 +0300
commita339d055cc7ebd92b89adadd3044f69f8f9653b8 (patch)
tree82015eaf6aa67ac9d4e542a1ee7bc91af4b6f609 /src/qcam/viewfinder_qt.cpp
parentc20ad98c2a96d31847b0ef4b500e1e7a221b67c0 (diff)
qcam: viewfinder_qt: Support multi-planar buffers
Now that the ViewFinderQt receives an Image, move the Converter API to take an Image as well, and enable multi-planar buffer support. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/qcam/viewfinder_qt.cpp')
-rw-r--r--src/qcam/viewfinder_qt.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/qcam/viewfinder_qt.cpp b/src/qcam/viewfinder_qt.cpp
index fef6d53e..0d357d86 100644
--- a/src/qcam/viewfinder_qt.cpp
+++ b/src/qcam/viewfinder_qt.cpp
@@ -7,6 +7,7 @@
#include "viewfinder_qt.h"
+#include <assert.h>
#include <stdint.h>
#include <utility>
@@ -81,12 +82,6 @@ int ViewFinderQt::setFormat(const libcamera::PixelFormat &format,
void ViewFinderQt::render(libcamera::FrameBuffer *buffer, Image *image)
{
- if (buffer->planes().size() != 1) {
- qWarning() << "Multi-planar buffers are not supported";
- return;
- }
-
- unsigned char *memory = image->data(0).data();
size_t size = buffer->metadata().planes()[0].bytesused;
{
@@ -103,8 +98,9 @@ void ViewFinderQt::render(libcamera::FrameBuffer *buffer, Image *image)
* \todo Get the stride from the buffer instead of
* computing it naively
*/
- image_ = QImage(memory, size_.width(), size_.height(),
- size / size_.height(),
+ assert(buffer->planes().size() == 1);
+ image_ = QImage(image->data(0).data(), size_.width(),
+ size_.height(), size / size_.height(),
::nativeFormats[format_]);
std::swap(buffer, buffer_);
} else {
@@ -112,7 +108,7 @@ void ViewFinderQt::render(libcamera::FrameBuffer *buffer, Image *image)
* Otherwise, convert the format and release the frame
* buffer immediately.
*/
- converter_.convert(memory, size, &image_);
+ converter_.convert(image, size, &image_);
}
}