qt: add support for building on osx/ios

Including:
- Necessary configure checks
- Necessary compile time platform checks
- Necessary runtime qt iOS/OSX platform detection

https://bugzilla.gnome.org/show_bug.cgi?id=755100
This commit is contained in:
Matthew Waters 2015-09-15 03:14:37 +10:00
parent 30fa95c6e2
commit 30194cc368
6 changed files with 64 additions and 11 deletions

View file

@ -2753,7 +2753,7 @@ AM_CONDITIONAL(USE_GTK3_GL, test "x$HAVE_GTK3_GL" = "xyes")
dnl *** Qt ***
translit(dnm, m, l) AM_CONDITIONAL(USE_QT, true)
AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [
PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Quick >= 5.4.0, [
PKG_CHECK_MODULES(QT, Qt5Core Qt5Gui Qt5Qml Qt5Quick >= 5.4.0, [
QT_PATH=`$PKG_CONFIG --variable=exec_prefix Qt5Core`
QT_HOST_PATH=`$PKG_CONFIG --variable=host_bins Qt5Core`
AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
@ -2801,6 +2801,25 @@ AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [
HAVE_QT_WINDOWING="yes"
], [AC_MSG_NOTICE([Could not find Qt Android integration])])
fi
if test "x$GST_GL_HAVE_WINDOW_COCOA" = "x1" -a "x$GST_GL_HAVE_PLATFORM_CGL" = "x1"; then
PKG_CHECK_MODULES(QT_MAC, Qt5MacExtras, [
AC_DEFINE([HAVE_QT_MAC], [],
[Define if Qt Mac integration is installed])
QT_LIBDIR=`$PKG_CONFIG --variable=libdir Qt5Core`
QT_CFLAGS="$QT_CFLAGS $QT_MAC_CFLAGS -F$QT_LIBDIR -framework QtCore -framework QtGui -framework QtQuick -framework QtQml -framework QtMacExtras"
QT_LIBS="$QT_LIBS $QT_MAC_LIBS"
HAVE_QT_WINDOWING="yes"
], [AC_MSG_NOTICE([Could not find Qt Mac integration])])
fi
if test "x$GST_GL_HAVE_WINDOW_EAGL" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EAGL" = "x1"; then
if test "x$HAVE_IOS" = "xyes"; then
# iOS doesn't have its own extras package so if we have the core
# modules we are good to go
AC_DEFINE([HAVE_QT_IOS], [],
[Define if Qt iOS integration is installed])
HAVE_QT_WINDOWING="yes"
fi
fi
if test "x$HAVE_QT_WINDOWING" = "xno"; then
AC_MSG_WARN([Could not find any Qt Windowing integration])
HAVE_QT="no"

View file

@ -23,7 +23,7 @@
#endif
#include "gstqtsink.h"
#include <QQmlApplicationEngine>
#include <QtQml/QQmlApplicationEngine>
static gboolean
plugin_init (GstPlugin * plugin)

View file

@ -26,8 +26,8 @@
#include <gst/gl/gl.h>
#include "gstqtgl.h"
#include <QSGTexture>
#include <QOpenGLFunctions>
#include <QtQuick/QSGTexture>
#include <QtGui/QOpenGLFunctions>
class GstQSGTexture : public QSGTexture, protected QOpenGLFunctions
{

View file

@ -28,7 +28,7 @@
#endif
#include "gstqtsink.h"
#include <QGuiApplication>
#include <QtGui/QGuiApplication>
#define GST_CAT_DEFAULT gst_debug_qt_gl_sink
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);

View file

@ -28,9 +28,9 @@
#include "qtitem.h"
#include "gstqsgtexture.h"
#include <QGuiApplication>
#include <QQuickWindow>
#include <QSGSimpleTextureNode>
#include <QtGui/QGuiApplication>
#include <QtQuick/QQuickWindow>
#include <QtQuick/QSGSimpleTextureNode>
#if GST_GL_HAVE_WINDOW_X11 && GST_GL_HAVE_PLATFORM_GLX && defined (HAVE_QT_X11)
#include <QX11Info>
@ -47,6 +47,10 @@
#include <gst/gl/egl/gstglcontext_egl.h>
#endif
#if GST_GL_HAVE_WINDOW_COCOA && GST_GL_HAVE_PLATFORM_COCOA && defined (HAVE_QT_MAC)
#include <gst/gl/coaoa/gstgldisplay_cocoa.h>
#endif
/**
* SECTION:gtkgstglwidget
* @short_description: a #GtkGLArea that renders GStreamer video #GstBuffers
@ -126,6 +130,14 @@ QtGLVideoItem::QtGLVideoItem()
if (QString::fromUtf8 ("android") == app->platformName())
this->priv->display = (GstGLDisplay *) gst_gl_display_egl_new ();
#endif
#if GST_GL_HAVE_WINDOW_COCOA && GST_GL_HAVE_PLATFORM_COCOA && defined (HAVE_QT_MAC)
if (QString::fromUtf8 ("cocoa") == app->platformName())
this->priv->display = (GstGLDisplay *) gst_gl_display_cocoa_new ();
#endif
#if GST_GL_HAVE_WINDOW_EAGL && GST_GL_HAVE_PLATFORM_EAGL && defined (HAVE_QT_IOS)
if (QString::fromUtf8 ("ios") == app->platformName())
this->priv->display = gst_gl_display_new ();
#endif
if (!this->priv->display)
this->priv->display = gst_gl_display_new ();
@ -303,6 +315,28 @@ QtGLVideoItem::onSceneGraphInitialized ()
platform, gl_api);
}
#endif
#if GST_GL_HAVE_WINDOW_COCOA && GST_GL_HAVE_PLATFORM_COCOA && defined (HAVE_QT_MAC)
if (this->priv->display) {
platform = GST_GL_PLATFORM_CGL;
gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
gl_handle = gst_gl_context_get_current_gl_context (platform);
if (gl_handle)
this->priv->other_context =
gst_gl_context_new_wrapped (this->priv->display, gl_handle,
platform, gl_api);
}
#endif
#if GST_GL_HAVE_WINDOW_EAGL && GST_GL_HAVE_PLATFORM_EAGL && defined (HAVE_QT_IOS)
if (this->priv->display) {
platform = GST_GL_PLATFORM_EAGL;
gl_api = gst_gl_context_get_current_gl_api (platform, NULL, NULL);
gl_handle = gst_gl_context_get_current_gl_context (platform);
if (gl_handle)
this->priv->other_context =
gst_gl_context_new_wrapped (this->priv->display, gl_handle,
platform, gl_api);
}
#endif
(void) platform;
(void) gl_api;

View file

@ -25,9 +25,9 @@
#include <gst/gl/gl.h>
#include "gstqtgl.h"
#include <QQuickItem>
#include <QOpenGLContext>
#include <QOpenGLFunctions>
#include <QtQuick/QQuickItem>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLFunctions>
typedef struct _QtGLVideoItemPrivate QtGLVideoItemPrivate;