summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_rgb.cpp3
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_texture.cpp3
-rw-r--r--src/qtmultimediaquicktools/qsgvideonode_yuv.cpp12
3 files changed, 6 insertions, 12 deletions
diff --git a/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp b/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp
index 4b6d61f16..c9f27869c 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp
+++ b/src/qtmultimediaquicktools/qsgvideonode_rgb.cpp
@@ -91,6 +91,7 @@ public:
m_opacity(1.0)
{
setFlag(Blending, false);
+ m_texture.reset(new QSGVideoTexture);
}
QSGMaterialType *type() const override {
@@ -159,8 +160,6 @@ void QSGVideoMaterialRhiShader_RGB::updateSampledImage(RenderState &state, int b
return;
auto m = static_cast<QSGVideoMaterial_RGB *>(newMaterial);
- if (!m->m_texture)
- m->m_texture.reset(new QSGVideoTexture);
m->m_frameMutex.lock();
auto frame = m->m_frame;
diff --git a/src/qtmultimediaquicktools/qsgvideonode_texture.cpp b/src/qtmultimediaquicktools/qsgvideonode_texture.cpp
index 33deef8c2..68e0d2d1a 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_texture.cpp
+++ b/src/qtmultimediaquicktools/qsgvideonode_texture.cpp
@@ -116,6 +116,7 @@ public:
m_opacity(1.0)
{
setFlag(Blending, false);
+ m_texture.reset(new QSGVideoTexture);
}
~QSGVideoMaterial_Texture()
@@ -195,8 +196,6 @@ void QSGVideoMaterialRhiShader_Texture::updateSampledImage(RenderState &state, i
return;
auto m = static_cast<QSGVideoMaterial_Texture *>(newMaterial);
- if (!m->m_texture)
- m->m_texture.reset(new QSGVideoTexture);
m->m_frameMutex.lock();
auto size = m->m_frame.size();
diff --git a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
index e825838ba..40eed8fbb 100644
--- a/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
+++ b/src/qtmultimediaquicktools/qsgvideonode_yuv.cpp
@@ -231,11 +231,6 @@ bool QSGVideoMaterialRhiShader_YUV::updateUniformData(RenderState &state, QSGMat
changed = true;
}
- if (!m->m_textures[0]) {
- m->m_textures[0].reset(new QSGVideoTexture);
- m->m_textures[1].reset(new QSGVideoTexture);
- }
-
m->m_frameMutex.lock();
mapFrame(m);
m->m_frameMutex.unlock();
@@ -294,9 +289,6 @@ void QSGVideoMaterialRhiShader_YUV_YV::mapFrame(QSGVideoMaterial_YUV *m)
if (!m->m_frame.isValid() || !m->m_frame.map(QAbstractVideoBuffer::ReadOnly))
return;
- if (!m->m_textures[2])
- m->m_textures[2].reset(new QSGVideoTexture);
-
int y = 0;
int u = m->m_frame.pixelFormat() == QVideoFrame::Format_YV12 ? 2 : 1;
int v = m->m_frame.pixelFormat() == QVideoFrame::Format_YV12 ? 1 : 2;
@@ -341,6 +333,10 @@ QSGVideoMaterial_YUV::QSGVideoMaterial_YUV(const QVideoSurfaceFormat &format) :
m_format(format),
m_opacity(1.0)
{
+ m_textures[0].reset(new QSGVideoTexture);
+ m_textures[1].reset(new QSGVideoTexture);
+ m_textures[2].reset(new QSGVideoTexture);
+
switch (format.yCbCrColorSpace()) {
case QVideoSurfaceFormat::YCbCr_JPEG:
m_colorMatrix = QMatrix4x4(