Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3 from sletta/no-change-during-rendering
[nemo-qtmultimedia-plugins] Don't change state during rendering.
  • Loading branch information
adenexter committed Jul 3, 2014
2 parents 1b744b4 + fe7c1b9 commit 600c246
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/videotexturebackend/videotexturebackend.cpp
Expand Up @@ -43,7 +43,6 @@
#include <QSGGeometryNode>
#include <QSGMaterial>
#include <QSGTexture>
#include <QSGTextureProvider>

#include <qpa/qplatformnativeinterface.h>
#include <private/qgstreamerelementcontrol_p.h>
Expand Down Expand Up @@ -103,6 +102,7 @@ class GStreamerVideoMaterial : public QSGMaterial

private:
friend class GStreamerVideoMaterialShader;
friend class GStreamerVideoNode;

GStreamerVideoTexture *m_texture;
};
Expand All @@ -114,6 +114,7 @@ class GStreamerVideoNode : public QSGGeometryNode
~GStreamerVideoNode();

void setBoundingRect(const QRectF &rect, int orientation, bool horizontalMirror, bool verticalMirror);
void preprocess();

private:
GStreamerVideoMaterial m_material;
Expand Down Expand Up @@ -310,8 +311,6 @@ void GStreamerVideoMaterialShader::updateState(
program()->setUniformValue(id_texture, 0);
}

material->m_texture->updateTexture();

const QRectF subRect = material->m_texture->normalizedTextureSubRect();
program()->setUniformValue(
id_subrect, QVector4D(subRect.x(), subRect.y(), subRect.width(), subRect.height()));
Expand Down Expand Up @@ -388,12 +387,20 @@ GStreamerVideoNode::GStreamerVideoNode(GStreamerVideoTexture *texture)
{
setGeometry(&m_geometry);
setMaterial(&m_material);
setFlag(UsePreprocess);
}

GStreamerVideoNode::~GStreamerVideoNode()
{
}

void GStreamerVideoNode::preprocess()
{
GStreamerVideoTexture *t = m_material.m_texture;
if (t && t->updateTexture())
markDirty(QSGNode::DirtyMaterial);
}

void GStreamerVideoNode::setBoundingRect(
const QRectF &rect, int orientation, bool horizontalMirror, bool verticalMirror)
{
Expand Down

0 comments on commit 600c246

Please sign in to comment.