/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Linaro
*
* viewfinderGL.cpp - OpenGL Viewfinder for rendering by OpenGL shader
*/
#include "viewfinder_gl.h"
#include <QByteArray>
#include <QFile>
#include <QImage>
#include <libcamera/formats.h>
static const QList<libcamera::PixelFormat> supportedFormats{
/* YUV - packed (single plane) */
libcamera::formats::UYVY,
libcamera::formats::VYUY,
libcamera::formats::YUYV,
libcamera::formats::YVYU,
/* YUV - semi planar (two planes) */
libcamera::formats::NV12,
libcamera::formats::NV21,
libcamera::formats::NV16,
libcamera::formats::NV61,
libcamera::formats::NV24,
libcamera::formats::NV42,
/* YUV - fully planar (three planes) */
libcamera::formats::YUV420,
libcamera::formats::YVU420,
/* RGB */
libcamera::formats::ABGR8888,
libcamera::formats::ARGB8888,
libcamera::formats::BGRA8888,
libcamera::formats::RGBA8888,
libcamera::formats::BGR888,
libcamera::formats::RGB888,
};
ViewFinderGL::ViewFinderGL(QWidget *parent)
: QOpenGLWidget(parent), buffer_(nullptr), data_(nullptr),
vertexBuffer_(QOpenGLBuffer::VertexBuffer)
{
}
ViewFinderGL::~ViewFinderGL()
{
removeShader();
}
const QList<libcamera::PixelFormat> &ViewFinderGL::nativeFormats() const
{
return supportedFormats;
}
|