diff --git a/tests/examples/gl/qt/gl-compat-defines.h b/tests/examples/gl/qt/gl-compat-defines.h new file mode 100644 index 0000000000..4e22ba22e9 --- /dev/null +++ b/tests/examples/gl/qt/gl-compat-defines.h @@ -0,0 +1,36 @@ +/* + * GStreamer + * Copyright (C) 2020 Matthew Waters + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include + +/* The glext.h guard was renamed in 2018, but some software which + * includes their own copy of the GL headers (such as qt) might have + * older version which use the old guard. This would result in the + * header being included again (and symbols redefined). + * + * To avoid this, we define the "old" guard if the "new" guard is + * defined.*/ +#if GST_GL_HAVE_OPENGL +#ifdef __gl_glext_h_ +#ifndef __glext_h_ +#define __glext_h_ 1 +#endif +#endif +#endif diff --git a/tests/examples/gl/qt/meson.build b/tests/examples/gl/qt/meson.build index 5c37fc58d5..523f8a10d3 100644 --- a/tests/examples/gl/qt/meson.build +++ b/tests/examples/gl/qt/meson.build @@ -5,6 +5,8 @@ qt5opengl_dep = dependency('qt5', modules : ['OpenGL'], required : false) # FIXME: other platforms libgl = cc.find_library ('GL', required : false) +qt_cxx_warn_less = cxx.get_supported_arguments(['-Wno-aggregate-return']) + if qt5gui_dep.found() subdir('videooverlay') if libgl.found() diff --git a/tests/examples/gl/qt/mousevideooverlay/meson.build b/tests/examples/gl/qt/mousevideooverlay/meson.build index 1788b96f33..a4f6071efc 100644 --- a/tests/examples/gl/qt/mousevideooverlay/meson.build +++ b/tests/examples/gl/qt/mousevideooverlay/meson.build @@ -13,7 +13,7 @@ moc_headers = [ moc_files = qt5_mod.preprocess(moc_headers : moc_headers) executable('mousevideoverlay', sources, moc_files, - cpp_args : [gst_plugins_base_args], + cpp_args : [gst_plugins_base_args] + qt_cxx_warn_less, include_directories: [configinc, libsinc], dependencies : [qt5core_dep, qt5gui_dep, gst_dep, video_dep, gstgl_dep, libgl], install: false) diff --git a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp index bca4862cb9..a530d96b75 100644 --- a/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/mousevideooverlay/pipeline.cpp @@ -21,6 +21,7 @@ #include #include #include +#include "../gl-compat-defines.h" #include "pipeline.h" #define GST_MAP_GL (GST_MAP_FLAG_LAST << 1) diff --git a/tests/examples/gl/qt/mousevideooverlay/qrenderer.h b/tests/examples/gl/qt/mousevideooverlay/qrenderer.h index 90e85fffd9..97e7fb4e28 100644 --- a/tests/examples/gl/qt/mousevideooverlay/qrenderer.h +++ b/tests/examples/gl/qt/mousevideooverlay/qrenderer.h @@ -30,7 +30,7 @@ class QRenderer : public QWidget Q_OBJECT public: - QRenderer(const QString videoLocation, QWidget *parent = 0, Qt::WindowFlags flags = 0); + QRenderer(const QString videoLocation, QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags()); ~QRenderer(); void paintEvent(QPaintEvent* event); void mouseMoveEvent(QMouseEvent* event); diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/meson.build b/tests/examples/gl/qt/qglwidgetvideooverlay/meson.build index 1f4896c03f..176c4856a9 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/meson.build +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/meson.build @@ -13,7 +13,7 @@ moc_headers = [ moc_files = qt5_mod.preprocess(moc_headers : moc_headers) executable('qglwidgetvideoverlay', sources, moc_files, - cpp_args : [gst_plugins_base_args], + cpp_args : [gst_plugins_base_args] + qt_cxx_warn_less, include_directories: [configinc, libsinc], dependencies : [qt5core_dep, qt5gui_dep, qt5opengl_dep, gst_dep, video_dep, gstgl_dep, libgl], install: false) diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp index 21e38f226a..10951f83f1 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/pipeline.cpp @@ -21,6 +21,7 @@ #include #include #include +#include "../gl-compat-defines.h" #include "pipeline.h" #define GST_MAP_GL (GST_MAP_FLAG_LAST << 1) diff --git a/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h b/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h index aaf0d029e6..d9ded2990c 100644 --- a/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h +++ b/tests/examples/gl/qt/qglwidgetvideooverlay/qglrenderer.h @@ -29,7 +29,7 @@ class QGLRenderer : public QGLWidget Q_OBJECT public: - QGLRenderer(const QString videoLocation, QWidget *parent = 0); + QGLRenderer(const QString videoLocation, QWidget *parent = nullptr); ~QGLRenderer(); void paintEvent(QPaintEvent* event); void closeEvent (QCloseEvent* event); diff --git a/tests/examples/gl/qt/qglwtextureshare/meson.build b/tests/examples/gl/qt/qglwtextureshare/meson.build index b4d9dbd472..781bf3fe56 100644 --- a/tests/examples/gl/qt/qglwtextureshare/meson.build +++ b/tests/examples/gl/qt/qglwtextureshare/meson.build @@ -23,7 +23,7 @@ endif moc_files = qt5_mod.preprocess(moc_headers : moc_headers) executable('qglwtextureshare', sources, moc_files, - cpp_args : [gst_plugins_base_args], + cpp_args : [gst_plugins_base_args] + qt_cxx_warn_less, include_directories: [configinc, libsinc], dependencies : [qt5core_dep, qt5gui_dep, qt5opengl_dep, qtwinsys_deps, gst_dep, video_dep, gstgl_dep, libgl], install: false) diff --git a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp b/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp index 4afa8334d9..1698bf856d 100644 --- a/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp +++ b/tests/examples/gl/qt/qglwtextureshare/pipeline.cpp @@ -19,9 +19,9 @@ * Boston, MA 02110-1301, USA. */ -#include "pipeline.h" #include - +#include "../gl-compat-defines.h" +#include "pipeline.h" Pipeline::Pipeline (GstGLDisplay *display, GstGLContext * context, const QString & videoLocation, QObject * parent) diff --git a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.h b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.h index 0bf354ba56..20da6f6e19 100644 --- a/tests/examples/gl/qt/qglwtextureshare/qglrenderer.h +++ b/tests/examples/gl/qt/qglwtextureshare/qglrenderer.h @@ -34,7 +34,7 @@ class QGLRenderer : public QGLWidget Q_OBJECT public: - QGLRenderer(const QString &videoLocation, QWidget *parent = 0); + QGLRenderer(const QString &videoLocation, QWidget *parent = nullptr); ~QGLRenderer(); void closeEvent(QCloseEvent* event);