diff options
-rw-r--r-- | src/qcam/main_window.cpp | 3 | ||||
-rw-r--r-- | src/qcam/viewfinder.h | 3 | ||||
-rw-r--r-- | src/qcam/viewfinder_gl.cpp | 7 | ||||
-rw-r--r-- | src/qcam/viewfinder_gl.h | 3 | ||||
-rw-r--r-- | src/qcam/viewfinder_qt.cpp | 3 | ||||
-rw-r--r-- | src/qcam/viewfinder_qt.h | 3 |
6 files changed, 12 insertions, 10 deletions
diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index b933ab21..ae51fa67 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -448,7 +448,8 @@ int MainWindow::startCapture() /* Configure the viewfinder. */ ret = viewfinder_->setFormat(vfConfig.pixelFormat, - QSize(vfConfig.size.width, vfConfig.size.height)); + QSize(vfConfig.size.width, vfConfig.size.height), + vfConfig.stride); if (ret < 0) { qInfo() << "Failed to set viewfinder format"; return ret; diff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h index fb462835..4c2102a6 100644 --- a/src/qcam/viewfinder.h +++ b/src/qcam/viewfinder.h @@ -23,7 +23,8 @@ public: virtual const QList<libcamera::PixelFormat> &nativeFormats() const = 0; - virtual int setFormat(const libcamera::PixelFormat &format, const QSize &size) = 0; + virtual int setFormat(const libcamera::PixelFormat &format, const QSize &size, + unsigned int stride) = 0; virtual void render(libcamera::FrameBuffer *buffer, Image *image) = 0; virtual void stop() = 0; diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp index 32232faa..aeb1ea02 100644 --- a/src/qcam/viewfinder_gl.cpp +++ b/src/qcam/viewfinder_gl.cpp @@ -72,7 +72,7 @@ const QList<libcamera::PixelFormat> &ViewFinderGL::nativeFormats() const } int ViewFinderGL::setFormat(const libcamera::PixelFormat &format, - const QSize &size) + const QSize &size, unsigned int stride) { if (format != format_) { /* @@ -92,6 +92,7 @@ int ViewFinderGL::setFormat(const libcamera::PixelFormat &format, } size_ = size; + stride_ = stride; updateGeometry(); return 0; @@ -119,10 +120,6 @@ void ViewFinderGL::render(libcamera::FrameBuffer *buffer, Image *image) renderComplete(buffer_); image_ = image; - /* - * \todo Get the stride from the buffer instead of computing it naively - */ - stride_ = buffer->metadata().planes()[0].bytesused / size_.height(); update(); buffer_ = buffer; } diff --git a/src/qcam/viewfinder_gl.h b/src/qcam/viewfinder_gl.h index 72a60ecb..2b2b1e86 100644 --- a/src/qcam/viewfinder_gl.h +++ b/src/qcam/viewfinder_gl.h @@ -38,7 +38,8 @@ public: const QList<libcamera::PixelFormat> &nativeFormats() const override; - int setFormat(const libcamera::PixelFormat &format, const QSize &size) override; + int setFormat(const libcamera::PixelFormat &format, const QSize &size, + unsigned int stride) override; void render(libcamera::FrameBuffer *buffer, Image *image) override; void stop() override; diff --git a/src/qcam/viewfinder_qt.cpp b/src/qcam/viewfinder_qt.cpp index 0d357d86..cd051760 100644 --- a/src/qcam/viewfinder_qt.cpp +++ b/src/qcam/viewfinder_qt.cpp @@ -52,7 +52,8 @@ const QList<libcamera::PixelFormat> &ViewFinderQt::nativeFormats() const } int ViewFinderQt::setFormat(const libcamera::PixelFormat &format, - const QSize &size) + const QSize &size, + [[maybe_unused]] unsigned int stride) { image_ = QImage(); diff --git a/src/qcam/viewfinder_qt.h b/src/qcam/viewfinder_qt.h index 6b48ef48..756f3fa3 100644 --- a/src/qcam/viewfinder_qt.h +++ b/src/qcam/viewfinder_qt.h @@ -31,7 +31,8 @@ public: const QList<libcamera::PixelFormat> &nativeFormats() const override; - int setFormat(const libcamera::PixelFormat &format, const QSize &size) override; + int setFormat(const libcamera::PixelFormat &format, const QSize &size, + unsigned int stride) override; void render(libcamera::FrameBuffer *buffer, Image *image) override; void stop() override; |