8#include <private/qimagevideobuffer_p.h>
10#include <QtOpenGL/private/qopenglcompositor_p.h>
11#include <QtOpenGL/private/qopenglframebufferobject_p.h>
19 auto context = std::make_unique<QOpenGLContext>();
20 context->setShareContext(shareContext);
23 qWarning() <<
"Couldn't create an OpenGL context for QOpenGLVideoBuffer";
54 return context->makeCurrent(surface);
78 m_imageBuffer->unmap();
84 return m_fbo->texture();
93 qWarning() <<
"Failed to set current OpenGL context";
95 m_imageBuffer = std::make_unique<QImageVideoBuffer>(m_fbo->toImage(
false));
98 return *m_imageBuffer;
The QAbstractVideoBuffer class is an abstraction for video data. \inmodule QtMultimedia.
MapData map(QVideoFrame::MapMode mode) override
Independently maps the planes of a video buffer to memory.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void deleteLater()
\threadsafe
void create()
Allocates the platform resources associated with the offscreen surface.
void setFormat(const QSurfaceFormat &format)
Sets the offscreen surface format.
static QOpenGLCompositor * instance()
quint64 textureHandle(QRhi *, int plane) const override
Returns a texture handle to the data buffer.
QImageVideoBuffer & ensureImageBuffer()
void unmap() override
Releases the memory mapped by the map() function.
QOpenGLVideoBuffer(std::unique_ptr< QOpenGLFramebufferObject > fbo)
QVideoFrame::MapMode mapMode() const override
MapData map(QVideoFrame::MapMode mode) override
Independently maps the planes of a video buffer to memory.
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
static QThread * currentThread()
void finished(QPrivateSignal)
The QVideoFrame class represents a frame of video data.
MapMode
Enumerates how a video buffer's data is mapped to system memory.
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE QOpenGLContext * createContext(QOpenGLContext *shareContext)
static bool setCurrentOpenGLContext()
unsigned long long quint64