Add default initialisation to various multimedia classes
Change-Id: I902de05984fdae152e2678e4cf2d401a0b670703 Reviewed-by: Jonas Rabbe <jonas.rabbe@gmail.com>
This commit is contained in:
committed by
Qt by Nokia
parent
1b7da9e0ad
commit
5705f70da1
@@ -174,7 +174,9 @@ public:
|
|||||||
|
|
||||||
QVideoSurfaceFormat m_format;
|
QVideoSurfaceFormat m_format;
|
||||||
QSize m_textureSize;
|
QSize m_textureSize;
|
||||||
GLuint m_textureIds[3];
|
|
||||||
|
static const uint Num_Texture_IDs = 3;
|
||||||
|
GLuint m_textureIds[Num_Texture_IDs];
|
||||||
|
|
||||||
qreal m_opacity;
|
qreal m_opacity;
|
||||||
QMatrix4x4 m_colorMatrix;
|
QMatrix4x4 m_colorMatrix;
|
||||||
@@ -187,6 +189,8 @@ QSGVideoMaterial_YUV420::QSGVideoMaterial_YUV420(const QVideoSurfaceFormat &form
|
|||||||
m_format(format),
|
m_format(format),
|
||||||
m_opacity(1.0)
|
m_opacity(1.0)
|
||||||
{
|
{
|
||||||
|
memset(m_textureIds, 0, sizeof(m_textureIds));
|
||||||
|
|
||||||
switch (format.yCbCrColorSpace()) {
|
switch (format.yCbCrColorSpace()) {
|
||||||
case QVideoSurfaceFormat::YCbCr_JPEG:
|
case QVideoSurfaceFormat::YCbCr_JPEG:
|
||||||
m_colorMatrix = QMatrix4x4(
|
m_colorMatrix = QMatrix4x4(
|
||||||
@@ -217,7 +221,7 @@ QSGVideoMaterial_YUV420::QSGVideoMaterial_YUV420(const QVideoSurfaceFormat &form
|
|||||||
QSGVideoMaterial_YUV420::~QSGVideoMaterial_YUV420()
|
QSGVideoMaterial_YUV420::~QSGVideoMaterial_YUV420()
|
||||||
{
|
{
|
||||||
if (!m_textureSize.isEmpty())
|
if (!m_textureSize.isEmpty())
|
||||||
glDeleteTextures(3, m_textureIds);
|
glDeleteTextures(Num_Texture_IDs, m_textureIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSGVideoMaterial_YUV420::bind()
|
void QSGVideoMaterial_YUV420::bind()
|
||||||
@@ -233,8 +237,8 @@ void QSGVideoMaterial_YUV420::bind()
|
|||||||
// Frame has changed size, recreate textures...
|
// Frame has changed size, recreate textures...
|
||||||
if (m_textureSize != m_frame.size()) {
|
if (m_textureSize != m_frame.size()) {
|
||||||
if (!m_textureSize.isEmpty())
|
if (!m_textureSize.isEmpty())
|
||||||
glDeleteTextures(3, m_textureIds);
|
glDeleteTextures(Num_Texture_IDs, m_textureIds);
|
||||||
glGenTextures(3, m_textureIds);
|
glGenTextures(Num_Texture_IDs, m_textureIds);
|
||||||
m_textureSize = m_frame.size();
|
m_textureSize = m_frame.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,9 @@ class QSGVideoMaterialShader_RGB : public QSGMaterialShader
|
|||||||
public:
|
public:
|
||||||
QSGVideoMaterialShader_RGB(QVideoFrame::PixelFormat pixelFormat)
|
QSGVideoMaterialShader_RGB(QVideoFrame::PixelFormat pixelFormat)
|
||||||
: QSGMaterialShader(),
|
: QSGMaterialShader(),
|
||||||
|
m_id_matrix(-1),
|
||||||
|
m_id_rgbTexture(-1),
|
||||||
|
m_id_opacity(-1),
|
||||||
m_pixelFormat(pixelFormat)
|
m_pixelFormat(pixelFormat)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class QMediaObjectPrivate
|
|||||||
Q_DECLARE_PUBLIC(QMediaObject)
|
Q_DECLARE_PUBLIC(QMediaObject)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QMediaObjectPrivate():metaDataControl(0), notifyTimer(0) {}
|
QMediaObjectPrivate(): service(0), metaDataControl(0), availabilityControl(0), notifyTimer(0), q_ptr(0) {}
|
||||||
virtual ~QMediaObjectPrivate() {}
|
virtual ~QMediaObjectPrivate() {}
|
||||||
|
|
||||||
void _q_notify();
|
void _q_notify();
|
||||||
|
|||||||
@@ -277,10 +277,12 @@ protected:
|
|||||||
GLuint m_textureInternalFormat;
|
GLuint m_textureInternalFormat;
|
||||||
GLenum m_textureType;
|
GLenum m_textureType;
|
||||||
int m_textureCount;
|
int m_textureCount;
|
||||||
GLuint m_textureIds[3];
|
|
||||||
int m_textureWidths[3];
|
static const uint Max_Textures = 3;
|
||||||
int m_textureHeights[3];
|
GLuint m_textureIds[Max_Textures];
|
||||||
int m_textureOffsets[3];
|
int m_textureWidths[Max_Textures];
|
||||||
|
int m_textureHeights[Max_Textures];
|
||||||
|
int m_textureOffsets[Max_Textures];
|
||||||
bool m_yuv;
|
bool m_yuv;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -298,6 +300,12 @@ QVideoSurfaceGLPainter::QVideoSurfaceGLPainter(QGLContext *context)
|
|||||||
#ifndef QT_OPENGL_ES
|
#ifndef QT_OPENGL_ES
|
||||||
glActiveTexture = (_glActiveTexture)m_context->getProcAddress(QLatin1String("glActiveTexture"));
|
glActiveTexture = (_glActiveTexture)m_context->getProcAddress(QLatin1String("glActiveTexture"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
memset(m_textureIds, 0, sizeof(m_textureIds));
|
||||||
|
memset(m_textureWidths, 0, sizeof(m_textureWidths));
|
||||||
|
memset(m_textureHeights, 0, sizeof(m_textureHeights));
|
||||||
|
memset(m_textureOffsets, 0, sizeof(m_textureOffsets));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVideoSurfaceGLPainter::~QVideoSurfaceGLPainter()
|
QVideoSurfaceGLPainter::~QVideoSurfaceGLPainter()
|
||||||
@@ -484,7 +492,7 @@ void QVideoSurfaceGLPainter::initRgbTextureInfo(
|
|||||||
m_textureInternalFormat = internalFormat;
|
m_textureInternalFormat = internalFormat;
|
||||||
m_textureFormat = format;
|
m_textureFormat = format;
|
||||||
m_textureType = type;
|
m_textureType = type;
|
||||||
m_textureCount = 1;
|
m_textureCount = 1; // Note: ensure this is always <= Max_Textures
|
||||||
m_textureWidths[0] = size.width();
|
m_textureWidths[0] = size.width();
|
||||||
m_textureHeights[0] = size.height();
|
m_textureHeights[0] = size.height();
|
||||||
m_textureOffsets[0] = 0;
|
m_textureOffsets[0] = 0;
|
||||||
@@ -499,7 +507,7 @@ void QVideoSurfaceGLPainter::initYuv420PTextureInfo(const QSize &size)
|
|||||||
m_textureInternalFormat = GL_LUMINANCE;
|
m_textureInternalFormat = GL_LUMINANCE;
|
||||||
m_textureFormat = GL_LUMINANCE;
|
m_textureFormat = GL_LUMINANCE;
|
||||||
m_textureType = GL_UNSIGNED_BYTE;
|
m_textureType = GL_UNSIGNED_BYTE;
|
||||||
m_textureCount = 3;
|
m_textureCount = 3; // Note: ensure this is always <= Max_Textures
|
||||||
m_textureWidths[0] = bytesPerLine;
|
m_textureWidths[0] = bytesPerLine;
|
||||||
m_textureHeights[0] = size.height();
|
m_textureHeights[0] = size.height();
|
||||||
m_textureOffsets[0] = 0;
|
m_textureOffsets[0] = 0;
|
||||||
@@ -520,7 +528,7 @@ void QVideoSurfaceGLPainter::initYv12TextureInfo(const QSize &size)
|
|||||||
m_textureInternalFormat = GL_LUMINANCE;
|
m_textureInternalFormat = GL_LUMINANCE;
|
||||||
m_textureFormat = GL_LUMINANCE;
|
m_textureFormat = GL_LUMINANCE;
|
||||||
m_textureType = GL_UNSIGNED_BYTE;
|
m_textureType = GL_UNSIGNED_BYTE;
|
||||||
m_textureCount = 3;
|
m_textureCount = 3; // Note: ensure this is always <= Max_Textures
|
||||||
m_textureWidths[0] = bytesPerLine;
|
m_textureWidths[0] = bytesPerLine;
|
||||||
m_textureHeights[0] = size.height();
|
m_textureHeights[0] = size.height();
|
||||||
m_textureOffsets[0] = 0;
|
m_textureOffsets[0] = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user