5#include <QtQuick/qsgmaterial.h>
7#include <QtMultimedia/private/qvideotexturehelper_p.h>
8#include <private/qquicktextnode_p.h>
9#include <private/qquickvideooutput_p.h>
10#include <private/qabstractvideobuffer_p.h>
85 return diff < 0 ? -1 : (diff > 0 ? 1 : 0);
127 for (
int plane = 0; plane < 3; ++plane)
140 if (!
state.isMatrixDirty() && !
state.isOpacityDirty())
143 if (
state.isOpacityDirty()) {
151 m->updateTextures(
state.rhi(),
state.resourceUpdateBatch());
164 if (binding < 1 || binding > 3)
185 m_frameOrientation(-1),
186 m_frameMirrored(
false),
197 delete m_subtitleTextNode;
204 updateSubtitle(
frame);
210 if (subtitleFrameSize.
isEmpty())
212 if (m_orientation % 180)
214 if (!m_subtitleLayout.
update(subtitleFrameSize,
frame.subtitleText()))
217 delete m_subtitleTextNode;
218 m_subtitleTextNode =
nullptr;
219 if (
frame.subtitleText().isEmpty())
228 setSubtitleGeometry();
231void QSGVideoNode::setSubtitleGeometry()
233 if (!m_subtitleTextNode)
239 float rotate = -1.f * m_orientation;
240 float yTranslate = 0;
241 float xTranslate = 0;
242 if (m_orientation == 90) {
243 yTranslate = m_rect.
height();
244 }
else if (m_orientation == 180) {
245 yTranslate = m_rect.
height();
246 xTranslate = m_rect.
width();
247 }
else if (m_orientation == 270) {
248 xTranslate = m_rect.
width();
252 transform.translate(m_rect.
x() + xTranslate, m_rect.
y() + yTranslate);
262 bool frameChanged =
false;
269 if (
rect == m_rect && textureRect == m_textureRect && orientation == m_orientation
274 m_textureRect = textureRect;
275 m_orientation = orientation;
280 int videoRotation = orientation;
282 videoRotation %= 360;
298 switch (videoRotation) {
342 setSubtitleGeometry();
The QColor class provides colors based on RGB, HSV or CMYK values.
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
\inmodule QtCore\reentrant
void addRectangleNode(const QRectF &rect, const QColor &color)
void addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color=QColor(), QQuickText::TextStyle style=QQuickText::Normal, const QColor &styleColor=QColor(), const QColor &anchorColor=QColor(), const QColor &selectionColor=QColor(), const QColor &selectedTextColor=QColor(), int selectionStart=-1, int selectionEnd=-1, int lineStart=0, int lineCount=-1)
Render video or camera viewfinder.
\inmodule QtCore\reentrant
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QPointF bottomLeft() const noexcept
Returns the position of the rectangle's bottom-left corner.
constexpr QPointF topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QPointF bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
constexpr QPointF topRight() const noexcept
Returns the position of the rectangle's top-right corner.
int resourceLimit(ResourceLimit limit) const
int currentFrameSlot() const
const QSGGeometry * geometry() const
Returns this node's geometry.
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
static const AttributeSet & defaultAttributes_TexturedPoint2D()
Convenience function which returns attributes to be used for textured 2D drawing.
Encapsulates the current rendering state during a call to QSGMaterialShader::updateUniformData() and ...
The QSGMaterialShader class represents a graphics API independent shader program.
void setShaderFileName(Stage stage, const QString &filename)
Sets the filename for the shader for the specified stage.
The QSGMaterial class encapsulates rendering state for a shader program.
void setFlag(Flags flags, bool on=true)
Sets the flags flags on this material if on is true; otherwise clears the attribute.
void appendChildNode(QSGNode *node)
Appends node to this node's list of children.
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
void setFlag(Flag, bool=true)
Sets the flag f on this node if enabled is true; otherwise clears the flag.
RenderMode
\value RenderMode2D Normal 2D rendering \value RenderMode2DNoDepthBuffer Normal 2D rendering with dep...
QSGVideoMaterialRhiShader(const QVideoFrameFormat &format)
bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override
This function is called by the scene graph to prepare use of sampled images in the shader,...
QVideoFrameFormat m_format
QVideoFrame m_videoFrameSlots[NVideoFrameSlots]
QVideoFrame m_currentFrame
QSGMaterialShader * createShader(QSGRendererInterface::RenderMode) const override
This function returns a new instance of a the QSGMaterialShader implementation used to render geometr...
QSGMaterialType * type() const override
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
void updateTextures(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates)
QSGVideoMaterial(const QVideoFrameFormat &format)
void setCurrentFrame(const QVideoFrame &frame)
int compare(const QSGMaterial *other) const override
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
QVideoFrameFormat m_format
std::unique_ptr< QVideoFrameTextures > m_videoFrameTextures
QScopedPointer< QSGVideoTexture > m_textures[3]
void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect, int orientation)
QSGVideoNode(QQuickVideoOutput *parent, const QVideoFrameFormat &format)
void setCurrentFrame(const QVideoFrame &frame)
qint64 comparisonKey() const override
Returns a key suitable for comparing textures.
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
constexpr QSize toSize() const noexcept
Returns an integer based copy of this size.
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
void transpose() noexcept
Swaps the width and height values.
The QVideoFrame class represents a frame of video data.
bool mirrored() const
Returns whether the frame should be mirrored before displaying.
RotationAngle rotationAngle() const
Returns the angle the frame should be rotated clockwise before displaying.
Combined button and popup list for selecting options.
std::unique_ptr< QVideoFrameTextures > createTextures(QVideoFrame &frame, QRhi *rhi, QRhiResourceUpdateBatch *rub, std::unique_ptr< QVideoFrameTextures > &&oldTextures)
QVector3D Q_QUICK3DUTILS_EXPORT rotate(const QMatrix4x4 &m, const QVector3D &v)
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
GLsizei const GLfloat * v
[13]
GLint GLsizei GLsizei GLenum format
GLuint GLenum GLenum transform
static void qSetTex(QSGGeometry::TexturedPoint2D *v, const QPointF &p)
static QT_BEGIN_NAMESPACE void qSetGeom(QSGGeometry::TexturedPoint2D *v, const QPointF &p)
static void qSwapTex(QSGGeometry::TexturedPoint2D *v0, QSGGeometry::TexturedPoint2D *v1)
The QSGGeometry::TexturedPoint2D struct is a convenience struct for accessing 2D Points with texture ...
The QSGMaterialType class is used as a unique type token in combination with QSGMaterial.
bool update(const QSize &frameSize, QString text)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent