summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Trillmann <jens.trillmann+qt@googlemail.com>2023-03-06 19:50:23 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-07 11:19:54 +0000
commit1c873f76ac44006ad7e7f729372c10fe009d80eb (patch)
tree71408f4fdb4a17b5f5973ceb6a21dc22d7c2606a
parent5c7273255470144b6f3f176d4d75da5dde85b3f9 (diff)
Detect QVideoFrame changes in QSGVideoNode
When recalculating the texture geometry of a QSGVideoNode the parameters are checked to avoid costly recalculation. But the check does not include the QVideoFrame orientation and mirrored state. Therefor changes in these properties are not considered and don't trigger an update of the geometry. Change-Id: I0eeab583865bbc03a5b75a948063d2e13d12fe7a Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 40740c4b46731de1c56166f206230a9219814957) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/multimediaquick/qsgvideonode_p.cpp20
-rw-r--r--src/multimediaquick/qsgvideonode_p.h2
2 files changed, 19 insertions, 3 deletions
diff --git a/src/multimediaquick/qsgvideonode_p.cpp b/src/multimediaquick/qsgvideonode_p.cpp
index 6ebf9bce9..1bc2b5635 100644
--- a/src/multimediaquick/qsgvideonode_p.cpp
+++ b/src/multimediaquick/qsgvideonode_p.cpp
@@ -227,8 +227,10 @@ QSGVideoMaterial::QSGVideoMaterial(const QVideoFrameFormat &format) :
QSGVideoNode::QSGVideoNode(QQuickVideoOutput *parent, const QVideoFrameFormat &format)
: m_parent(parent),
- m_orientation(-1),
- m_format(format)
+ m_orientation(-1),
+ m_frameOrientation(-1),
+ m_frameMirrored(false),
+ m_format(format)
{
setFlag(QSGNode::OwnsMaterial);
setFlag(QSGNode::OwnsGeometry);
@@ -303,12 +305,24 @@ void QSGVideoNode::setSubtitleGeometry()
/* Update the vertices and texture coordinates. Orientation must be in {0,90,180,270} */
void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &textureRect, int orientation)
{
- if (rect == m_rect && textureRect == m_textureRect && orientation == m_orientation)
+ bool frameChanged = false;
+ if (m_material) {
+ if (m_material->m_currentFrame.rotationAngle() != m_frameOrientation
+ || m_material->m_currentFrame.mirrored() != m_frameMirrored) {
+ frameChanged = true;
+ }
+ }
+ if (rect == m_rect && textureRect == m_textureRect && orientation == m_orientation
+ && !frameChanged)
return;
m_rect = rect;
m_textureRect = textureRect;
m_orientation = orientation;
+ if (m_material) {
+ m_frameOrientation = m_material->m_currentFrame.rotationAngle();
+ m_frameMirrored = m_material->m_currentFrame.mirrored();
+ }
int videoRotation = orientation;
videoRotation += m_material ? m_material->m_currentFrame.rotationAngle() : 0;
videoRotation %= 360;
diff --git a/src/multimediaquick/qsgvideonode_p.h b/src/multimediaquick/qsgvideonode_p.h
index bc1405334..be957d581 100644
--- a/src/multimediaquick/qsgvideonode_p.h
+++ b/src/multimediaquick/qsgvideonode_p.h
@@ -86,6 +86,8 @@ private:
QRectF m_rect;
QRectF m_textureRect;
int m_orientation;
+ int m_frameOrientation;
+ bool m_frameMirrored;
QVideoFrameFormat m_format;
QSGVideoMaterial *m_material;