examples/gl/qt: silence compiler warnings

-Waggregate-return: used by some Qt clases extensively and not super
useful for this example. Supress it.

warning: "GL_GLEXT_VERSION" redefined: Perform the same workaround as
qmlglsink by defining the old gl/GL.h header guard if the new GL/gl.h
guard exists.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/752>
This commit is contained in:
Matthew Waters 2020-07-14 14:06:58 +10:00
parent 93cb325fa1
commit e6823576ce
11 changed files with 48 additions and 8 deletions

View file

@ -0,0 +1,36 @@
/*
* GStreamer
* Copyright (C) 2020 Matthew Waters <matthew@centricular.com>
*
* 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 <gst/gl/gstglconfig.h>
/* 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

View file

@ -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()

View file

@ -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)

View file

@ -21,6 +21,7 @@
#include <gst/video/videooverlay.h>
#include <gst/video/video.h>
#include <GL/gl.h>
#include "../gl-compat-defines.h"
#include "pipeline.h"
#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1)

View file

@ -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);

View file

@ -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)

View file

@ -21,6 +21,7 @@
#include <gst/video/videooverlay.h>
#include <gst/video/video.h>
#include <GL/gl.h>
#include "../gl-compat-defines.h"
#include "pipeline.h"
#define GST_MAP_GL (GST_MAP_FLAG_LAST << 1)

View file

@ -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);

View file

@ -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)

View file

@ -19,9 +19,9 @@
* Boston, MA 02110-1301, USA.
*/
#include "pipeline.h"
#include <gst/gl/gl.h>
#include "../gl-compat-defines.h"
#include "pipeline.h"
Pipeline::Pipeline (GstGLDisplay *display,
GstGLContext * context, const QString & videoLocation, QObject * parent)

View file

@ -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);