9#include "private/qimagevideobuffer_p.h"
11#include <QtOpenGL/private/qopenglcompositor_p.h>
12#include <QtOpenGL/private/qopenglframebufferobject_p.h>
14#include <QtQuick/qquickwindow.h>
39 auto fbo = std::make_unique<QOpenGLFramebufferObject>(nativeSize);
47 if (!fbo->isValid()) {
52 auto videoBuffer = std::make_unique<QOpenGLVideoBuffer>(std::move(fbo));
55 auto image = videoBuffer->ensureImageBuffer().underlyingImage();
100 QPointer<QQuickWindow> m_quickWindow;
114 if (
static_cast<bool>(m_grabber) == active)
123 m_grabber = createGrabber();
140std::unique_ptr<QEglfsScreenCapture::Grabber> QEglfsScreenCapture::createGrabber()
142 auto screen = source<ScreenSource>();
152 QLatin1String(
"Target window is not set for OpenGL compositor"));
156 return std::make_unique<Grabber>(*
this,
screen);
162 auto quickWindow = qobject_cast<QQuickWindow *>(window);
166 return quickWindow->screen() == screen;
169 if (
it != windows.
end()) {
171 return std::make_unique<QuickGrabber>(*
this,
screen, qobject_cast<QQuickWindow *>(*
it));
Grabber(QEglfsScreenCapture &screenCapture, QScreen *screen)
QVideoFrameFormat m_format
QVideoFrameFormat format()
QVideoFrame grabFrame() override
QVideoFrame grabFrame() override
QuickGrabber(QEglfsScreenCapture &screenCapture, QScreen *screen, QQuickWindow *quickWindow)
~QEglfsScreenCapture() override
QVideoFrameFormat frameFormat() const override
bool setActiveInternal(bool active) override
static bool isSupported()
void setFrameRate(qreal rate)
void errorUpdated(QPlatformSurfaceCapture::Error error, const QString &description)
void addFrameCallback(Object &object, Method method)
void updateError(QPlatformSurfaceCapture::Error error, const QString &description={})
static QWindowList topLevelWindows()
Returns a list of the top-level windows in the application.
QString platformName
The name of the underlying platform plugin.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
A generic OpenGL-based compositor.
static QOpenGLCompositor * instance()
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
The QScreen class is used to query screen properties. \inmodule QtGui.
qreal refreshRate
the approximate vertical refresh rate of the screen in Hz
The QVideoFrame class represents a frame of video data.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static QOpenGLCompositor * compositor
QLatin1StringView QLatin1String