qcam: Pass color space to ViewFinder::setFormat()
To prepare for color space support in the viewfinder, pass the color space to the setFormat() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
@@ -447,9 +447,13 @@ int MainWindow::startCapture()
|
||||
else
|
||||
rawStream_ = nullptr;
|
||||
|
||||
/* Configure the viewfinder. */
|
||||
/*
|
||||
* Configure the viewfinder. If no color space is reported, default to
|
||||
* sYCC.
|
||||
*/
|
||||
ret = viewfinder_->setFormat(vfConfig.pixelFormat,
|
||||
QSize(vfConfig.size.width, vfConfig.size.height),
|
||||
vfConfig.colorSpace.value_or(ColorSpace::Sycc),
|
||||
vfConfig.stride);
|
||||
if (ret < 0) {
|
||||
qInfo() << "Failed to set viewfinder format";
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QList>
|
||||
#include <QSize>
|
||||
|
||||
#include <libcamera/color_space.h>
|
||||
#include <libcamera/formats.h>
|
||||
#include <libcamera/framebuffer.h>
|
||||
|
||||
@@ -24,6 +25,7 @@ public:
|
||||
virtual const QList<libcamera::PixelFormat> &nativeFormats() const = 0;
|
||||
|
||||
virtual int setFormat(const libcamera::PixelFormat &format, const QSize &size,
|
||||
const libcamera::ColorSpace &colorSpace,
|
||||
unsigned int stride) = 0;
|
||||
virtual void render(libcamera::FrameBuffer *buffer, Image *image) = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
@@ -71,8 +71,9 @@ const QList<libcamera::PixelFormat> &ViewFinderGL::nativeFormats() const
|
||||
return supportedFormats;
|
||||
}
|
||||
|
||||
int ViewFinderGL::setFormat(const libcamera::PixelFormat &format,
|
||||
const QSize &size, unsigned int stride)
|
||||
int ViewFinderGL::setFormat(const libcamera::PixelFormat &format, const QSize &size,
|
||||
[[maybe_unused]] const libcamera::ColorSpace &colorSpace,
|
||||
unsigned int stride)
|
||||
{
|
||||
if (format != format_) {
|
||||
/*
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
const QList<libcamera::PixelFormat> &nativeFormats() const override;
|
||||
|
||||
int setFormat(const libcamera::PixelFormat &format, const QSize &size,
|
||||
const libcamera::ColorSpace &colorSpace,
|
||||
unsigned int stride) override;
|
||||
void render(libcamera::FrameBuffer *buffer, Image *image) override;
|
||||
void stop() override;
|
||||
|
||||
@@ -54,8 +54,9 @@ const QList<libcamera::PixelFormat> &ViewFinderQt::nativeFormats() const
|
||||
return formats;
|
||||
}
|
||||
|
||||
int ViewFinderQt::setFormat(const libcamera::PixelFormat &format,
|
||||
const QSize &size, unsigned int stride)
|
||||
int ViewFinderQt::setFormat(const libcamera::PixelFormat &format, const QSize &size,
|
||||
[[maybe_unused]] const libcamera::ColorSpace &colorSpace,
|
||||
unsigned int stride)
|
||||
{
|
||||
image_ = QImage();
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
const QList<libcamera::PixelFormat> &nativeFormats() const override;
|
||||
|
||||
int setFormat(const libcamera::PixelFormat &format, const QSize &size,
|
||||
const libcamera::ColorSpace &colorSpace,
|
||||
unsigned int stride) override;
|
||||
void render(libcamera::FrameBuffer *buffer, Image *image) override;
|
||||
void stop() override;
|
||||
|
||||
Reference in New Issue
Block a user