Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
c33134bd
Commit
c33134bd
authored
Oct 21, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing Android build.
parent
8983c746
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
28 deletions
+68
-28
VideoStreaming.pri
src/VideoStreaming/VideoStreaming.pri
+1
-0
qtvideosinkdelegate.cpp
...treaming/gstqtvideosink/delegates/qtvideosinkdelegate.cpp
+3
-4
openglsurfacepainter.cpp
...treaming/gstqtvideosink/painters/openglsurfacepainter.cpp
+15
-19
videomaterial.cpp
src/VideoStreaming/gstqtvideosink/painters/videomaterial.cpp
+6
-5
glutils.h
src/VideoStreaming/gstqtvideosink/utils/glutils.h
+43
-0
No files found.
src/VideoStreaming/VideoStreaming.pri
View file @
c33134bd
...
...
@@ -132,6 +132,7 @@ VideoEnabled {
$$PWD/gstqtvideosink/painters/videonode.h \
$$PWD/gstqtvideosink/utils/bufferformat.h \
$$PWD/gstqtvideosink/utils/utils.h \
$$PWD/gstqtvideosink/utils/glutils.h \
SOURCES += \
$$PWD/gstqtvideosink/delegates/basedelegate.cpp \
...
...
src/VideoStreaming/gstqtvideosink/delegates/qtvideosinkdelegate.cpp
View file @
c33134bd
...
...
@@ -27,7 +27,8 @@
#include <QStack>
#include <QPainter>
#include <QOpenGLFunctions_2_0>
#include "glutils.h"
QtVideoSinkDelegate
::
QtVideoSinkDelegate
(
GstElement
*
sink
,
QObject
*
parent
)
:
BaseDelegate
(
sink
,
parent
)
...
...
@@ -138,7 +139,7 @@ void QtVideoSinkDelegate::setGLContext(QGLContext *context)
if
(
m_glContext
)
{
m_glContext
->
makeCurrent
();
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
funcs
)
{
const
QByteArray
extensions
(
reinterpret_cast
<
const
char
*>
(
funcs
->
glGetString
(
GL_EXTENSIONS
)));
GST_LOG_OBJECT
(
m_sink
,
"Available GL extensions: %s"
,
extensions
.
constData
());
...
...
@@ -230,7 +231,6 @@ void QtVideoSinkDelegate::changePainter(const BufferFormat & format)
void
QtVideoSinkDelegate
::
destroyPainter
()
{
GST_LOG_OBJECT
(
m_sink
,
"Destroying painter"
);
delete
m_painter
;
m_painter
=
0
;
}
...
...
@@ -243,6 +243,5 @@ bool QtVideoSinkDelegate::event(QEvent *event)
destroyPainter
();
}
}
return
BaseDelegate
::
event
(
event
);
}
src/VideoStreaming/gstqtvideosink/painters/openglsurfacepainter.cpp
View file @
c33134bd
...
...
@@ -23,7 +23,8 @@
#include "openglsurfacepainter.h"
#include <QtCore/qmath.h>
#include <QOpenGLFunctions_2_0>
#include "glutils.h"
#ifndef GL_TEXTURE0
# define GL_TEXTURE0 0x84C0
...
...
@@ -178,7 +179,7 @@ void OpenGLSurfacePainter::paint(quint8 *data,
QPainter
*
painter
,
const
PaintAreas
&
areas
)
{
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
!
funcs
)
return
;
...
...
@@ -396,22 +397,17 @@ ArbFpSurfacePainter::ArbFpSurfacePainter()
,
m_programId
(
0
)
{
const
QGLContext
*
context
=
QGLContext
::
currentContext
();
glProgramStringARB
=
(
_glProgramStringARB
)
context
->
getProcAddress
(
QLatin1String
(
"glProgramStringARB"
));
glBindProgramARB
=
(
_glBindProgramARB
)
context
->
getProcAddress
(
QLatin1String
(
"glBindProgramARB"
));
glDeleteProgramsARB
=
(
_glDeleteProgramsARB
)
context
->
getProcAddress
(
QLatin1String
(
"glDeleteProgramsARB"
));
glGenProgramsARB
=
(
_glGenProgramsARB
)
context
->
getProcAddress
(
QLatin1String
(
"glGenProgramsARB"
));
glProgramLocalParameter4fARB
=
(
_glProgramLocalParameter4fARB
)
context
->
getProcAddress
(
QLatin1String
(
"glProgramLocalParameter4fARB"
));
glProgramStringARB
=
(
_glProgramStringARB
)
context
->
getProcAddress
(
QLatin1String
(
"glProgramStringARB"
));
glBindProgramARB
=
(
_glBindProgramARB
)
context
->
getProcAddress
(
QLatin1String
(
"glBindProgramARB"
));
glDeleteProgramsARB
=
(
_glDeleteProgramsARB
)
context
->
getProcAddress
(
QLatin1String
(
"glDeleteProgramsARB"
));
glGenProgramsARB
=
(
_glGenProgramsARB
)
context
->
getProcAddress
(
QLatin1String
(
"glGenProgramsARB"
));
glProgramLocalParameter4fARB
=
(
_glProgramLocalParameter4fARB
)
context
->
getProcAddress
(
QLatin1String
(
"glProgramLocalParameter4fARB"
));
}
void
ArbFpSurfacePainter
::
init
(
const
BufferFormat
&
format
)
{
Q_ASSERT
(
m_textureCount
==
0
);
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
!
funcs
)
return
;
...
...
@@ -501,7 +497,7 @@ void ArbFpSurfacePainter::init(const BufferFormat &format)
void
ArbFpSurfacePainter
::
cleanup
()
{
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
funcs
)
{
funcs
->
glDeleteTextures
(
m_textureCount
,
m_textureIds
);
...
...
@@ -516,7 +512,7 @@ void ArbFpSurfacePainter::paintImpl(const QPainter *painter,
const
GLfloat
*
textureCoordArray
)
{
Q_UNUSED
(
painter
);
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
!
funcs
)
return
;
...
...
@@ -734,14 +730,14 @@ void GlslSurfacePainter::init(const BufferFormat &format)
throw
QString
(
"Shader link error "
)
+
m_program
.
log
();
}
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
funcs
)
funcs
->
glGenTextures
(
m_textureCount
,
m_textureIds
);
}
void
GlslSurfacePainter
::
cleanup
()
{
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
funcs
)
{
funcs
->
glDeleteTextures
(
m_textureCount
,
m_textureIds
);
...
...
@@ -795,8 +791,8 @@ void GlslSurfacePainter::paintImpl(const QPainter *painter,
m_program
.
setAttributeArray
(
"textureCoordArray"
,
textureCoordArray
,
2
);
m_program
.
setUniformValue
(
"positionMatrix"
,
positionMatrix
);
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
if
(
funcs
)
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
!
funcs
)
return
;
if
(
m_textureCount
==
3
)
{
...
...
src/VideoStreaming/gstqtvideosink/painters/videomaterial.cpp
View file @
c33134bd
...
...
@@ -26,9 +26,10 @@
#include <qmath.h>
#include <QOpenGLContext>
#include <QOpenGLFunctions_2_0>
#include <QtQuick/QSGMaterialShader>
#include "glutils.h"
static
const
char
*
const
qtvideosink_glsl_vertexShader
=
"uniform highp mat4 qt_Matrix;
\n
"
"attribute highp vec4 qt_VertexPosition;
\n
"
...
...
@@ -257,7 +258,7 @@ VideoMaterial::~VideoMaterial()
{
if
(
!
m_textureSize
.
isEmpty
())
{
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
funcs
)
{
funcs
->
glDeleteTextures
(
m_textureCount
,
m_textureIds
);
...
...
@@ -329,7 +330,7 @@ void VideoMaterial::initYuv420PTextureInfo(bool uvSwapped, const QSize &size)
void
VideoMaterial
::
init
(
GstVideoColorMatrix
colorMatrixType
)
{
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
funcs
)
{
funcs
->
glGenTextures
(
m_textureCount
,
m_textureIds
);
...
...
@@ -421,7 +422,7 @@ void VideoMaterial::updateColors(int brightness, int contrast, int hue, int satu
void
VideoMaterial
::
bind
()
{
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
!
funcs
)
return
;
...
...
@@ -455,7 +456,7 @@ void VideoMaterial::bind()
void
VideoMaterial
::
bindTexture
(
int
i
,
const
quint8
*
data
)
{
QOpenGLFunctions
_2_0
*
funcs
=
QOpenGLContext
::
currentContext
()
->
versionFunctions
<
QOpenGLFunctions_2_0
>
();
QOpenGLFunctions
Def
*
funcs
=
getQOpenGLFunctions
();
if
(
!
funcs
)
return
;
...
...
src/VideoStreaming/gstqtvideosink/utils/glutils.h
0 → 100644
View file @
c33134bd
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief QGC Video Item
* @author Gus Grubba <mavlink@grubba.com>
*/
#ifndef GLUTILS_H
#define GLUTILS_H
#ifdef __android__
#include <QOpenGLFunctions>
#define getQOpenGLFunctions() QOpenGLContext::currentContext()->functions()
#define QOpenGLFunctionsDef QOpenGLFunctions
#else
#include <QOpenGLFunctions_2_0>
#define getQOpenGLFunctions() QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_2_0>()
#define QOpenGLFunctionsDef QOpenGLFunctions_2_0
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment