5#include <QPlatformSurfaceEvent>
8#include <private/qguiapplication_p.h>
9#include <private/qmemoryvideobuffer_p.h>
10#include <qpa/qplatformintegration.h>
16#if defined(Q_OS_DARWIN)
18#elif defined (Q_OS_WIN)
44 q->setSurfaceType(surfaceType);
45 switch (surfaceType) {
73 q, &QVideoWindow::setVideoFrame);
115 QRhi::Flags rhiFlags = {};
119 m_fallbackSurface.reset(QRhiGles2InitParams::newFallbackSurface(
q->format()));
121 params.fallbackSurface = m_fallbackSurface.get();
131 params.inst =
q->vulkanInstance();
140 params.enableDebugLayer =
true;
145#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
195 { 4 *
sizeof(float) }
228 for (
int i = 0;
i < textureDesc->nplanes; ++
i)
337 if (frameRotationIndex % 2)
362 qWarning(
"beginFrame failed with %d, retry",
r);
381 float xscale = mirrorFrame * float(videoRect.
width())/float(
rect.width());
391 maxNits = 100 *
info.limits.colorComponentValue.maxColorComponentValue;
393 maxNits =
info.limits.luminanceInNits.maxLuminance;
416 cb->setViewport({ 0, 0, float(
size.width()), float(
size.height()) });
419 quint32 vertexOffset =
quint32(
sizeof(
float)) * 16 * frameRotationIndex;
421 cb->setVertexInput(0, 1, &vbufBinding);
428 cb->setVertexInput(0, 1, &vbufBinding);
457 return d->m_sink.get();
462 return d->aspectRatioMode;
467 if (d->aspectRatioMode ==
mode)
469 d->aspectRatioMode =
mode;
483 d->releaseSwapChain();
484 d->isExposed =
false;
488 d->isExposed = isExposed();
502 if (!d->backingStore)
511 if (d->m_currentFrame.subtitleText() !=
frame.subtitleText())
512 d->m_subtitleDirty =
true;
513 d->m_currentFrame =
frame;
514 d->m_texturesDirty =
true;
521#include "moc_qvideowindow_p.cpp"
IOBluetoothDevice * device
The QBackingStore class provides a drawing area for QWindow.
QPaintDevice * paintDevice()
Returns the paint device for this surface.
void beginPaint(const QRegion &)
Begins painting on the backing store surface in the given region.
void flush(const QRegion ®ion, QWindow *window=nullptr, const QPoint &offset=QPoint())
Flushes the given region from the specified window onto the screen.
void resize(const QSize &size)
Sets the size of the window surface to size.
QSize size() const
Returns the current size of the window surface.
void endPaint()
Ends painting.
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
static bool testAttribute(Qt::ApplicationAttribute attribute)
Returns true if attribute attribute is set; otherwise returns false.
static QPlatformIntegration * platformIntegration()
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
void scale(const QVector3D &vector)
Multiplies this matrix by another that scales coordinates by the components of vector.
void translate(const QVector3D &vector)
Multiplies this matrix by another that translates coordinates by the components of vector.
The QMemoryVideoBuffer class provides a system memory allocated video data buffer.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
The QPainter class performs low-level painting on widgets and other paint devices.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
\inmodule QtCore\reentrant
constexpr void moveCenter(const QPoint &p) noexcept
Moves the rectangle, leaving the center point at the given position.
constexpr int height() const noexcept
Returns the height of the rectangle.
QRect intersected(const QRect &other) const noexcept
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int width() const noexcept
Returns the width of the rectangle.
The QResizeEvent class contains event parameters for resize events.
QPair< QRhiBuffer *, quint32 > VertexInput
Synonym for QPair<QRhiBuffer *, quint32>.
void setShaderResourceBindings(QRhiShaderResourceBindings *srb)
Associates with srb describing the resource binding layout and the resources (QRhiBuffer,...
void setVertexInputLayout(const QRhiVertexInputLayout &layout)
Specifies the vertex input layout.
void setShaderStages(std::initializer_list< QRhiShaderStage > list)
Sets the list of shader stages.
void setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
Associates with the specified QRhiRenderPassDescriptor desc.
void setTopology(Topology t)
Sets the primitive topology t.
virtual bool create()=0
Creates the corresponding native graphics resources.
void updateDynamicBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Enqueues updating a region of a QRhiBuffer buf created with the type QRhiBuffer::Dynamic.
void uploadStaticBuffer(QRhiBuffer *buf, quint32 offset, quint32 size, const void *data)
Enqueues updating a region of a QRhiBuffer buf created with the type QRhiBuffer::Immutable or QRhiBuf...
void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc)
Enqueues uploading the image data for one or more mip levels in one or more layers of the texture tex...
static QRhiShaderResourceBinding sampledTexture(int binding, StageFlags stage, QRhiTexture *tex, QRhiSampler *sampler)
static QRhiShaderResourceBinding uniformBuffer(int binding, StageFlags stage, QRhiBuffer *buf)
static QRhi * create(Implementation impl, QRhiInitParams *params, Flags flags={}, QRhiNativeHandles *importDevice=nullptr)
FrameOpResult
Describes the result of operations that can have a soft failure.
@ FrameOpSwapChainOutOfDate
The QScreen class is used to query screen properties. \inmodule QtGui.
static QShader fromSerialized(const QByteArray &data)
Creates a new QShader instance from the given data.
constexpr QSize toSize() const noexcept
Returns an integer based copy of this size.
QSize scaled(int w, int h, Qt::AspectRatioMode mode) const noexcept
void transpose() noexcept
Swaps the width and height values.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
SurfaceType
The SurfaceType enum describes what type of surface this is.
The QVideoFrame class represents a frame of video data.
bool mirrored() const
Returns whether the frame should be mirrored before displaying.
void paint(QPainter *painter, const QRectF &rect, const PaintOptions &options)
Uses a QPainter, {painter}, to render this QVideoFrame to rect.
QVideoFrameFormat surfaceFormat() const
Returns the surface format of this video frame.
QString subtitleText() const
Returns the subtitle text that should be rendered together with this video frame.
QSize size() const
Returns the dimensions of a video frame.
bool isValid() const
Identifies whether a video frame is valid.
RotationAngle rotationAngle() const
Returns the angle the frame should be rotated clockwise before displaying.
The QVideoSink class represents a generic sink for video data.
void videoFrameChanged(const QVideoFrame &frame) QT6_ONLY(const)
Signals when the video frame changes.
void updateSubtitle(QRhiResourceUpdateBatch *rub, const QSize &frameSize)
std::unique_ptr< QRhiShaderResourceBindings > m_shaderResourceBindings
std::unique_ptr< QVideoFrameTextures > m_frameTextures
std::unique_ptr< QRhiShaderResourceBindings > m_subtitleResourceBindings
Qt::AspectRatioMode aspectRatioMode
QVideoTextureHelper::SubtitleLayout m_subtitleLayout
std::unique_ptr< QRhiGraphicsPipeline > m_subtitlePipeline
std::unique_ptr< QRhiSwapChain > m_swapChain
std::unique_ptr< QRhiBuffer > m_uniformBuf
std::unique_ptr< QVideoSink > m_sink
QVideoFrame m_currentFrame
QVideoFrame m_videoFrameSlots[NVideoFrameSlots]
std::unique_ptr< QRhiRenderPassDescriptor > m_renderPass
std::unique_ptr< QRhiGraphicsPipeline > m_graphicsPipeline
std::unique_ptr< QRhi > m_rhi
QRhi::Implementation m_graphicsApi
std::unique_ptr< QRhiTexture > m_subtitleTexture
QBackingStore * backingStore
void setupGraphicsPipeline(QRhiGraphicsPipeline *pipeline, QRhiShaderResourceBindings *bindings, const QVideoFrameFormat &fmt)
QVideoWindowPrivate(QVideoWindow *q)
std::unique_ptr< QRhiBuffer > m_subtitleUniformBuf
std::unique_ptr< QRhiBuffer > m_vertexBuf
std::unique_ptr< QRhiSampler > m_textureSampler
void updateTextures(QRhiResourceUpdateBatch *rub)
void setAspectRatioMode(Qt::AspectRatioMode mode)
void aspectRatioModeChanged(Qt::AspectRatioMode mode)
bool event(QEvent *e) override
Override this to handle any event (ev) sent to the window.
void resizeEvent(QResizeEvent *) override
Override this to handle resize events (ev).
Qt::AspectRatioMode aspectRatioMode() const
QVideoWindow(QScreen *screen=nullptr)
Q_INVOKABLE QVideoSink * videoSink() const
virtual bool event(QEvent *) override
Override this to handle any event (ev) sent to the window.
Combined button and popup list for selecting options.
QString vertexShaderFileName(const QVideoFrameFormat &format)
QString fragmentShaderFileName(const QVideoFrameFormat &format, QRhiSwapChain::Format surfaceFormat)
const TextureDescription * textureDescription(QVideoFrameFormat::PixelFormat format)
std::unique_ptr< QVideoFrameTextures > createTextures(QVideoFrame &frame, QRhi *rhi, QRhiResourceUpdateBatch *rub, std::unique_ptr< QVideoFrameTextures > &&oldTextures)
void updateUniformData(QByteArray *dst, const QVideoFrameFormat &format, const QVideoFrame &frame, const QMatrix4x4 &transform, float opacity, float maxNits)
GLboolean GLboolean GLboolean b
GLenum GLenum GLuint GLint GLint GLint yscale
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLuint GLint GLint xscale
GLint GLsizei GLsizei GLenum format
GLuint GLenum GLenum transform
GLdouble GLdouble GLdouble GLdouble q
static constexpr QSize frameSize(const T &frame)
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
QVideoFrameFormat::PixelFormat fmt
static QT_BEGIN_NAMESPACE QSurface::SurfaceType platformSurfaceType()
static const float g_vw_quad[]
static QShader vwGetShader(const QString &name)
QImage scaled(const QImage &image)
[0]
QFileInfo info(fileName)
[8]
bool update(const QSize &frameSize, QString text)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent