summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2018-02-12 18:48:32 +0000
committerTim-Philipp Müller <tim@centricular.com>2018-02-12 18:48:32 +0000
commite9bfb4edc2ab28b7f64b8b57469d0f8d3638be8a (patch)
treed7296dc09c4b587c9a3695fbf1230e996a4dc51b
parent743a325df09e89c6ece5070f80c1470e556382e9 (diff)
downloadgstreamer-plugins-bad-e9bfb4edc2ab28b7f64b8b57469d0f8d3638be8a.tar.gz
qt: remove plugin, moved to -good
https://bugzilla.gnome.org/show_bug.cgi?id=754094
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac104
-rw-r--r--docs/plugins/gst-plugins-bad-plugins-sections.txt16
-rw-r--r--docs/plugins/inspect/plugin-qt.xml43
-rw-r--r--ext/Makefile.am8
-rw-r--r--ext/qt/.gitignore1
-rw-r--r--ext/qt/Makefile.am60
-rw-r--r--ext/qt/gstplugin.cc60
-rw-r--r--ext/qt/gstqsgtexture.cc224
-rw-r--r--ext/qt/gstqsgtexture.h59
-rw-r--r--ext/qt/gstqtgl.h37
-rw-r--r--ext/qt/gstqtglutility.cc247
-rw-r--r--ext/qt/gstqtglutility.h34
-rw-r--r--ext/qt/gstqtsink.cc493
-rw-r--r--ext/qt/gstqtsink.h79
-rw-r--r--ext/qt/gstqtsrc.cc548
-rw-r--r--ext/qt/gstqtsrc.h80
-rw-r--r--ext/qt/qtitem.cc546
-rw-r--r--ext/qt/qtitem.h109
-rw-r--r--ext/qt/qtplugin.pro40
-rw-r--r--ext/qt/qtwindow.cc434
-rw-r--r--ext/qt/qtwindow.h70
-rw-r--r--tests/examples/meson.build1
-rw-r--r--tests/examples/qt/qmlsink/.gitignore3
-rw-r--r--tests/examples/qt/qmlsink/CMakeLists.txt23
-rw-r--r--tests/examples/qt/qmlsink/main.cpp83
-rw-r--r--tests/examples/qt/qmlsink/main.qml60
-rw-r--r--tests/examples/qt/qmlsink/play.pro20
-rw-r--r--tests/examples/qt/qmlsink/qml.qrc5
-rw-r--r--tests/examples/qt/qmlsrc/.gitignore2
-rw-r--r--tests/examples/qt/qmlsrc/grabqml.pro20
-rw-r--r--tests/examples/qt/qmlsrc/main.cpp80
-rw-r--r--tests/examples/qt/qmlsrc/main.qml65
-rw-r--r--tests/examples/qt/qmlsrc/qml.qrc5
34 files changed, 3 insertions, 3659 deletions
diff --git a/Makefile.am b/Makefile.am
index 62b902a7d..994cc3942 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -60,6 +60,7 @@ CRUFT_FILES = \
$(top_builddir)/ext/teletextdec/.libs/libgstteletextdec.so \
$(top_builddir)/gst/opus/.libs/libgstopus.{so,dll,DLL,dylib} \
$(top_builddir)/ext/mpg123/.libs/*.{so,dll,DLL,dylib} \
+ $(top_builddir)/ext/qt/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/aacparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/amrparse/.libs/*.{so,dll,DLL,dylib} \
$(top_builddir)/gst/audioparsers/.libs/*.{so,dll,DLL,dylib} \
@@ -128,6 +129,7 @@ CRUFT_DIRS = \
$(top_srcdir)/tests/examples/gl \
$(top_srcdir)/tests/examples/scaletempo \
$(top_srcdir)/tests/examples/gtk \
+ $(top_srcdir)/tests/examples/qt \
$(top_srcdir)/tests/examples/shapewipe \
$(top_srcdir)/tests/examples/switch \
$(top_srcdir)/tests/examples/jack \
@@ -142,6 +144,7 @@ CRUFT_DIRS = \
$(top_srcdir)/ext/metadata \
$(top_srcdir)/ext/mimic \
$(top_srcdir)/ext/mpg123 \
+ $(top_srcdir)/ext/qt \
$(top_srcdir)/ext/swfdec \
$(top_srcdir)/ext/tarkin \
$(top_srcdir)/ext/theora \
diff --git a/configure.ac b/configure.ac
index 189226ae3..c6b482a66 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1943,108 +1943,6 @@ AG_GST_CHECK_FEATURE(GL, [gl elements], gl, [
AM_CONDITIONAL(USE_GL, test "x$HAVE_GL" = "xyes")
AM_CONDITIONAL(USE_OPENGL, test "x$GST_GL_HAVE_API_GL" = "x1")
-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 Qt5Qml Qt5Quick >= 5.4.0, [
- QT_PATH=`$PKG_CONFIG --variable=exec_prefix Qt5Core`
- QT_HOST_PATH=`$PKG_CONFIG --variable=host_bins Qt5Core`
- AC_ARG_WITH([moc],
- AS_HELP_STRING([--with-moc], [Set location of qt moc tool]),
- [MOC=$withval])
- AC_PATH_PROGS(MOC, [moc-qt5 moc], [moc], ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
- AC_ARG_WITH([rcc],
- AS_HELP_STRING([--with-rcc], [Set location of qt rcc tool]),
- [RCC=$withval])
- AC_PATH_PROGS(RCC, [rcc-qt5 rcc], [rcc], ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
- AC_ARG_WITH([uic],
- AS_HELP_STRING([--with-uic], [Set location of qt uic tool]),
- [UIC=$withval])
- AC_PATH_PROGS(UIC, [uic-qt5 uic], [uic], ["${QT_HOST_PATH}" "${QT_PATH}/bin"])
- if test "x$MOC" = "x" || test "x$UIC" = "x" || test "x$RCC" = "x"; then
- AC_MSG_WARN([One of the required qt build programs was not found])
- HAVE_QT="no"
- else
- HAVE_QT="yes"
- HAVE_QT_WINDOWING="no"
- QT_VERSION="`$PKG_CONFIG --define-prefix --modversion Qt5Core`"
- QPA_INCLUDE_PATH=`$PKG_CONFIG --variable=includedir Qt5Core`/QtGui/${QT_VERSION}/QtGui
- AS_IF([test -f "$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH/qpa/qplatformnativeinterface.h"], [
- QT_CFLAGS="$QT_CFLAGS -I$PKG_CONFIG_SYSROOT_DIR/$QPA_INCLUDE_PATH"
- HAVE_QT_QPA_HEADER="yes"
- ], [AC_MSG_NOTICE([Cannot find QPA])])
- if test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_GLX" = "x1" || test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then
- PKG_CHECK_MODULES(QT_X11, Qt5X11Extras, [
- AC_DEFINE([HAVE_QT_X11], [], [Define if Qt X11 integration is installed])
- QT_CFLAGS="$QT_CFLAGS $QT_X11_CFLAGS"
- QT_LIBS="$QT_LIBS $QT_X11_LIBS"
- HAVE_QT_WINDOWING="yes"
- ], [AC_MSG_NOTICE([Could not find Qt X11 integration])])
- fi
- if test "x$GST_GL_HAVE_WINDOW_WAYLAND" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1" -a "x$HAVE_QT_QPA_HEADER" = "xyes"; then
- PKG_CHECK_MODULES(QT_WAYLAND, Qt5WaylandClient, [
- AC_DEFINE([HAVE_QT_WAYLAND], [],
- [Define if Qt Wayland integration is installed])
- QT_CFLAGS="$QT_CFLAGS $QT_WAYLAND_CFLAGS"
- QT_LIBS="$QT_LIBS $QT_WAYLAND_LIBS"
- HAVE_QT_WINDOWING="yes"
- ], [AC_MSG_NOTICE([Could not find Qt Wayland integration])])
- fi
- if test "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then
- if test "x$GST_GL_HAVE_WINDOW_ANDROID" = "x1"; then
- PKG_CHECK_MODULES(QT_ANDROID, Qt5AndroidExtras, [
- # c++ on android requires a standard library and there are multiple
- # choices. cerbero provides a pkg-config file the describes a choice
- # so try to use that. Outside cerbero one has to pass these flags
- # manually for the library one is using
- PKG_CHECK_MODULES(GNUSTL, gnustl, [
- QT_CFLAGS="$QT_CFLAGS $GNUSTL_CFLAGS"
- QT_LIBS="$QT_LIBS $GNUSTL_LIBS"
- ], [
- AC_MSG_NOTICE([Could not find Standard C++ library])])
- AC_DEFINE([HAVE_QT_EGLFS], [],
- [Define if Qt eglfs integration is installed])
- QT_CFLAGS="$QT_CFLAGS $QT_ANDROID_CFLAGS"
- QT_LIBS="$QT_LIBS $QT_ANDROID_LIBS"
- HAVE_QT_WINDOWING="yes"
- ], [AC_MSG_NOTICE([Could not find Qt Android integration])])
- else
- AC_DEFINE([HAVE_QT_EGLFS], [],
- [Define if Qt eglfs integration is installed])
- HAVE_QT_WINDOWING="yes"
- fi
- 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"
- fi
- AC_SUBST([QT_CFLAGS])
- AC_SUBST([QT_LIBS])
- fi
- ], [
- HAVE_QT="no"
- ])
-])
-
dnl *** Vulkan ***
translit(dnm, m, l) AM_CONDITIONAL(USE_VULKAN, true)
AG_GST_CHECK_FEATURE(VULKAN, [Vulkan elements], vulkan, [
@@ -2454,7 +2352,6 @@ AM_CONDITIONAL(USE_OPENJPEG, false)
AM_CONDITIONAL(USE_OPENMPT, false)
AM_CONDITIONAL(USE_OPENNI2, false)
AM_CONDITIONAL(USE_OPUS, false)
-AM_CONDITIONAL(USE_QT, false)
AM_CONDITIONAL(USE_WILDMIDI, false)
AM_CONDITIONAL(USE_SMOOTHSTREAMING, false)
AM_CONDITIONAL(USE_SNDFILE, false)
@@ -2749,7 +2646,6 @@ ext/openjpeg/Makefile
ext/openmpt/Makefile
ext/openni2/Makefile
ext/opus/Makefile
-ext/qt/Makefile
ext/rsvg/Makefile
ext/resindvd/Makefile
ext/rtmp/Makefile
diff --git a/docs/plugins/gst-plugins-bad-plugins-sections.txt b/docs/plugins/gst-plugins-bad-plugins-sections.txt
index 89d9b33b9..8e98c9c96 100644
--- a/docs/plugins/gst-plugins-bad-plugins-sections.txt
+++ b/docs/plugins/gst-plugins-bad-plugins-sections.txt
@@ -2650,22 +2650,6 @@ gst_pnmenc_get_type
</SECTION>
<SECTION>
-<FILE>element-qmlglsink</FILE>
-<TITLE>qmlglsink</TITLE>
-GstQtSink
-<SUBSECTION Standard>
-GstQtSinkClass
-GST_QT_SINK
-GST_QT_SINK_CAST
-GST_IS_QT_SINK
-GST_QT_SINK_CLASS
-GST_IS_QT_SINK_CLASS
-GST_TYPE_QT_SINK
-<SUBSECTION Private>
-gst_qt_sink_get_type
-</SECTION>
-
-<SECTION>
<FILE>element-rgb2bayer</FILE>
<TITLE>rgb2bayer</TITLE>
GstRGB2Bayer
diff --git a/docs/plugins/inspect/plugin-qt.xml b/docs/plugins/inspect/plugin-qt.xml
deleted file mode 100644
index e85a1f2dc..000000000
--- a/docs/plugins/inspect/plugin-qt.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<plugin>
- <name>qt</name>
- <description>Qt gl plugin</description>
- <filename>../../ext/qt/.libs/libgstqmlgl.so</filename>
- <basename>libgstqmlgl.so</basename>
- <version>1.12.0</version>
- <license>LGPL</license>
- <source>gst-plugins-bad</source>
- <package>GStreamer Bad Plug-ins source release</package>
- <origin>Unknown package origin</origin>
- <elements>
- <element>
- <name>qmlglsink</name>
- <longname>Qt Video Sink</longname>
- <class>Sink/Video</class>
- <description>A video sink that renders to a QQuickItem</description>
- <author>Matthew Waters &lt;matthew@centricular.com&gt;</author>
- <pads>
- <caps>
- <name>sink</name>
- <direction>sink</direction>
- <presence>always</presence>
- <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], texture-target=(string)2D</details>
- </caps>
- </pads>
- </element>
- <element>
- <name>qmlglsrc</name>
- <longname>Qt Video Source</longname>
- <class>Source/Video</class>
- <description>A video src that captures a window from a QML view</description>
- <author>Multimedia Team &lt;shmmmw@freescale.com&gt;</author>
- <pads>
- <caps>
- <name>src</name>
- <direction>source</direction>
- <presence>always</presence>
- <details>video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ], texture-target=(string)2D</details>
- </caps>
- </pads>
- </element>
- </elements>
-</plugin> \ No newline at end of file
diff --git a/ext/Makefile.am b/ext/Makefile.am
index eeea9fc11..1125f2eff 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -88,12 +88,6 @@ else
GL_DIR=
endif
-if USE_QT
-QT_DIR=qt
-else
-QT_DIR=
-endif
-
if USE_RESINDVD
RESINDVD_DIR = resindvd
else
@@ -431,7 +425,6 @@ SUBDIRS=\
$(DTS_DIR) \
$(RESINDVD_DIR) \
$(GL_DIR) \
- $(QT_DIR) \
$(FAAC_DIR) \
$(FAAD_DIR) \
$(FDK_AAC_DIR) \
@@ -512,7 +505,6 @@ DIST_SUBDIRS = \
daala \
dts \
gl \
- qt \
modplug \
mpeg2enc \
mplex \
diff --git a/ext/qt/.gitignore b/ext/qt/.gitignore
deleted file mode 100644
index f830c38fc..000000000
--- a/ext/qt/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-moc_*.cc
diff --git a/ext/qt/Makefile.am b/ext/qt/Makefile.am
deleted file mode 100644
index cf2f761c3..000000000
--- a/ext/qt/Makefile.am
+++ /dev/null
@@ -1,60 +0,0 @@
-plugin_LTLIBRARIES = libgstqmlgl.la
-
-noinst_HEADERS = \
- gstqsgtexture.h \
- gstqtglutility.h \
- gstqtsink.h \
- gstqtsrc.h \
- qtitem.h \
- qtwindow.h
-
-moc_generated = \
- moc_qtitem.cc \
- moc_qtwindow.cc \
- moc_gstqsgtexture.cc
-
-#anything generated by the Qt tools...
-BUILT_SOURCES = $(moc_generated)
-CLEANFILES = $(moc_generated)
-
-nodist_libgstqmlgl_la_SOURCES = $(BUILT_SOURCES)
-
-libgstqmlgl_la_SOURCES = \
- gstqsgtexture.cc \
- gstqtglutility.cc \
- qtitem.cc \
- qtwindow.cc \
- gstqtsink.cc \
- gstqtsink.h \
- gstqtsrc.cc \
- gstqtsrc.h \
- gstqtgl.h \
- gstplugin.cc
-
-libgstqmlgl_la_CXXFLAGS = \
- $(GST_PLUGINS_BAD_CFLAGS) \
- $(GST_PLUGINS_BASE_CFLAGS) \
- $(GST_GL_CFLAGS) \
- $(GST_BASE_CFLAGS) \
- $(GST_CXXFLAGS) \
- $(QT_CFLAGS) \
- $(GL_CFLAGS) -std=c++11
-
-libgstqmlgl_la_LIBADD = \
- $(GST_PLUGINS_BASE_LIBS) \
- $(GST_GL_LIBS) \
- -lgstvideo-$(GST_API_VERSION) \
- $(GST_BASE_LIBS) \
- $(QT_LIBS)
-
-libgstqmlgl_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-
-
-$(moc_generated): moc_%.cc: %.h
- @MOC@ -o $@ $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MOC_CPPFLAGS) $<
-
-ui-%.h: %.ui
- @UIC@ -o $@ $<
-
-qrc-%.cc: %.qrc
- @RCC@ -o $@ $<
diff --git a/ext/qt/gstplugin.cc b/ext/qt/gstplugin.cc
deleted file mode 100644
index 79fb18189..000000000
--- a/ext/qt/gstplugin.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstqtsink.h"
-#include "gstqtsrc.h"
-#include <QtQml/QQmlApplicationEngine>
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_element_register (plugin, "qmlglsink",
- GST_RANK_NONE, GST_TYPE_QT_SINK)) {
- return FALSE;
- }
-
- if (!gst_element_register (plugin, "qmlglsrc",
- GST_RANK_NONE, GST_TYPE_QT_SRC)) {
- return FALSE;
- }
- /* this means the plugin must be loaded before the qml engine is loaded */
- qmlRegisterType<QtGLVideoItem> ("org.freedesktop.gstreamer.GLVideoItem", 1, 0, "GstGLVideoItem");
-
- return TRUE;
-}
-
-#ifndef GST_PACKAGE_NAME
-#define GST_PACKAGE_NAME "GStreamer Bad Plug-ins (qmake)"
-#define GST_PACKAGE_ORIGIN "Unknown package origin"
-#define GST_LICENSE "LGPL"
-#define PACKAGE "gst-plugins-bad (qmake)"
-#define PACKAGE_VERSION "1.13.0.1"
-#endif
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- qmlgl,
- "Qt gl plugin",
- plugin_init, PACKAGE_VERSION, GST_LICENSE, GST_PACKAGE_NAME,
- GST_PACKAGE_ORIGIN)
diff --git a/ext/qt/gstqsgtexture.cc b/ext/qt/gstqsgtexture.cc
deleted file mode 100644
index 2b314e0ee..000000000
--- a/ext/qt/gstqsgtexture.cc
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <vector>
-#include <stdio.h>
-
-#include <gst/video/video.h>
-#include <gst/gl/gl.h>
-#include <gst/gl/gstglfuncs.h>
-#include "gstqsgtexture.h"
-
-#define GST_CAT_DEFAULT gst_qsg_texture_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-GstQSGTexture::GstQSGTexture ()
-{
- static volatile gsize _debug;
-
- initializeOpenGLFunctions();
-
- if (g_once_init_enter (&_debug)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "qtqsgtexture", 0,
- "Qt Scenegraph Texture");
- g_once_init_leave (&_debug, 1);
- }
-
- gst_video_info_init (&this->v_info);
- this->buffer_ = NULL;
- this->qt_context_ = NULL;
- this->sync_buffer_ = gst_buffer_new ();
- this->dummy_tex_id_ = 0;
-}
-
-GstQSGTexture::~GstQSGTexture ()
-{
- gst_buffer_replace (&this->buffer_, NULL);
- gst_buffer_replace (&this->sync_buffer_, NULL);
- if (this->dummy_tex_id_ && QOpenGLContext::currentContext ()) {
- QOpenGLContext::currentContext ()->functions ()->glDeleteTextures (1,
- &this->dummy_tex_id_);
- }
-}
-
-/* only called from the streaming thread with scene graph thread blocked */
-void
-GstQSGTexture::setCaps (GstCaps * caps)
-{
- GST_LOG ("%p setCaps %" GST_PTR_FORMAT, this, caps);
-
- gst_video_info_from_caps (&this->v_info, caps);
-}
-
-/* only called from the streaming thread with scene graph thread blocked */
-gboolean
-GstQSGTexture::setBuffer (GstBuffer * buffer)
-{
- GST_LOG ("%p setBuffer %" GST_PTR_FORMAT, this, buffer);
- /* FIXME: update more state here */
- if (!gst_buffer_replace (&this->buffer_, buffer))
- return FALSE;
-
- this->qt_context_ = gst_gl_context_get_current ();
-
- return TRUE;
-}
-
-/* only called from qt's scene graph render thread */
-void
-GstQSGTexture::bind ()
-{
- const GstGLFuncs *gl;
- GstGLContext *context;
- GstGLSyncMeta *sync_meta;
- GstMemory *mem;
- guint tex_id;
- gboolean use_dummy_tex = TRUE;
-
- if (!this->qt_context_)
- return;
-
- gst_gl_context_activate (this->qt_context_, TRUE);
-
- if (!this->buffer_)
- goto out;
- if (GST_VIDEO_INFO_FORMAT (&this->v_info) == GST_VIDEO_FORMAT_UNKNOWN)
- goto out;
-
- this->mem_ = gst_buffer_peek_memory (this->buffer_, 0);
- if (!this->mem_)
- goto out;
-
- g_assert (this->qt_context_);
- gl = this->qt_context_->gl_vtable;
-
- /* FIXME: should really lock the memory to prevent write access */
- if (!gst_video_frame_map (&this->v_frame, &this->v_info, this->buffer_,
- (GstMapFlags) (GST_MAP_READ | GST_MAP_GL))) {
- g_assert_not_reached ();
- goto out;
- }
-
- mem = gst_buffer_peek_memory (this->buffer_, 0);
- g_assert (gst_is_gl_memory (mem));
-
- context = ((GstGLBaseMemory *)mem)->context;
-
- sync_meta = gst_buffer_get_gl_sync_meta (this->sync_buffer_);
- if (!sync_meta)
- sync_meta = gst_buffer_add_gl_sync_meta (context, this->sync_buffer_);
-
- gst_gl_sync_meta_set_sync_point (sync_meta, context);
-
- gst_gl_sync_meta_wait (sync_meta, this->qt_context_);
-
- tex_id = *(guint *) this->v_frame.data[0];
- GST_LOG ("%p binding Qt texture %u", this, tex_id);
-
- gl->BindTexture (GL_TEXTURE_2D, tex_id);
-
- gst_video_frame_unmap (&this->v_frame);
-
- /* Texture was successfully bound, so we do not need
- * to use the dummy texture */
- use_dummy_tex = FALSE;
-
-out:
- if (G_UNLIKELY (use_dummy_tex)) {
- QOpenGLContext *qglcontext = QOpenGLContext::currentContext ();
- QOpenGLFunctions *funcs = qglcontext->functions ();
-
- /* Create dummy texture if not already present.
- * Use the Qt OpenGL functions instead of the GstGL ones,
- * since we are using the Qt OpenGL context here, and we must
- * be able to delete the texture in the destructor. */
- if (this->dummy_tex_id_ == 0) {
- /* Make this a black 64x64 pixel RGBA texture.
- * This size and format is supported pretty much everywhere, so these
- * are a safe pick. (64 pixel sidelength must be supported according
- * to the GLES2 spec, table 6.18.)
- * Set min/mag filters to GL_LINEAR to make sure no mipmapping is used. */
- const int tex_sidelength = 64;
- std::vector < guint8 > dummy_data (tex_sidelength * tex_sidelength * 4, 0);
-
- funcs->glGenTextures (1, &this->dummy_tex_id_);
- funcs->glBindTexture (GL_TEXTURE_2D, this->dummy_tex_id_);
- funcs->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- funcs->glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- funcs->glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, tex_sidelength,
- tex_sidelength, 0, GL_RGBA, GL_UNSIGNED_BYTE, &dummy_data[0]);
- }
-
- g_assert (this->dummy_tex_id_ != 0);
-
- funcs->glBindTexture (GL_TEXTURE_2D, this->dummy_tex_id_);
- }
-
- gst_gl_context_activate (this->qt_context_, FALSE);
-}
-
-/* can be called from any thread */
-int
-GstQSGTexture::textureId () const
-{
- int tex_id = 0;
-
- if (this->buffer_) {
- GstMemory *mem = gst_buffer_peek_memory (this->buffer_, 0);
-
- tex_id = ((GstGLMemory *) mem)->tex_id;
- }
-
- GST_LOG ("%p get texture id %u", this, tex_id);
-
- return tex_id;
-}
-
-/* can be called from any thread */
-QSize
-GstQSGTexture::textureSize () const
-{
- if (GST_VIDEO_INFO_FORMAT (&this->v_info) == GST_VIDEO_FORMAT_UNKNOWN)
- return QSize (0, 0);
-
- GST_TRACE ("%p get texture size %ux%u", this, this->v_info.width,
- this->v_info.height);
-
- return QSize (this->v_info.width, this->v_info.height);
-}
-
-/* can be called from any thread */
-bool
-GstQSGTexture::hasAlphaChannel () const
-{
- /* FIXME: support RGB textures */
- return true;
-}
-
-/* can be called from any thread */
-bool
-GstQSGTexture::hasMipmaps () const
-{
- return false;
-}
diff --git a/ext/qt/gstqsgtexture.h b/ext/qt/gstqsgtexture.h
deleted file mode 100644
index fdabe93a9..000000000
--- a/ext/qt/gstqsgtexture.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-#ifndef __GST_QSG_TEXTURE_H__
-#define __GST_QSG_TEXTURE_H__
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <gst/gl/gl.h>
-
-#include "gstqtgl.h"
-#include <QtQuick/QSGTexture>
-#include <QtGui/QOpenGLFunctions>
-
-class GstQSGTexture : public QSGTexture, protected QOpenGLFunctions
-{
- Q_OBJECT
-public:
- GstQSGTexture ();
- ~GstQSGTexture ();
-
- void setCaps (GstCaps * caps);
- gboolean setBuffer (GstBuffer * buffer);
-
- /* QSGTexture */
- void bind ();
- int textureId () const;
- QSize textureSize () const;
- bool hasAlphaChannel () const;
- bool hasMipmaps () const;
-
-private:
- GstBuffer * buffer_;
- GstBuffer * sync_buffer_;
- GstGLContext * qt_context_;
- GstMemory * mem_;
- GLuint dummy_tex_id_;
- GstVideoInfo v_info;
- GstVideoFrame v_frame;
-};
-
-#endif /* __GST_QSG_TEXTURE_H__ */
diff --git a/ext/qt/gstqtgl.h b/ext/qt/gstqtgl.h
deleted file mode 100644
index 85aad6205..000000000
--- a/ext/qt/gstqtgl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-/* qt uses the same trick as us to typedef GLsync on gles2 but to a different
- * type which confuses the preprocessor. As it's never actually used by qt
- * public headers, define it to something else to avoid redefinition
- * warnings/errors */
-
-#include <gst/gl/gstglconfig.h>
-#include <QtCore/qglobal.h>
-#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
-#include <QtGui/qtgui-config.h>
-#endif
-
-#if defined(QT_OPENGL_ES_2) && GST_GL_HAVE_WINDOW_ANDROID
-#define GLsync gst_qt_GLsync
-#include <QOpenGLContext>
-#include <QOpenGLFunctions>
-#undef GLsync
-#endif /* defined(QT_OPENGL_ES_2) */
diff --git a/ext/qt/gstqtglutility.cc b/ext/qt/gstqtglutility.cc
deleted file mode 100644
index 8d5b24283..000000000
--- a/ext/qt/gstqtglutility.cc
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstqtglutility.h"
-#include <QtGui/QGuiApplication>
-
-#if GST_GL_HAVE_WINDOW_X11 && defined (HAVE_QT_X11)
-#include <QX11Info>
-#include <gst/gl/x11/gstgldisplay_x11.h>
-#endif
-
-#if GST_GL_HAVE_WINDOW_WAYLAND && GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_WAYLAND)
-#include <qpa/qplatformnativeinterface.h>
-#include <gst/gl/wayland/gstgldisplay_wayland.h>
-#endif
-
-#if GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_EGLFS)
-#if GST_GL_HAVE_WINDOW_VIV_FB
-#include <qpa/qplatformnativeinterface.h>
-#include <gst/gl/viv-fb/gstgldisplay_viv_fb.h>
-#else
-#include <gst/gl/egl/gstegl.h>
-#include <gst/gl/egl/gstgldisplay_egl.h>
-#endif
-#endif
-
-#define GST_CAT_DEFAULT qt_gl_utils_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-GstGLDisplay *
-gst_qt_get_gl_display ()
-{
- GstGLDisplay *display = NULL;
- QGuiApplication *app = static_cast<QGuiApplication *> (QCoreApplication::instance ());
- static volatile gsize _debug;
-
- g_assert (app != NULL);
-
- if (g_once_init_enter (&_debug)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "qtglutility", 0,
- "Qt gl utility functions");
- g_once_init_leave (&_debug, 1);
- }
- GST_INFO ("QGuiApplication::instance()->platformName() %s", app->platformName().toUtf8().data());
-
-#if GST_GL_HAVE_WINDOW_X11 && defined (HAVE_QT_X11)
- if (QString::fromUtf8 ("xcb") == app->platformName())
- display = (GstGLDisplay *)
- gst_gl_display_x11_new_with_display (QX11Info::display ());
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND && GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_WAYLAND)
- if (QString::fromUtf8 ("wayland") == app->platformName()
- || QString::fromUtf8 ("wayland-egl") == app->platformName()){
- struct wl_display * wayland_display;
- QPlatformNativeInterface *native =
- QGuiApplication::platformNativeInterface();
- wayland_display = (struct wl_display *)
- native->nativeResourceForWindow("display", NULL);
- display = (GstGLDisplay *)
- gst_gl_display_wayland_new_with_display (wayland_display);
- }
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL && GST_GL_HAVE_WINDOW_ANDROID
- if (QString::fromUtf8 ("android") == app->platformName())
- display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (eglGetDisplay(EGL_DEFAULT_DISPLAY));
-#elif GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_EGLFS)
- if (QString::fromUtf8("eglfs") == app->platformName()) {
-#if GST_GL_HAVE_WINDOW_VIV_FB
- /* FIXME: Could get the display directly from Qt like this
- QPlatformNativeInterface *native =
- QGuiApplication::platformNativeInterface();
- EGLDisplay egl_display = (EGLDisplay)
- native->nativeResourceForWindow("egldisplay", NULL);
-
- However we seem to have no way for getting the EGLNativeDisplayType, aka
- native_display, via public API. As such we have to assume that display 0
- is always used. Only way around that is parsing the index the same way as
- Qt does in QEGLDeviceIntegration::fbDeviceName(), so let's do that.
- */
- const gchar *fb_dev;
- gint disp_idx = 0;
-
- fb_dev = g_getenv ("QT_QPA_EGLFS_FB");
- if (fb_dev) {
- if (sscanf (fb_dev, "/dev/fb%d", &disp_idx) != 1)
- disp_idx = 0;
- }
-
- display = (GstGLDisplay *) gst_gl_display_viv_fb_new (disp_idx);
-#else
- display = (GstGLDisplay *) gst_gl_display_egl_new_with_egl_display (eglGetDisplay(EGL_DEFAULT_DISPLAY));
-#endif
- }
-#endif
-
-#if GST_GL_HAVE_WINDOW_COCOA && GST_GL_HAVE_PLATFORM_CGL && defined (HAVE_QT_MAC)
- if (QString::fromUtf8 ("cocoa") == app->platformName())
- display = (GstGLDisplay *) gst_gl_display_new ();
-#endif
-#if GST_GL_HAVE_WINDOW_EAGL && GST_GL_HAVE_PLATFORM_EAGL && defined (HAVE_QT_IOS)
- if (QString::fromUtf8 ("ios") == app->platformName())
- display = gst_gl_display_new ();
-#endif
-#if GST_GL_HAVE_WINDOW_WIN32 && GST_GL_HAVE_PLATFORM_WGL && defined (HAVE_QT_WIN32)
- if (QString::fromUtf8 ("windows") == app->platformName())
- display = gst_gl_display_new ();
-#endif
-
- if (!display)
- display = gst_gl_display_new ();
-
- return display;
-}
-
-gboolean
-gst_qt_get_gl_wrapcontext (GstGLDisplay * display,
- GstGLContext **wrap_glcontext, GstGLContext **context)
-{
- GstGLPlatform platform = (GstGLPlatform) 0;
- GstGLAPI gl_api;
- guintptr gl_handle;
- GError *error = NULL;
-
- g_return_val_if_fail (display != NULL && wrap_glcontext != NULL, FALSE);
-
-#if GST_GL_HAVE_WINDOW_X11 && defined (HAVE_QT_X11)
- if (GST_IS_GL_DISPLAY_X11 (display)) {
-#if GST_GL_HAVE_PLATFORM_GLX
- platform = GST_GL_PLATFORM_GLX;
-#elif GST_GL_HAVE_PLATFORM_EGL
- platform = GST_GL_PLATFORM_EGL;
-#endif
- }
-#endif
-#if GST_GL_HAVE_WINDOW_WAYLAND && defined (HAVE_QT_WAYLAND)
- if (GST_IS_GL_DISPLAY_WAYLAND (display)) {
- platform = GST_GL_PLATFORM_EGL;
- }
-#endif
-#if GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_EGLFS)
-#if GST_GL_HAVE_WINDOW_VIV_FB
- if (GST_IS_GL_DISPLAY_VIV_FB (display)) {
-#else
- if (GST_IS_GL_DISPLAY_EGL (display)) {
-#endif
- platform = GST_GL_PLATFORM_EGL;
- }
-#endif
- if (platform == 0) {
-#if GST_GL_HAVE_WINDOW_COCOA && GST_GL_HAVE_PLATFORM_CGL && defined (HAVE_QT_MAC)
- platform = GST_GL_PLATFORM_CGL;
-#elif GST_GL_HAVE_WINDOW_EAGL && GST_GL_HAVE_PLATFORM_EAGL && defined (HAVE_QT_IOS)
- platform = GST_GL_PLATFORM_EAGL;
-#elif GST_GL_HAVE_WINDOW_WIN32 && GST_GL_HAVE_PLATFORM_WGL && defined (HAVE_QT_WIN32)
- platform = GST_GL_PLATFORM_WGL;
-#else
- GST_ERROR ("Unknown platform");
- return FALSE;
-#endif
- }
-
- 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)
- *wrap_glcontext =
- gst_gl_context_new_wrapped (display, gl_handle,
- platform, gl_api);
-
- if (!*wrap_glcontext) {
- GST_ERROR ("cannot wrap qt OpenGL context");
- return FALSE;
- }
-
- (void) platform;
- (void) gl_api;
- (void) gl_handle;
-
- gst_gl_context_activate (*wrap_glcontext, TRUE);
- if (!gst_gl_context_fill_info (*wrap_glcontext, &error)) {
- GST_ERROR ("failed to retrieve qt context info: %s", error->message);
- g_object_unref (*wrap_glcontext);
- *wrap_glcontext = NULL;
- return FALSE;
- } else {
- gst_gl_display_filter_gl_api (display, gst_gl_context_get_gl_api (*wrap_glcontext));
-#if GST_GL_HAVE_WINDOW_WIN32 && GST_GL_HAVE_PLATFORM_WGL && defined (HAVE_QT_WIN32)
- g_return_val_if_fail (context != NULL, FALSE);
-
- G_STMT_START {
- GstGLWindow *window;
- HDC device;
-
- /* If there's no wglCreateContextAttribsARB() support, then we would fallback to
- * wglShareLists() which will fail with ERROR_BUSY (0xaa) if either of the GL
- * contexts are current in any other thread.
- *
- * The workaround here is to temporarily disable Qt's GL context while we
- * set up our own.
- *
- * Sometimes wglCreateContextAttribsARB()
- * exists, but isn't functional (some Intel drivers), so it's easiest to do this
- * unconditionally.
- */
- *context = gst_gl_context_new (display);
- window = gst_gl_context_get_window (*context);
- device = (HDC) gst_gl_window_get_display (window);
-
- wglMakeCurrent (device, 0);
- gst_object_unref (window);
- if (!gst_gl_context_create (*context, *wrap_glcontext, &error)) {
- GST_ERROR ("%p failed to create shared GL context: %s", this, error->message);
- g_object_unref (*context);
- *context = NULL;
- g_object_unref (*wrap_glcontext);
- *wrap_glcontext = NULL;
- wglMakeCurrent (device, (HGLRC) gl_handle);
- return FALSE;
- }
- wglMakeCurrent (device, (HGLRC) gl_handle);
- }
-#endif
- gst_gl_context_activate (*wrap_glcontext, FALSE);
- } G_STMT_END;
-
- return TRUE;
-}
diff --git a/ext/qt/gstqtglutility.h b/ext/qt/gstqtglutility.h
deleted file mode 100644
index ca9023773..000000000
--- a/ext/qt/gstqtglutility.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *
- * 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.
- */
-
-#ifndef __QT_GL_UTILS_H__
-#define __QT_GL_UTILS_H__
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-
-G_BEGIN_DECLS
-
-GstGLDisplay * gst_qt_get_gl_display ();
-gboolean gst_qt_get_gl_wrapcontext (GstGLDisplay * display,
- GstGLContext **wrap_glcontext, GstGLContext **context);
-
-G_END_DECLS
-#endif /* __QT_GL_UTILS_H__ */
diff --git a/ext/qt/gstqtsink.cc b/ext/qt/gstqtsink.cc
deleted file mode 100644
index 2a4ad7ccc..000000000
--- a/ext/qt/gstqtsink.cc
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-/**
- * SECTION:gstqtsink
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstqtsink.h"
-#include <QtGui/QGuiApplication>
-
-#include <gst/gl/gstglfuncs.h>
-
-#define GST_CAT_DEFAULT gst_debug_qt_gl_sink
-GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
-
-static void gst_qt_sink_finalize (GObject * object);
-static void gst_qt_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * param_spec);
-static void gst_qt_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * param_spec);
-
-static gboolean gst_qt_sink_stop (GstBaseSink * bsink);
-
-static gboolean gst_qt_sink_query (GstBaseSink * bsink, GstQuery * query);
-
-static GstStateChangeReturn
-gst_qt_sink_change_state (GstElement * element, GstStateChange transition);
-
-static void gst_qt_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
- GstClockTime * start, GstClockTime * end);
-static gboolean gst_qt_sink_set_caps (GstBaseSink * bsink, GstCaps * caps);
-static GstFlowReturn gst_qt_sink_show_frame (GstVideoSink * bsink,
- GstBuffer * buf);
-static gboolean gst_qt_sink_propose_allocation (GstBaseSink * bsink,
- GstQuery * query);
-
-static GstStaticPadTemplate gst_qt_sink_template =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
- "format = (string) RGBA, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", "
- "framerate = " GST_VIDEO_FPS_RANGE ", "
- "texture-target = (string) 2D"));
-
-#define DEFAULT_FORCE_ASPECT_RATIO TRUE
-#define DEFAULT_PAR_N 0
-#define DEFAULT_PAR_D 1
-
-enum
-{
- ARG_0,
- PROP_WIDGET,
- PROP_FORCE_ASPECT_RATIO,
- PROP_PIXEL_ASPECT_RATIO,
-};
-
-enum
-{
- SIGNAL_0,
- LAST_SIGNAL
-};
-
-#define gst_qt_sink_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstQtSink, gst_qt_sink,
- GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
- "qtsink", 0, "Qt Video Sink"));
-
-static void
-gst_qt_sink_class_init (GstQtSinkClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
- GstVideoSinkClass *gstvideosink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
- gstvideosink_class = (GstVideoSinkClass *) klass;
-
- gobject_class->set_property = gst_qt_sink_set_property;
- gobject_class->get_property = gst_qt_sink_get_property;
-
- gst_element_class_set_metadata (gstelement_class, "Qt Video Sink",
- "Sink/Video", "A video sink that renders to a QQuickItem",
- "Matthew Waters <matthew@centricular.com>");
-
- g_object_class_install_property (gobject_class, PROP_WIDGET,
- g_param_spec_pointer ("widget", "QQuickItem",
- "The QQuickItem to place in the object hierarchy",
- (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
-
- g_object_class_install_property (gobject_class, PROP_FORCE_ASPECT_RATIO,
- g_param_spec_boolean ("force-aspect-ratio",
- "Force aspect ratio",
- "When enabled, scaling will respect original aspect ratio",
- DEFAULT_FORCE_ASPECT_RATIO,
- (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
-
- g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO,
- gst_param_spec_fraction ("pixel-aspect-ratio", "Pixel Aspect Ratio",
- "The pixel aspect ratio of the device", DEFAULT_PAR_N, DEFAULT_PAR_D,
- G_MAXINT, 1, 1, 1,
- (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
-
- gst_element_class_add_static_pad_template (gstelement_class, &gst_qt_sink_template);
-
- gobject_class->finalize = gst_qt_sink_finalize;
-
- gstelement_class->change_state = gst_qt_sink_change_state;
- gstbasesink_class->query = gst_qt_sink_query;
- gstbasesink_class->set_caps = gst_qt_sink_set_caps;
- gstbasesink_class->get_times = gst_qt_sink_get_times;
- gstbasesink_class->propose_allocation = gst_qt_sink_propose_allocation;
- gstbasesink_class->stop = gst_qt_sink_stop;
-
- gstvideosink_class->show_frame = gst_qt_sink_show_frame;
-}
-
-static void
-gst_qt_sink_init (GstQtSink * qt_sink)
-{
- qt_sink->widget = QSharedPointer<QtGLVideoItemInterface>();
-}
-
-static void
-gst_qt_sink_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstQtSink *qt_sink = GST_QT_SINK (object);
-
- switch (prop_id) {
- case PROP_WIDGET: {
- QtGLVideoItem *qt_item = static_cast<QtGLVideoItem *> (g_value_get_pointer (value));
- if (qt_item)
- qt_sink->widget = qt_item->getInterface();
- else
- qt_sink->widget.clear();
- break;
- }
- case PROP_FORCE_ASPECT_RATIO:
- g_return_if_fail (qt_sink->widget);
- qt_sink->widget->setForceAspectRatio (g_value_get_boolean (value));
- break;
- case PROP_PIXEL_ASPECT_RATIO:
- g_return_if_fail (qt_sink->widget);
- qt_sink->widget->setDAR (gst_value_get_fraction_numerator (value),
- gst_value_get_fraction_denominator (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-_reset (GstQtSink * qt_sink)
-{
- if (qt_sink->display) {
- gst_object_unref (qt_sink->display);
- qt_sink->display = NULL;
- }
-
- if (qt_sink->context) {
- gst_object_unref (qt_sink->context);
- qt_sink->context = NULL;
- }
-
- if (qt_sink->qt_context) {
- gst_object_unref (qt_sink->qt_context);
- qt_sink->qt_context = NULL;
- }
-}
-
-static void
-gst_qt_sink_finalize (GObject * object)
-{
- GstQtSink *qt_sink = GST_QT_SINK (object);
-
- _reset (qt_sink);
-
- qt_sink->widget.clear();
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gst_qt_sink_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstQtSink *qt_sink = GST_QT_SINK (object);
-
- switch (prop_id) {
- case PROP_WIDGET:
- /* This is not really safe - the app needs to be
- * sure the widget is going to be kept alive or
- * this can crash */
- if (qt_sink->widget)
- g_value_set_pointer (value, qt_sink->widget->videoItem());
- else
- g_value_set_pointer (value, NULL);
- break;
- case PROP_FORCE_ASPECT_RATIO:
- if (qt_sink->widget)
- g_value_set_boolean (value, qt_sink->widget->getForceAspectRatio ());
- else
- g_value_set_boolean (value, DEFAULT_FORCE_ASPECT_RATIO);
- break;
- case PROP_PIXEL_ASPECT_RATIO:
- if (qt_sink->widget) {
- gint num, den;
- qt_sink->widget->getDAR (&num, &den);
- gst_value_set_fraction (value, num, den);
- } else {
- gst_value_set_fraction (value, DEFAULT_PAR_N, DEFAULT_PAR_D);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static gboolean
-gst_qt_sink_query (GstBaseSink * bsink, GstQuery * query)
-{
- GstQtSink *qt_sink = GST_QT_SINK (bsink);
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CONTEXT:
- {
- if (gst_gl_handle_context_query ((GstElement *) qt_sink, query,
- qt_sink->display, qt_sink->context, qt_sink->qt_context))
- return TRUE;
-
- /* fallthrough */
- }
- default:
- res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
- break;
- }
-
- return res;
-}
-
-static gboolean
-gst_qt_sink_stop (GstBaseSink * bsink)
-{
- return TRUE;
-}
-
-static GstStateChangeReturn
-gst_qt_sink_change_state (GstElement * element, GstStateChange transition)
-{
- GstQtSink *qt_sink = GST_QT_SINK (element);
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- QGuiApplication *app;
-
- GST_DEBUG ("changing state: %s => %s",
- gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
- gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- app = static_cast<QGuiApplication *> (QCoreApplication::instance ());
- if (!app) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
- ("%s", "Failed to connect to Qt"),
- ("%s", "Could not retrieve QGuiApplication instance"));
- return GST_STATE_CHANGE_FAILURE;
- }
-
- if (!qt_sink->widget) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
- ("%s", "Required property \'widget\' not set"),
- (NULL));
- return GST_STATE_CHANGE_FAILURE;
- }
-
- if (!qt_sink->widget->initWinSys()) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
- ("%s", "Could not initialize window system"),
- (NULL));
- return GST_STATE_CHANGE_FAILURE;
- }
-
- qt_sink->display = qt_sink->widget->getDisplay();
- qt_sink->context = qt_sink->widget->getContext();
- qt_sink->qt_context = qt_sink->widget->getQtContext();
-
- if (!qt_sink->display || !qt_sink->context || !qt_sink->qt_context) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
- ("%s", "Could not retrieve window system OpenGL configuration"),
- (NULL));
- return GST_STATE_CHANGE_FAILURE;
- }
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- if (qt_sink->widget)
- qt_sink->widget->setBuffer(NULL);
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static void
-gst_qt_sink_get_times (GstBaseSink * bsink, GstBuffer * buf,
- GstClockTime * start, GstClockTime * end)
-{
- GstQtSink *qt_sink;
-
- qt_sink = GST_QT_SINK (bsink);
-
- if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {
- *start = GST_BUFFER_TIMESTAMP (buf);
- if (GST_BUFFER_DURATION_IS_VALID (buf))
- *end = *start + GST_BUFFER_DURATION (buf);
- else {
- if (GST_VIDEO_INFO_FPS_N (&qt_sink->v_info) > 0) {
- *end = *start +
- gst_util_uint64_scale_int (GST_SECOND,
- GST_VIDEO_INFO_FPS_D (&qt_sink->v_info),
- GST_VIDEO_INFO_FPS_N (&qt_sink->v_info));
- }
- }
- }
-}
-
-gboolean
-gst_qt_sink_set_caps (GstBaseSink * bsink, GstCaps * caps)
-{
- GstQtSink *qt_sink = GST_QT_SINK (bsink);
-
- GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps);
-
- if (!gst_video_info_from_caps (&qt_sink->v_info, caps))
- return FALSE;
-
- if (!qt_sink->widget)
- return FALSE;
-
- return qt_sink->widget->setCaps(caps);
-}
-
-static GstFlowReturn
-gst_qt_sink_show_frame (GstVideoSink * vsink, GstBuffer * buf)
-{
- GstQtSink *qt_sink;
-
- GST_TRACE ("rendering buffer:%p", buf);
-
- qt_sink = GST_QT_SINK (vsink);
-
- if (qt_sink->widget)
- qt_sink->widget->setBuffer(buf);
-
- return GST_FLOW_OK;
-}
-
-static gboolean
-gst_qt_sink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
-{
- GstQtSink *qt_sink = GST_QT_SINK (bsink);
- GstBufferPool *pool;
- GstStructure *config;
- GstCaps *caps;
- guint size;
- gboolean need_pool;
-
- if (!qt_sink->display || !qt_sink->context)
- return FALSE;
-
- gst_query_parse_allocation (query, &caps, &need_pool);
-
- if (caps == NULL)
- goto no_caps;
-
- /* FIXME re-using buffer pool breaks renegotiation */
- if ((pool = qt_sink->pool))
- gst_object_ref (pool);
-
- if (pool != NULL) {
- GstCaps *pcaps;
-
- /* we had a pool, check caps */
- GST_DEBUG_OBJECT (qt_sink, "check existing pool caps");
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_get_params (config, &pcaps, &size, NULL, NULL);
-
- if (!gst_caps_is_equal (caps, pcaps)) {
- GST_DEBUG_OBJECT (qt_sink, "pool has different caps");
- /* different caps, we can't use this pool */
- gst_object_unref (pool);
- pool = NULL;
- }
- gst_structure_free (config);
- } else {
- GstVideoInfo info;
-
- if (!gst_video_info_from_caps (&info, caps))
- goto invalid_caps;
-
- /* the normal size of a frame */
- size = info.size;
- }
-
- if (pool == NULL && need_pool) {
-
- GST_DEBUG_OBJECT (qt_sink, "create new pool");
- pool = gst_gl_buffer_pool_new (qt_sink->context);
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
- if (!gst_buffer_pool_set_config (pool, config))
- goto config_failed;
- }
-
- /* we need at least 2 buffer because we hold on to the last one */
- gst_query_add_allocation_pool (query, pool, size, 2, 0);
- if (pool)
- gst_object_unref (pool);
-
- /* we also support various metadata */
- gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
-
- if (qt_sink->context->gl_vtable->FenceSync)
- gst_query_add_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, 0);
-
- return TRUE;
-
- /* ERRORS */
-no_caps:
- {
- GST_DEBUG_OBJECT (bsink, "no caps specified");
- return FALSE;
- }
-invalid_caps:
- {
- GST_DEBUG_OBJECT (bsink, "invalid caps specified");
- return FALSE;
- }
-config_failed:
- {
- GST_DEBUG_OBJECT (bsink, "failed setting config");
- return FALSE;
- }
-}
diff --git a/ext/qt/gstqtsink.h b/ext/qt/gstqtsink.h
deleted file mode 100644
index 3ee20b7d5..000000000
--- a/ext/qt/gstqtsink.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-#ifndef __GST_QT_SINK_H__
-#define __GST_QT_SINK_H__
-
-#include <gst/gst.h>
-#include <gst/video/gstvideosink.h>
-#include <gst/video/video.h>
-#include <gst/gl/gl.h>
-#include "qtitem.h"
-
-typedef struct _GstQtSink GstQtSink;
-typedef struct _GstQtSinkClass GstQtSinkClass;
-typedef struct _GstQtSinkPrivate GstQtSinkPrivate;
-
-G_BEGIN_DECLS
-
-GType gst_qt_sink_get_type (void);
-#define GST_TYPE_QT_SINK (gst_qt_sink_get_type())
-#define GST_QT_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QT_SINK,GstQtSink))
-#define GST_QT_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QT_SINK,GstQtSinkClass))
-#define GST_IS_QT_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QT_SINK))
-#define GST_IS_QT_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QT_SINK))
-#define GST_QT_SINK_CAST(obj) ((GstQtSink*)(obj))
-
-/**
- * GstQtSink:
- *
- * Opaque #GstQtSink object
- */
-struct _GstQtSink
-{
- /* <private> */
- GstVideoSink parent;
-
- GstVideoInfo v_info;
- GstBufferPool *pool;
-
- GstGLDisplay *display;
- GstGLContext *context;
- GstGLContext *qt_context;
-
- QSharedPointer<QtGLVideoItemInterface> widget;
-};
-
-/**
- * GstQtSinkClass:
- *
- * The #GstQtSinkClass struct only contains private data
- */
-struct _GstQtSinkClass
-{
- /* <private> */
- GstVideoSinkClass object_class;
-};
-
-GstQtSink * gst_qt_sink_new (void);
-
-G_END_DECLS
-
-#endif /* __GST_QT_SINK_H__ */
diff --git a/ext/qt/gstqtsrc.cc b/ext/qt/gstqtsrc.cc
deleted file mode 100644
index 1cf9592b5..000000000
--- a/ext/qt/gstqtsrc.cc
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *
- * 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.
- */
-
-/**
- * SECTION:qmlglsrc
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gstqtsrc.h"
-#include <QtGui/QGuiApplication>
-
-#define GST_CAT_DEFAULT gst_debug_qt_gl_src
-GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
-
-#define DEFAULT_IS_LIVE TRUE
-
-static void gst_qt_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_qt_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void gst_qt_src_finalize (GObject * object);
-
-static gboolean gst_qt_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
-static GstCaps *gst_qt_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter);
-static gboolean gst_qt_src_query (GstBaseSrc * bsrc, GstQuery * query);
-
-static gboolean gst_qt_src_decide_allocation (GstBaseSrc * bsrc,
- GstQuery * query);
-static GstFlowReturn gst_qt_src_fill (GstPushSrc * psrc, GstBuffer * buffer);
-static GstStateChangeReturn gst_qt_src_change_state (GstElement * element,
- GstStateChange transition);
-static gboolean gst_qt_src_start (GstBaseSrc * basesrc);
-static gboolean gst_qt_src_stop (GstBaseSrc * basesrc);
-
-static GstStaticPadTemplate gst_qt_src_template =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), "
- "format = (string) RGBA, "
- "width = " GST_VIDEO_SIZE_RANGE ", "
- "height = " GST_VIDEO_SIZE_RANGE ", "
- "framerate = " GST_VIDEO_FPS_RANGE ", "
- "texture-target = (string) 2D"));
-
-enum
-{
- ARG_0,
- PROP_WINDOW,
- PROP_DEFAULT_FBO
-};
-
-#define gst_qt_src_parent_class parent_class
-G_DEFINE_TYPE_WITH_CODE (GstQtSrc, gst_qt_src,
- GST_TYPE_PUSH_SRC, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
- "qtsrc", 0, "Qt Video Src"));
-
-static const gfloat vertical_flip_matrix[] = {
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, -1.0f, 0.0f, 1.0f,
- 0.0f, 0.0f, 1.0f, 0.0f,
- 0.0f, 0.0f, 0.0f, 1.0f,
-};
-
-static void
-gst_qt_src_class_init (GstQtSrcClass * klass)
-{
- GObjectClass *gobject_class = (GObjectClass *) klass;
- GstElementClass *gstelement_class = (GstElementClass *) klass;
- GstBaseSrcClass *gstbasesrc_class = (GstBaseSrcClass *) klass;
- GstPushSrcClass *gstpushsrc_class = (GstPushSrcClass *) klass;
-
- gobject_class->set_property = gst_qt_src_set_property;
- gobject_class->get_property = gst_qt_src_get_property;
- gobject_class->finalize = gst_qt_src_finalize;
-
- gst_element_class_set_metadata (gstelement_class, "Qt Video Source",
- "Source/Video", "A video src that captures a window from a QML view",
- "Multimedia Team <shmmmw@freescale.com>");
-
- g_object_class_install_property (gobject_class, PROP_WINDOW,
- g_param_spec_pointer ("window", "QQuickWindow",
- "The QQuickWindow to place in the object hierarchy",
- (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
-
- g_object_class_install_property (gobject_class, PROP_DEFAULT_FBO,
- g_param_spec_boolean ("use-default-fbo",
- "Whether to use default FBO",
- "When set it will not create a new FBO for the QML render thread",
- FALSE, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
-
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&gst_qt_src_template));
-
- gstelement_class->change_state = gst_qt_src_change_state;
- gstbasesrc_class->set_caps = gst_qt_src_setcaps;
- gstbasesrc_class->get_caps = gst_qt_src_get_caps;
- gstbasesrc_class->query = gst_qt_src_query;
- gstbasesrc_class->start = gst_qt_src_start;
- gstbasesrc_class->stop = gst_qt_src_stop;
- gstbasesrc_class->decide_allocation = gst_qt_src_decide_allocation;
-
- gstpushsrc_class->fill = gst_qt_src_fill;
-}
-
-static void
-gst_qt_src_init (GstQtSrc * src)
-{
- gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
- gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE);
- src->default_fbo = FALSE;
- src->pending_image_orientation = TRUE;
-}
-
-static void
-gst_qt_src_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- GstQtSrc *qt_src = GST_QT_SRC (object);
-
- switch (prop_id) {
- case PROP_WINDOW:{
- qt_src->qwindow =
- static_cast < QQuickWindow * >(g_value_get_pointer (value));
-
- if (qt_src->window) {
- delete qt_src->window;
- qt_src->window = NULL;
- }
-
- if (qt_src->qwindow)
- qt_src->window = new QtGLWindow (NULL, qt_src->qwindow);
-
- break;
- }
- case PROP_DEFAULT_FBO:
- qt_src->default_fbo = g_value_get_boolean (value);
- if (qt_src->window)
- qt_window_use_default_fbo (qt_src->window, qt_src->default_fbo);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_qt_src_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- GstQtSrc *qt_src = GST_QT_SRC (object);
-
- switch (prop_id) {
- case PROP_WINDOW:
- g_value_set_pointer (value, qt_src->qwindow);
- break;
- case PROP_DEFAULT_FBO:
- g_value_set_boolean (value, qt_src->default_fbo);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_qt_src_finalize (GObject * object)
-{
- GstQtSrc *qt_src = GST_QT_SRC (object);
-
- GST_DEBUG ("qmlglsrc finalize");
- if (qt_src->context)
- gst_object_unref (qt_src->context);
- qt_src->context = NULL;
-
- if (qt_src->qt_context)
- gst_object_unref (qt_src->qt_context);
- qt_src->qt_context = NULL;
-
- if (qt_src->display)
- gst_object_unref (qt_src->display);
- qt_src->display = NULL;
-
- if (qt_src->window)
- delete qt_src->window;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gst_qt_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps)
-{
- GstQtSrc *qt_src = GST_QT_SRC (bsrc);
-
- GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps);
-
- if (!gst_video_info_from_caps (&qt_src->v_info, caps))
- return FALSE;
-
- if (!qt_window_set_caps (qt_src->window, caps))
- return FALSE;
-
- return TRUE;
-}
-
-static GstCaps *
-gst_qt_src_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
-{
- GstCaps *caps = NULL, *temp = NULL;
- GstPadTemplate *pad_template;
- GstBaseSrcClass *bclass = GST_BASE_SRC_GET_CLASS (bsrc);
- GstQtSrc *qt_src = GST_QT_SRC (bsrc);
- guint i;
- gint width, height;
-
- if (qt_src->window) {
- qt_src->window->getGeometry (&width, &height);
- }
-
- pad_template =
- gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "src");
- if (pad_template != NULL)
- caps = gst_pad_template_get_caps (pad_template);
-
- if (qt_src->window) {
- temp = gst_caps_copy (caps);
- guint n_caps = gst_caps_get_size (caps);
-
- for (i = 0; i < n_caps; i++) {
- GstStructure *s = gst_caps_get_structure (temp, i);
- gst_structure_set (s, "width", G_TYPE_INT, width, NULL);
- gst_structure_set (s, "height", G_TYPE_INT, height, NULL);
- /* because the framerate is unknown */
- gst_structure_set (s, "framerate", GST_TYPE_FRACTION, 0, 1, NULL);
- gst_structure_set (s, "pixel-aspect-ratio",
- GST_TYPE_FRACTION, 1, 1, NULL);
- }
-
- gst_caps_unref (caps);
- caps = temp;
- }
-
- if (filter) {
- GstCaps *intersection;
-
- intersection =
- gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (caps);
- caps = intersection;
- }
-
- return caps;
-}
-
-static gboolean
-gst_qt_src_query (GstBaseSrc * bsrc, GstQuery * query)
-{
- GstQtSrc *qt_src = GST_QT_SRC (bsrc);
- gboolean res = FALSE;
-
- switch (GST_QUERY_TYPE (query)) {
- case GST_QUERY_CONTEXT:
- {
- if (!qt_window_is_scenegraph_initialized (qt_src->window))
- return FALSE;
-
- if (!qt_src->display && !qt_src->qt_context) {
- qt_src->display = qt_window_get_display (qt_src->window);
- qt_src->qt_context = qt_window_get_qt_context (qt_src->window);
- }
-
- if (gst_gl_handle_context_query ((GstElement *) qt_src, query,
- qt_src->display, qt_src->context, qt_src->qt_context))
- return TRUE;
-
- /* fallthrough */
- }
- default:
- res = GST_BASE_SRC_CLASS (parent_class)->query (bsrc, query);
- break;
- }
-
- return res;
-}
-
-static gboolean
-_find_local_gl_context (GstQtSrc * qt_src)
-{
- if (gst_gl_query_local_gl_context (GST_ELEMENT (qt_src), GST_PAD_SRC,
- &qt_src->context))
- return TRUE;
- return FALSE;
-}
-
-static gboolean
-gst_qt_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
-{
- GstBufferPool *pool = NULL;
- GstStructure *config;
- GstCaps *caps;
- guint min, max, size, n, i;
- gboolean update_pool, update_allocator;
- GstAllocator *allocator;
- GstAllocationParams params;
- GstGLVideoAllocationParams *glparams;
- GstVideoInfo vinfo;
- GstQtSrc *qt_src = GST_QT_SRC (bsrc);
-
- if (gst_query_find_allocation_meta (query,
- GST_VIDEO_AFFINE_TRANSFORMATION_META_API_TYPE, NULL)) {
- qt_src->downstream_supports_affine_meta = TRUE;
- } else {
- qt_src->downstream_supports_affine_meta = FALSE;
- }
-
- gst_query_parse_allocation (query, &caps, NULL);
- if (!caps)
- return FALSE;
-
- gst_video_info_from_caps (&vinfo, caps);
-
- n = gst_query_get_n_allocation_pools (query);
- if (n > 0) {
- update_pool = TRUE;
- for (i = 0; i < n; i++) {
- gst_query_parse_nth_allocation_pool (query, i, &pool, &size, &min, &max);
-
- if (!pool || !GST_IS_GL_BUFFER_POOL (pool)) {
- if (pool)
- gst_object_unref (pool);
- pool = NULL;
- }
- }
- }
-
- if (!pool) {
- size = vinfo.size;
- min = max = 0;
- update_pool = FALSE;
- }
-
- if (!qt_src->context && !_find_local_gl_context (qt_src))
- return FALSE;
-
- if (!pool) {
- if (!qt_src->context || !GST_IS_GL_CONTEXT (qt_src->context))
- return FALSE;
-
- pool = gst_gl_buffer_pool_new (qt_src->context);
- GST_INFO_OBJECT (qt_src, "No pool, create one ourself %p", pool);
- }
-
- config = gst_buffer_pool_get_config (pool);
-
- gst_buffer_pool_config_set_params (config, caps, size, min, max);
- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
- if (gst_query_find_allocation_meta (query, GST_GL_SYNC_META_API_TYPE, NULL))
- gst_buffer_pool_config_add_option (config,
- GST_BUFFER_POOL_OPTION_GL_SYNC_META);
-
- if (gst_query_get_n_allocation_params (query) > 0) {
- gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
- gst_buffer_pool_config_set_allocator (config, allocator, &params);
- GST_INFO_OBJECT (qt_src, "got allocator %p", allocator);
- update_allocator = TRUE;
- } else {
- allocator = NULL;
- gst_allocation_params_init (&params);
- update_allocator = FALSE;
- }
-
- glparams =
- gst_gl_video_allocation_params_new (qt_src->context, &params, &vinfo, 0,
- NULL, GST_GL_TEXTURE_TARGET_2D, GST_GL_RGBA);
- gst_buffer_pool_config_set_gl_allocation_params (config,
- (GstGLAllocationParams *) glparams);
- gst_gl_allocation_params_free ((GstGLAllocationParams *) glparams);
-
- if (!gst_buffer_pool_set_config (pool, config))
- GST_WARNING_OBJECT (qt_src, "Failed to set buffer pool config");
-
- if (update_allocator)
- gst_query_set_nth_allocation_param (query, 0, allocator, &params);
- else
- gst_query_add_allocation_param (query, allocator, &params);
- if (allocator)
- gst_object_unref (allocator);
-
- if (update_pool)
- gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
- else
- gst_query_add_allocation_pool (query, pool, size, min, max);
- gst_object_unref (pool);
-
- GST_INFO_OBJECT (qt_src, "successfully decide_allocation");
- return TRUE;
-}
-
-static GstFlowReturn
-gst_qt_src_fill (GstPushSrc * psrc, GstBuffer * buffer)
-{
- GstQtSrc *qt_src = GST_QT_SRC (psrc);
-
- GST_DEBUG_OBJECT (qt_src, "setting buffer %p", buffer);
-
- if (!qt_window_set_buffer (qt_src->window, buffer)) {
- GST_ERROR_OBJECT (qt_src, "failed to fill buffer %p", buffer);
- return GST_FLOW_ERROR;
- }
-
- if (!qt_src->downstream_supports_affine_meta) {
- if (qt_src->pending_image_orientation) {
- /* let downstream know the image orientation is vertical filp */
- GstTagList *image_orientation_tag =
- gst_tag_list_new (GST_TAG_IMAGE_ORIENTATION, "flip-rotate-180", NULL);
-
- gst_pad_push_event (GST_BASE_SRC_PAD (psrc),
- gst_event_new_tag (image_orientation_tag));
-
- qt_src->pending_image_orientation = FALSE;
- }
- } else {
- GstVideoAffineTransformationMeta *trans_meta;
- trans_meta = gst_buffer_add_video_affine_transformation_meta (buffer);
- gst_video_affine_transformation_meta_apply_matrix (trans_meta,
- vertical_flip_matrix);
- }
-
- GST_DEBUG_OBJECT (qt_src, "buffer fill done %p", buffer);
-
- return GST_FLOW_OK;
-}
-
-static GstStateChangeReturn
-gst_qt_src_change_state (GstElement * element, GstStateChange transition)
-{
- GstQtSrc *qt_src = GST_QT_SRC (element);
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
- QGuiApplication *app;
-
- GST_DEBUG ("changing state: %s => %s",
- gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
- gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- app = static_cast < QGuiApplication * >(QCoreApplication::instance ());
- if (!app) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
- ("%s", "Failed to connect to Qt"),
- ("%s", "Could not retrieve QGuiApplication instance"));
- return GST_STATE_CHANGE_FAILURE;
- }
-
- if (!qt_src->window) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
- ("%s", "Required property \'window\' not set"), (NULL));
- return GST_STATE_CHANGE_FAILURE;
- }
-
- if (!qt_window_is_scenegraph_initialized (qt_src->window)) {
- GST_ELEMENT_ERROR (element, RESOURCE, NOT_FOUND,
- ("%s", "Could not initialize window system"), (NULL));
- return GST_STATE_CHANGE_FAILURE;
- }
-
- qt_window_use_default_fbo (qt_src->window, qt_src->default_fbo);
-
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-static gboolean
-gst_qt_src_start (GstBaseSrc * basesrc)
-{
- GstQtSrc *qt_src = GST_QT_SRC (basesrc);
-
- /* already has get OpenGL configuration from qt */
- if (qt_src->display && qt_src->qt_context)
- return TRUE;
-
- if (!qt_window_is_scenegraph_initialized (qt_src->window))
- return FALSE;
-
- qt_src->display = qt_window_get_display (qt_src->window);
- qt_src->qt_context = qt_window_get_qt_context (qt_src->window);
-
- if (!qt_src->display || !qt_src->qt_context) {
- GST_ERROR_OBJECT (qt_src,
- "Could not retrieve window system OpenGL configuration");
- return FALSE;
- }
-
- GST_DEBUG_OBJECT (qt_src, "Got qt display %p and qt gl context %p",
- qt_src->display, qt_src->qt_context);
- return TRUE;
-}
-
-static gboolean
-gst_qt_src_stop (GstBaseSrc * basesrc)
-{
- return TRUE;
-}
diff --git a/ext/qt/gstqtsrc.h b/ext/qt/gstqtsrc.h
deleted file mode 100644
index d84544224..000000000
--- a/ext/qt/gstqtsrc.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *
- * 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.
- */
-
-#ifndef __GST_QT_SRC_H__
-#define __GST_QT_SRC_H__
-
-#include <gst/gst.h>
-#include <gst/base/gstpushsrc.h>
-#include <gst/video/video.h>
-#include <gst/gl/gl.h>
-#include "qtwindow.h"
-
-typedef struct _GstQtSrc GstQtSrc;
-typedef struct _GstQtSrcClass GstQtSrcClass;
-
-G_BEGIN_DECLS
-
-GType gst_qt_src_get_type (void);
-#define GST_TYPE_QT_SRC (gst_qt_src_get_type())
-#define GST_QT_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_QT_SRC,GstQtSrc))
-#define GST_QT_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_QT_SRC,GstQtSrcClass))
-#define GST_IS_QT_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_QT_SRC))
-#define GST_IS_QT_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_QT_SRC))
-#define GST_QT_SRC_CAST(obj) ((GstQtSrc*)(obj))
-
-/**
- * GstQtSrc:
- *
- * Opaque #GstQtSrc object
- */
-struct _GstQtSrc
-{
- /* <private> */
- GstPushSrc parent;
-
- QQuickWindow *qwindow;
- QtGLWindow *window;
-
- GstVideoInfo v_info;
-
- GstGLDisplay *display;
- GstGLContext *context;
- GstGLContext *qt_context;
-
- gboolean default_fbo;
- gboolean downstream_supports_affine_meta;
- gboolean pending_image_orientation;
-};
-
-/**
- * GstQtSrcClass:
- *
- * The #GstQtSrcClass struct only contains private data
- */
-struct _GstQtSrcClass
-{
- /* <private> */
- GstPushSrcClass object_class;
-};
-
-G_END_DECLS
-
-#endif /* __GST_QT_SRC_H__ */
diff --git a/ext/qt/qtitem.cc b/ext/qt/qtitem.cc
deleted file mode 100644
index 65b883eab..000000000
--- a/ext/qt/qtitem.cc
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include <gst/video/video.h>
-#include "qtitem.h"
-#include "gstqsgtexture.h"
-#include "gstqtglutility.h"
-
-#include <QtCore/QRunnable>
-#include <QtCore/QMutexLocker>
-#include <QtGui/QGuiApplication>
-#include <QtQuick/QQuickWindow>
-#include <QtQuick/QSGSimpleTextureNode>
-
-/**
- * SECTION:gtkgstglwidget
- * @short_description: a #GtkGLArea that renders GStreamer video #GstBuffers
- * @see_also: #GtkGLArea, #GstBuffer
- *
- * #QtGLVideoItem is an #QQuickItem that renders GStreamer video buffers.
- */
-
-#define GST_CAT_DEFAULT qt_item_debug
-GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
-
-#define DEFAULT_FORCE_ASPECT_RATIO TRUE
-#define DEFAULT_PAR_N 0
-#define DEFAULT_PAR_D 1
-
-enum
-{
- PROP_0,
- PROP_FORCE_ASPECT_RATIO,
- PROP_PIXEL_ASPECT_RATIO,
-};
-
-struct _QtGLVideoItemPrivate
-{
- GMutex lock;
-
- /* properties */
- gboolean force_aspect_ratio;
- gint par_n, par_d;
-
- gint display_width;
- gint display_height;
-
- gboolean negotiated;
- GstBuffer *buffer;
- GstCaps *caps;
- GstVideoInfo v_info;
-
- gboolean initted;
- GstGLDisplay *display;
- QOpenGLContext *qt_context;
- GstGLContext *other_context;
- GstGLContext *context;
-};
-
-class InitializeSceneGraph : public QRunnable
-{
-public:
- InitializeSceneGraph(QtGLVideoItem *item);
- void run();
-
-private:
- QtGLVideoItem *item_;
-};
-
-InitializeSceneGraph::InitializeSceneGraph(QtGLVideoItem *item) :
- item_(item)
-{
-}
-
-void InitializeSceneGraph::run()
-{
- item_->onSceneGraphInitialized();
-}
-
-QtGLVideoItem::QtGLVideoItem()
-{
- static volatile gsize _debug;
-
- if (g_once_init_enter (&_debug)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "qtglwidget", 0, "Qt GL Widget");
- g_once_init_leave (&_debug, 1);
- }
- this->m_openGlContextInitialized = false;
- this->setFlag (QQuickItem::ItemHasContents, true);
-
- this->priv = g_new0 (QtGLVideoItemPrivate, 1);
-
- this->priv->force_aspect_ratio = DEFAULT_FORCE_ASPECT_RATIO;
- this->priv->par_n = DEFAULT_PAR_N;
- this->priv->par_d = DEFAULT_PAR_D;
-
- g_mutex_init (&this->priv->lock);
-
- this->priv->display = gst_qt_get_gl_display();
-
- connect(this, SIGNAL(windowChanged(QQuickWindow*)), this,
- SLOT(handleWindowChanged(QQuickWindow*)));
-
- this->proxy = QSharedPointer<QtGLVideoItemInterface>(new QtGLVideoItemInterface(this));
-
- GST_DEBUG ("%p init Qt Video Item", this);
-}
-
-QtGLVideoItem::~QtGLVideoItem()
-{
- /* Before destroying the priv info, make sure
- * no qmlglsink's will call in again, and that
- * any ongoing calls are done by invalidating the proxy
- * pointer */
- GST_INFO ("Destroying QtGLVideoItem and invalidating the proxy");
- proxy->invalidateRef();
- proxy.clear();
-
- g_mutex_clear (&this->priv->lock);
- if (this->priv->context)
- gst_object_unref(this->priv->context);
- if (this->priv->other_context)
- gst_object_unref(this->priv->other_context);
- if (this->priv->display)
- gst_object_unref(this->priv->display);
- g_free (this->priv);
- this->priv = NULL;
-}
-
-void
-QtGLVideoItem::setDAR(gint num, gint den)
-{
- this->priv->par_n = num;
- this->priv->par_d = den;
-}
-
-void
-QtGLVideoItem::getDAR(gint * num, gint * den)
-{
- if (num)
- *num = this->priv->par_n;
- if (den)
- *den = this->priv->par_d;
-}
-
-void
-QtGLVideoItem::setForceAspectRatio(bool force_aspect_ratio)
-{
- this->priv->force_aspect_ratio = !!force_aspect_ratio;
-}
-
-bool
-QtGLVideoItem::getForceAspectRatio()
-{
- return this->priv->force_aspect_ratio;
-}
-
-bool
-QtGLVideoItem::itemInitialized()
-{
- return m_openGlContextInitialized;
-}
-
-QSGNode *
-QtGLVideoItem::updatePaintNode(QSGNode * oldNode,
- UpdatePaintNodeData * updatePaintNodeData)
-{
- if (!m_openGlContextInitialized) {
- return oldNode;
- }
-
- QSGSimpleTextureNode *texNode = static_cast<QSGSimpleTextureNode *> (oldNode);
- GstVideoRectangle src, dst, result;
- GstQSGTexture *tex;
-
- g_mutex_lock (&this->priv->lock);
- gst_gl_context_activate (this->priv->other_context, TRUE);
-
- GST_TRACE ("%p updatePaintNode", this);
-
- if (!this->priv->caps) {
- g_mutex_unlock (&this->priv->lock);
- return NULL;
- }
-
- if (!texNode) {
- texNode = new QSGSimpleTextureNode ();
- texNode->setOwnsTexture (true);
- texNode->setTexture (new GstQSGTexture ());
- }
-
- tex = static_cast<GstQSGTexture *> (texNode->texture());
- tex->setCaps (this->priv->caps);
- tex->setBuffer (this->priv->buffer);
- texNode->markDirty(QSGNode::DirtyMaterial);
-
- if (this->priv->force_aspect_ratio) {
- src.w = this->priv->display_width;
- src.h = this->priv->display_height;
-
- dst.x = boundingRect().x();
- dst.y = boundingRect().y();
- dst.w = boundingRect().width();
- dst.h = boundingRect().height();
-
- gst_video_sink_center_rect (src, dst, &result, TRUE);
- } else {
- result.x = boundingRect().x();
- result.y = boundingRect().y();
- result.w = boundingRect().width();
- result.h = boundingRect().height();
- }
-
- texNode->setRect (QRectF (result.x, result.y, result.w, result.h));
-
- gst_gl_context_activate (this->priv->other_context, FALSE);
- g_mutex_unlock (&this->priv->lock);
-
- return texNode;
-}
-
-static void
-_reset (QtGLVideoItem * qt_item)
-{
- gst_buffer_replace (&qt_item->priv->buffer, NULL);
-
- gst_caps_replace (&qt_item->priv->caps, NULL);
-
- qt_item->priv->negotiated = FALSE;
- qt_item->priv->initted = FALSE;
-}
-
-void
-QtGLVideoItemInterface::setBuffer (GstBuffer * buffer)
-{
- QMutexLocker locker(&lock);
-
- if (qt_item == NULL)
- return;
-
- if (!qt_item->priv->negotiated) {
- GST_WARNING ("Got buffer on unnegotiated QtGLVideoItem. Dropping");
- return;
- }
-
- g_mutex_lock (&qt_item->priv->lock);
-
- gst_buffer_replace (&qt_item->priv->buffer, buffer);
-
- QMetaObject::invokeMethod(qt_item, "update", Qt::QueuedConnection);
-
- g_mutex_unlock (&qt_item->priv->lock);
-}
-
-void
-QtGLVideoItem::onSceneGraphInitialized ()
-{
- GST_DEBUG ("scene graph initialization with Qt GL context %p",
- this->window()->openglContext ());
-
- if (this->priv->qt_context == this->window()->openglContext ())
- return;
-
- this->priv->qt_context = this->window()->openglContext ();
- if (this->priv->qt_context == NULL) {
- g_assert_not_reached ();
- return;
- }
-
- m_openGlContextInitialized = gst_qt_get_gl_wrapcontext (this->priv->display,
- &this->priv->other_context, &this->priv->context);
-
- GST_DEBUG ("%p created wrapped GL context %" GST_PTR_FORMAT, this,
- this->priv->other_context);
-
- emit itemInitializedChanged();
-}
-
-void
-QtGLVideoItem::onSceneGraphInvalidated ()
-{
- GST_FIXME ("%p scene graph invalidated", this);
-}
-
-gboolean
-QtGLVideoItemInterface::initWinSys ()
-{
- QMutexLocker locker(&lock);
-
- GError *error = NULL;
-
- if (qt_item == NULL)
- return FALSE;
-
- g_mutex_lock (&qt_item->priv->lock);
-
- if (qt_item->priv->display && qt_item->priv->qt_context
- && qt_item->priv->other_context && qt_item->priv->context) {
- /* already have the necessary state */
- g_mutex_unlock (&qt_item->priv->lock);
- return TRUE;
- }
-
- if (!GST_IS_GL_DISPLAY (qt_item->priv->display)) {
- GST_ERROR ("%p failed to retrieve display connection %" GST_PTR_FORMAT,
- qt_item, qt_item->priv->display);
- g_mutex_unlock (&qt_item->priv->lock);
- return FALSE;
- }
-
- if (!GST_IS_GL_CONTEXT (qt_item->priv->other_context)) {
- GST_ERROR ("%p failed to retrieve wrapped context %" GST_PTR_FORMAT, qt_item,
- qt_item->priv->other_context);
- g_mutex_unlock (&qt_item->priv->lock);
- return FALSE;
- }
-
- qt_item->priv->context = gst_gl_context_new (qt_item->priv->display);
-
- if (!qt_item->priv->context) {
- g_mutex_unlock (&qt_item->priv->lock);
- return FALSE;
- }
-
- if (!gst_gl_context_create (qt_item->priv->context, qt_item->priv->other_context,
- &error)) {
- GST_ERROR ("%s", error->message);
- g_mutex_unlock (&qt_item->priv->lock);
- return FALSE;
- }
-
- g_mutex_unlock (&qt_item->priv->lock);
- return TRUE;
-}
-
-void
-QtGLVideoItem::handleWindowChanged(QQuickWindow *win)
-{
- if (win) {
- if (win->isSceneGraphInitialized())
- win->scheduleRenderJob(new InitializeSceneGraph(this), QQuickWindow::BeforeSynchronizingStage);
- else
- connect(win, SIGNAL(sceneGraphInitialized()), this, SLOT(onSceneGraphInitialized()), Qt::DirectConnection);
-
- connect(win, SIGNAL(sceneGraphInvalidated()), this, SLOT(onSceneGraphInvalidated()), Qt::DirectConnection);
- } else {
- this->priv->qt_context = NULL;
- }
-}
-
-static gboolean
-_calculate_par (QtGLVideoItem * widget, GstVideoInfo * info)
-{
- gboolean ok;
- gint width, height;
- gint par_n, par_d;
- gint display_par_n, display_par_d;
- guint display_ratio_num, display_ratio_den;
-
- width = GST_VIDEO_INFO_WIDTH (info);
- height = GST_VIDEO_INFO_HEIGHT (info);
-
- par_n = GST_VIDEO_INFO_PAR_N (info);
- par_d = GST_VIDEO_INFO_PAR_D (info);
-
- if (!par_n)
- par_n = 1;
-
- /* get display's PAR */
- if (widget->priv->par_n != 0 && widget->priv->par_d != 0) {
- display_par_n = widget->priv->par_n;
- display_par_d = widget->priv->par_d;
- } else {
- display_par_n = 1;
- display_par_d = 1;
- }
-
- ok = gst_video_calculate_display_ratio (&display_ratio_num,
- &display_ratio_den, width, height, par_n, par_d, display_par_n,
- display_par_d);
-
- if (!ok)
- return FALSE;
-
- GST_LOG ("PAR: %u/%u DAR:%u/%u", par_n, par_d, display_par_n, display_par_d);
-
- if (height % display_ratio_den == 0) {
- GST_DEBUG ("keeping video height");
- widget->priv->display_width = (guint)
- gst_util_uint64_scale_int (height, display_ratio_num,
- display_ratio_den);
- widget->priv->display_height = height;
- } else if (width % display_ratio_num == 0) {
- GST_DEBUG ("keeping video width");
- widget->priv->display_width = width;
- widget->priv->display_height = (guint)
- gst_util_uint64_scale_int (width, display_ratio_den, display_ratio_num);
- } else {
- GST_DEBUG ("approximating while keeping video height");
- widget->priv->display_width = (guint)
- gst_util_uint64_scale_int (height, display_ratio_num,
- display_ratio_den);
- widget->priv->display_height = height;
- }
- GST_DEBUG ("scaling to %dx%d", widget->priv->display_width,
- widget->priv->display_height);
-
- return TRUE;
-}
-
-gboolean
-QtGLVideoItemInterface::setCaps (GstCaps * caps)
-{
- QMutexLocker locker(&lock);
- GstVideoInfo v_info;
-
- g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
- g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
-
- if (qt_item == NULL)
- return FALSE;
-
- if (qt_item->priv->caps && gst_caps_is_equal_fixed (qt_item->priv->caps, caps))
- return TRUE;
-
- if (!gst_video_info_from_caps (&v_info, caps))
- return FALSE;
-
- g_mutex_lock (&qt_item->priv->lock);
-
- _reset (qt_item);
-
- gst_caps_replace (&qt_item->priv->caps, caps);
-
- if (!_calculate_par (qt_item, &v_info)) {
- g_mutex_unlock (&qt_item->priv->lock);
- return FALSE;
- }
-
- qt_item->priv->v_info = v_info;
- qt_item->priv->negotiated = TRUE;
-
- g_mutex_unlock (&qt_item->priv->lock);
-
- return TRUE;
-}
-
-GstGLContext *
-QtGLVideoItemInterface::getQtContext ()
-{
- QMutexLocker locker(&lock);
-
- if (!qt_item || !qt_item->priv->other_context)
- return NULL;
-
- return (GstGLContext *) gst_object_ref (qt_item->priv->other_context);
-}
-
-GstGLContext *
-QtGLVideoItemInterface::getContext ()
-{
- QMutexLocker locker(&lock);
-
- if (!qt_item || !qt_item->priv->context)
- return NULL;
-
- return (GstGLContext *) gst_object_ref (qt_item->priv->context);
-}
-
-GstGLDisplay *
-QtGLVideoItemInterface::getDisplay()
-{
- QMutexLocker locker(&lock);
-
- if (!qt_item || !qt_item->priv->display)
- return NULL;
-
- return (GstGLDisplay *) gst_object_ref (qt_item->priv->display);
-}
-
-void
-QtGLVideoItemInterface::setDAR(gint num, gint den)
-{
- QMutexLocker locker(&lock);
- if (!qt_item)
- return;
- qt_item->setDAR(num, den);
-}
-
-void
-QtGLVideoItemInterface::getDAR(gint * num, gint * den)
-{
- QMutexLocker locker(&lock);
- if (!qt_item)
- return;
- qt_item->getDAR (num, den);
-}
-
-void
-QtGLVideoItemInterface::setForceAspectRatio(bool force_aspect_ratio)
-{
- QMutexLocker locker(&lock);
- if (!qt_item)
- return;
- qt_item->setForceAspectRatio(force_aspect_ratio);
-}
-
-bool
-QtGLVideoItemInterface::getForceAspectRatio()
-{
- QMutexLocker locker(&lock);
- if (!qt_item)
- return FALSE;
- return qt_item->getForceAspectRatio();
-}
-
-void
-QtGLVideoItemInterface::invalidateRef()
-{
- QMutexLocker locker(&lock);
- qt_item = NULL;
-}
-
diff --git a/ext/qt/qtitem.h b/ext/qt/qtitem.h
deleted file mode 100644
index 065d043ea..000000000
--- a/ext/qt/qtitem.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2015 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.
- */
-
-#ifndef __QT_ITEM_H__
-#define __QT_ITEM_H__
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-
-#include "gstqtgl.h"
-#include <QtCore/QMutex>
-#include <QtQuick/QQuickItem>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-
-typedef struct _QtGLVideoItemPrivate QtGLVideoItemPrivate;
-
-class QtGLVideoItem;
-
-class QtGLVideoItemInterface : public QObject
-{
- Q_OBJECT
-public:
- QtGLVideoItemInterface (QtGLVideoItem *w) : qt_item (w), lock() {};
-
- void invalidateRef();
-
- void setBuffer (GstBuffer * buffer);
- gboolean setCaps (GstCaps *caps);
- gboolean initWinSys ();
- GstGLContext *getQtContext();
- GstGLContext *getContext();
- GstGLDisplay *getDisplay();
- QtGLVideoItem *videoItem () { return qt_item; };
-
- void setDAR(gint, gint);
- void getDAR(gint *, gint *);
- void setForceAspectRatio(bool);
- bool getForceAspectRatio();
-private:
- QtGLVideoItem *qt_item;
- QMutex lock;
-};
-
-class InitializeSceneGraph;
-
-class QtGLVideoItem : public QQuickItem, protected QOpenGLFunctions
-{
- Q_OBJECT
-
- Q_PROPERTY(bool itemInitialized
- READ itemInitialized
- NOTIFY itemInitializedChanged)
-
-public:
- QtGLVideoItem();
- ~QtGLVideoItem();
-
- void setDAR(gint, gint);
- void getDAR(gint *, gint *);
- void setForceAspectRatio(bool);
- bool getForceAspectRatio();
- bool itemInitialized();
-
- QSharedPointer<QtGLVideoItemInterface> getInterface() { return proxy; };
- /* private for C interface ... */
- QtGLVideoItemPrivate *priv;
-
-Q_SIGNALS:
- void itemInitializedChanged();
-
-private Q_SLOTS:
- void handleWindowChanged(QQuickWindow * win);
- void onSceneGraphInitialized();
- void onSceneGraphInvalidated();
-
-protected:
- QSGNode * updatePaintNode (QSGNode * oldNode, UpdatePaintNodeData * updatePaintNodeData);
-
-private:
-
- friend class InitializeSceneGraph;
- void setViewportSize(const QSize &size);
- void shareContext();
-
- QSize m_viewportSize;
- bool m_openGlContextInitialized;
-
- QSharedPointer<QtGLVideoItemInterface> proxy;
-};
-
-#endif /* __QT_ITEM_H__ */
diff --git a/ext/qt/qtplugin.pro b/ext/qt/qtplugin.pro
deleted file mode 100644
index 2337087a3..000000000
--- a/ext/qt/qtplugin.pro
+++ /dev/null
@@ -1,40 +0,0 @@
-TEMPLATE = lib
-
-TARGET = gstqmlgl
-
-QT += qml quick widgets gui
-
-QT_CONFIG -= no-pkg-config
-CONFIG += link_pkgconfig debug plugin
-PKGCONFIG = \
- gstreamer-1.0 \
- gstreamer-video-1.0 \
- gstreamer-gl-1.0
-
-DEFINES += \
- GST_USE_UNSTABLE_API \
- HAVE_QT_WIN32
-
-SOURCES += \
- gstplugin.cc \
- gstqtglutility.cc \
- gstqsgtexture.cc \
- gstqtsink.cc \
- gstqtsrc.cc \
- qtwindow.cc \
- qtitem.cc
-
-HEADERS += \
- gstqsgtexture.h \
- gstqtgl.h \
- gstqtglutility.h \
- gstqtsink.h \
- gstqtsrc.h \
- qtwindow.h \
- qtitem.h
-
-INCLUDEPATH += \
- $$(GSTREAMER_ROOT)/include \
- $$[QT_INSTALL_PREFIX]/include/QtGui/$$[QT_VERSION]/QtGui/
-
-
diff --git a/ext/qt/qtwindow.cc b/ext/qt/qtwindow.cc
deleted file mode 100644
index 62d26b647..000000000
--- a/ext/qt/qtwindow.cc
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdio.h>
-
-#include <gst/video/video.h>
-#include <gst/gl/gstglfuncs.h>
-#include "qtwindow.h"
-#include "gstqsgtexture.h"
-#include "gstqtglutility.h"
-
-#include <QtCore/QDateTime>
-#include <QtCore/QRunnable>
-#include <QtGui/QGuiApplication>
-#include <QtQuick/QQuickWindow>
-#include <QOpenGLFramebufferObject>
-
-/* compatability definitions... */
-#ifndef GL_READ_FRAMEBUFFER
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#endif
-#ifndef GL_DRAW_FRAMEBUFFER
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#endif
-
-/**
- * SECTION:
- *
- * #QtGLWindow is an #QQuickWindow that grab QtQuick view to GStreamer OpenGL video buffers.
- */
-
-GST_DEBUG_CATEGORY_STATIC (qt_window_debug);
-#define GST_CAT_DEFAULT qt_window_debug
-
-struct _QtGLWindowPrivate
-{
- GMutex lock;
- GCond update_cond;
-
- GstBuffer *buffer;
- GstCaps *caps;
- GstVideoInfo v_info;
-
- gboolean initted;
- gboolean updated;
- gboolean quit;
- gboolean result;
- gboolean useDefaultFbo;
-
- GstGLDisplay *display;
- GstGLContext *other_context;
-
- GLuint fbo;
-
- /* frames that qmlview rendered in its gl thread */
- quint64 frames_rendered;
- quint64 start;
- quint64 stop;
-};
-
-class InitQtGLContext : public QRunnable
-{
-public:
- InitQtGLContext(QtGLWindow *window);
- void run();
-
-private:
- QtGLWindow *window_;
-};
-
-InitQtGLContext::InitQtGLContext(QtGLWindow *window) :
- window_(window)
-{
-}
-
-void InitQtGLContext::run()
-{
- window_->onSceneGraphInitialized();
-}
-
-QtGLWindow::QtGLWindow ( QWindow * parent, QQuickWindow *src ) :
- QQuickWindow( parent ), source (src)
-{
- QGuiApplication *app = static_cast<QGuiApplication *> (QCoreApplication::instance ());
- static volatile gsize _debug;
-
- g_assert (app != NULL);
-
- if (g_once_init_enter (&_debug)) {
- GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "qtglwindow", 0, "Qt GL QuickWindow");
- g_once_init_leave (&_debug, 1);
- }
-
- this->priv = g_new0 (QtGLWindowPrivate, 1);
-
- g_mutex_init (&this->priv->lock);
- g_cond_init (&this->priv->update_cond);
-
- this->priv->display = gst_qt_get_gl_display();
-
- connect (source, SIGNAL(beforeRendering()), this, SLOT(beforeRendering()), Qt::DirectConnection);
- connect (source, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection);
- connect (app, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit()), Qt::DirectConnection);
- if (source->isSceneGraphInitialized())
- source->scheduleRenderJob(new InitQtGLContext(this), QQuickWindow::BeforeSynchronizingStage);
- else
- connect (source, SIGNAL(sceneGraphInitialized()), this, SLOT(onSceneGraphInitialized()), Qt::DirectConnection);
-
- connect (source, SIGNAL(sceneGraphInvalidated()), this, SLOT(onSceneGraphInvalidated()), Qt::DirectConnection);
-
- GST_DEBUG ("%p init Qt Window", this->priv->display);
-}
-
-QtGLWindow::~QtGLWindow()
-{
- GST_DEBUG ("deinit Qt Window");
- g_mutex_clear (&this->priv->lock);
- g_cond_clear (&this->priv->update_cond);
- if (this->priv->other_context)
- gst_object_unref(this->priv->other_context);
- if (this->priv->display)
- gst_object_unref(this->priv->display);
- g_free (this->priv);
- this->priv = NULL;
-}
-
-void
-QtGLWindow::beforeRendering()
-{
- unsigned int width, height;
-
- g_mutex_lock (&this->priv->lock);
-
- static volatile gsize once = 0;
- if (g_once_init_enter(&once)) {
- this->priv->start = QDateTime::currentDateTime().toMSecsSinceEpoch();
- g_once_init_leave(&once,1);
- }
-
- if (!fbo && !this->priv->useDefaultFbo) {
-
- width = source->width();
- height = source->height();
-
- GST_DEBUG ("create new framebuffer object %dX%d", width, height);
-
- fbo.reset(new QOpenGLFramebufferObject (width, height,
- QOpenGLFramebufferObject::NoAttachment, GL_TEXTURE_2D, GL_RGBA));
-
- source->setRenderTarget(fbo.data());
- } else if (this->priv->useDefaultFbo) {
- GST_DEBUG ("use default fbo for render target");
- fbo.reset(NULL);
- source->setRenderTarget(NULL);
- }
-
- g_mutex_unlock (&this->priv->lock);
-}
-
-
-void
-QtGLWindow::afterRendering()
-{
- GstVideoFrame gl_frame;
- GstVideoInfo *info;
- GstGLContext *context;
- gboolean ret;
- guint width, height;
- const GstGLFuncs *gl;
- GLuint dst_tex;
-
- g_mutex_lock (&this->priv->lock);
-
- this->priv->frames_rendered++;
-
- if(!this->priv->buffer || this->priv->updated == TRUE) {
- GST_DEBUG ("skip this frame");
- g_mutex_unlock (&this->priv->lock);
- return;
- }
-
- GST_DEBUG ("copy buffer %p",this->priv->buffer);
-
- width = GST_VIDEO_INFO_WIDTH (&this->priv->v_info);
- height = GST_VIDEO_INFO_HEIGHT (&this->priv->v_info);
- info = &this->priv->v_info;
- context = this->priv->other_context;
-
- gst_gl_context_activate (context, TRUE);
- gl = context->gl_vtable;
-
- ret = gst_video_frame_map (&gl_frame, info, this->priv->buffer,
- (GstMapFlags) (GST_MAP_WRITE | GST_MAP_GL));
-
- if (!ret) {
- this->priv->buffer = NULL;
- GST_ERROR ("Failed to map video frame");
- goto errors;
- }
-
- gl->BindFramebuffer (GL_READ_FRAMEBUFFER, this->source->renderTargetId());
-
- ret = gst_gl_context_check_framebuffer_status (context, GL_READ_FRAMEBUFFER);
- if (!ret) {
- GST_ERROR ("FBO errors");
- goto errors;
- }
-
- dst_tex = *(guint *) gl_frame.data[0];
- GST_DEBUG ("qml render target id %d, render to tex %d %dX%d",
- this->source->renderTargetId(), dst_tex, width,height);
-
- gl->BindTexture (GL_TEXTURE_2D, dst_tex);
- if (gl->BlitFramebuffer) {
- gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, this->priv->fbo);
- gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D, dst_tex, 0);
-
- ret = gst_gl_context_check_framebuffer_status (context, GL_DRAW_FRAMEBUFFER);
- if (!ret) {
- GST_ERROR ("FBO errors");
- goto errors;
- }
- gl->ReadBuffer (GL_COLOR_ATTACHMENT0);
- gl->BlitFramebuffer (0, 0, width, height,
- 0, 0, width, height,
- GL_COLOR_BUFFER_BIT, GL_LINEAR);
- } else {
- gl->CopyTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, width, height, 0);
- }
-
- GST_DEBUG ("rendering finished");
-
-errors:
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
- gst_video_frame_unmap (&gl_frame);
-
- gst_gl_context_activate (context, FALSE);
-
- this->priv->result = ret;
- this->priv->updated = TRUE;
- g_cond_signal (&this->priv->update_cond);
- g_mutex_unlock (&this->priv->lock);
-}
-
-void
-QtGLWindow::aboutToQuit()
-{
- g_mutex_lock (&this->priv->lock);
-
- this->priv->updated = TRUE;
- this->priv->quit = TRUE;
- g_cond_signal (&this->priv->update_cond);
-
- this->priv->stop = QDateTime::currentDateTime().toMSecsSinceEpoch();
- qint64 duration = this->priv->stop - this->priv->start;
- float fps = ((float)this->priv->frames_rendered / duration * 1000);
-
- GST_DEBUG("about to quit, total refresh frames (%lld) in (%0.3f) seconds, fps: %0.3f",
- this->priv->frames_rendered, (float)duration / 1000, fps);
-
- g_mutex_unlock (&this->priv->lock);
-}
-
-void
-QtGLWindow::onSceneGraphInitialized()
-{
- GST_DEBUG ("scene graph initialization with Qt GL context %p",
- this->source->openglContext ());
-
- this->priv->initted = gst_qt_get_gl_wrapcontext (this->priv->display,
- &this->priv->other_context, NULL);
-
- if (this->priv->initted && this->priv->other_context) {
- const GstGLFuncs *gl;
-
- gst_gl_context_activate (this->priv->other_context, TRUE);
- gl = this->priv->other_context->gl_vtable;
-
- gl->GenFramebuffers (1, &this->priv->fbo);
-
- gst_gl_context_activate (this->priv->other_context, FALSE);
- }
-
- GST_DEBUG ("%p created wrapped GL context %" GST_PTR_FORMAT, this,
- this->priv->other_context);
-}
-
-void
-QtGLWindow::onSceneGraphInvalidated()
-{
- GST_DEBUG ("scene graph invalidated");
-
- if (this->priv->fbo && this->priv->other_context) {
- const GstGLFuncs *gl;
-
- gst_gl_context_activate (this->priv->other_context, TRUE);
- gl = this->priv->other_context->gl_vtable;
-
- gl->DeleteFramebuffers (1, &this->priv->fbo);
-
- gst_gl_context_activate (this->priv->other_context, FALSE);
- }
-}
-
-bool
-QtGLWindow::getGeometry(int * width, int * height)
-{
- if (width == NULL || height == NULL)
- return FALSE;
-
- *width = this->source->width();
- *height = this->source->height();
-
- return TRUE;
-}
-
-GstGLContext *
-qt_window_get_qt_context (QtGLWindow * qt_window)
-{
- g_return_val_if_fail (qt_window != NULL, NULL);
-
- if (!qt_window->priv->other_context)
- return NULL;
-
- return (GstGLContext *) gst_object_ref (qt_window->priv->other_context);
-}
-
-GstGLDisplay *
-qt_window_get_display (QtGLWindow * qt_window)
-{
- g_return_val_if_fail (qt_window != NULL, NULL);
-
- if (!qt_window->priv->display)
- return NULL;
-
- return (GstGLDisplay *) gst_object_ref (qt_window->priv->display);
-}
-
-gboolean
-qt_window_is_scenegraph_initialized (QtGLWindow * qt_window)
-{
- g_return_val_if_fail (qt_window != NULL, FALSE);
-
- return qt_window->priv->initted;
-}
-
-gboolean
-qt_window_set_caps (QtGLWindow * qt_window, GstCaps * caps)
-{
- GstVideoInfo v_info;
-
- g_return_val_if_fail (qt_window != NULL, FALSE);
- g_return_val_if_fail (GST_IS_CAPS (caps), FALSE);
- g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE);
-
- if (qt_window->priv->caps && gst_caps_is_equal_fixed (qt_window->priv->caps, caps))
- return TRUE;
-
- if (!gst_video_info_from_caps (&v_info, caps))
- return FALSE;
-
- g_mutex_lock (&qt_window->priv->lock);
-
- gst_caps_replace (&qt_window->priv->caps, caps);
-
- qt_window->priv->v_info = v_info;
-
- g_mutex_unlock (&qt_window->priv->lock);
-
- return TRUE;
-}
-
-gboolean
-qt_window_set_buffer (QtGLWindow * qt_window, GstBuffer * buffer)
-{
- g_return_val_if_fail (qt_window != NULL, FALSE);
- g_return_val_if_fail (qt_window->priv->initted, FALSE);
- gboolean ret;
-
- g_mutex_lock (&qt_window->priv->lock);
-
- if (qt_window->priv->quit){
- GST_DEBUG("about to quit, drop this buffer");
- g_mutex_unlock (&qt_window->priv->lock);
- return TRUE;
- }
-
- qt_window->priv->updated = FALSE;
- qt_window->priv->buffer = buffer;
-
- while (!qt_window->priv->updated)
- g_cond_wait (&qt_window->priv->update_cond, &qt_window->priv->lock);
-
- ret = qt_window->priv->result;
-
- g_mutex_unlock (&qt_window->priv->lock);
-
- return ret;
-}
-
-void
-qt_window_use_default_fbo (QtGLWindow * qt_window, gboolean useDefaultFbo)
-{
- g_return_if_fail (qt_window != NULL);
-
- g_mutex_lock (&qt_window->priv->lock);
-
- GST_DEBUG ("set to use default fbo %d", useDefaultFbo);
- qt_window->priv->useDefaultFbo = useDefaultFbo;
-
- g_mutex_unlock (&qt_window->priv->lock);
-}
diff --git a/ext/qt/qtwindow.h b/ext/qt/qtwindow.h
deleted file mode 100644
index 697f3897a..000000000
--- a/ext/qt/qtwindow.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * GStreamer
- * Copyright (C) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *
- * 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.
- */
-
-#ifndef __QT_WINDOW_H__
-#define __QT_WINDOW_H__
-
-#include <gst/gst.h>
-#include <gst/gl/gl.h>
-
-#include "gstqtgl.h"
-#include <QtQuick/QQuickWindow>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-
-typedef struct _QtGLWindowPrivate QtGLWindowPrivate;
-
-class InitQtGLContext;
-
-class QtGLWindow : public QQuickWindow, protected QOpenGLFunctions
-{
- Q_OBJECT
-public:
- QtGLWindow (QWindow * parent = NULL, QQuickWindow *source = NULL);
- ~QtGLWindow ();
- bool getGeometry (int * width, int * height);
-
- /* private for C interface ... */
- QtGLWindowPrivate *priv;
-
-private Q_SLOTS:
- void beforeRendering ();
- void afterRendering ();
- void onSceneGraphInitialized ();
- void onSceneGraphInvalidated ();
- void aboutToQuit();
-
-private:
- friend class InitQtGLContext;
- QQuickWindow * source;
- QScopedPointer<QOpenGLFramebufferObject> fbo;
-};
-
-extern "C"
-{
-gboolean qt_window_set_buffer (QtGLWindow * qt_window, GstBuffer * buffer);
-gboolean qt_window_set_caps (QtGLWindow * qt_window, GstCaps * caps);
-GstGLContext * qt_window_get_qt_context (QtGLWindow * qt_window);
-GstGLDisplay * qt_window_get_display (QtGLWindow * qt_window);
-gboolean qt_window_is_scenegraph_initialized (QtGLWindow * qt_window);
-void qt_window_use_default_fbo (QtGLWindow * qt_window, gboolean useDefaultFbo);
-}
-
-#endif /* __QT_WINDOW_H__ */
diff --git a/tests/examples/meson.build b/tests/examples/meson.build
index 5ccd9ebb1..356587f69 100644
--- a/tests/examples/meson.build
+++ b/tests/examples/meson.build
@@ -9,7 +9,6 @@ subdir('compositor')
subdir('mpegts')
#subdir('mxf')
#subdir('opencv')
-#subdir('qt')
#subdir('uvch264')
#subdir('waylandsink')
subdir('webrtc')
diff --git a/tests/examples/qt/qmlsink/.gitignore b/tests/examples/qt/qmlsink/.gitignore
deleted file mode 100644
index 1f8151858..000000000
--- a/tests/examples/qt/qmlsink/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-deployment.pri
-play
-qrc_qml.cpp
diff --git a/tests/examples/qt/qmlsink/CMakeLists.txt b/tests/examples/qt/qmlsink/CMakeLists.txt
deleted file mode 100644
index 02b0e11ea..000000000
--- a/tests/examples/qt/qmlsink/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-cmake_minimum_required(VERSION 3.3)
-
-include(FindPkgConfig)
-if(!${PKG_CONFIG_FOUND})
- MESSAGE(FATAL_ERROR "pkg-config required. Please install it")
- return ("Error - pkg-config not found")
-endif()
-
-pkg_check_modules(GSTREAMER gstreamer-1.0>=1.6 gstreamer-video-1.0>=1.6 REQUIRED)
-
-find_package(Qt5Core REQUIRED)
-find_package(Qt5Widgets REQUIRED)
-find_package(Qt5Qml REQUIRED)
-find_package(Qt5Quick REQUIRED)
-
-set (SRC_LIST main.cpp)
-qt5_add_resources(RESOURCES qml.qrc)
-link_directories(${GSTREAMER_LIBRARY_DIRS})
-include_directories (${GSTREAMER_INCLUDE_DIRS})
-add_executable(qml-example ${SRC_LIST} ${RESOURCES})
-target_link_libraries (qml-example ${GSTREAMER_LIBRARIES})
-qt5_use_modules(qml-example Core Widgets Qml Quick)
-
diff --git a/tests/examples/qt/qmlsink/main.cpp b/tests/examples/qt/qmlsink/main.cpp
deleted file mode 100644
index a5cd5606b..000000000
--- a/tests/examples/qt/qmlsink/main.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include <QApplication>
-#include <QQmlApplicationEngine>
-#include <QQuickWindow>
-#include <QQuickItem>
-#include <QRunnable>
-#include <gst/gst.h>
-
-class SetPlaying : public QRunnable
-{
-public:
- SetPlaying(GstElement *);
- ~SetPlaying();
-
- void run ();
-
-private:
- GstElement * pipeline_;
-};
-
-SetPlaying::SetPlaying (GstElement * pipeline)
-{
- this->pipeline_ = pipeline ? static_cast<GstElement *> (gst_object_ref (pipeline)) : NULL;
-}
-
-SetPlaying::~SetPlaying ()
-{
- if (this->pipeline_)
- gst_object_unref (this->pipeline_);
-}
-
-void
-SetPlaying::run ()
-{
- if (this->pipeline_)
- gst_element_set_state (this->pipeline_, GST_STATE_PLAYING);
-}
-
-int main(int argc, char *argv[])
-{
- int ret;
-
- gst_init (&argc, &argv);
-
- {
- QGuiApplication app(argc, argv);
-
- GstElement *pipeline = gst_pipeline_new (NULL);
- GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
- GstElement *glupload = gst_element_factory_make ("glupload", NULL);
- /* the plugin must be loaded before loading the qml file to register the
- * GstGLVideoItem qml item */
- GstElement *sink = gst_element_factory_make ("qmlglsink", NULL);
-
- g_assert (src && glupload && sink);
-
- gst_bin_add_many (GST_BIN (pipeline), src, glupload, sink, NULL);
- gst_element_link_many (src, glupload, sink, NULL);
-
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
-
- QQuickItem *videoItem;
- QQuickWindow *rootObject;
-
- /* find and set the videoItem on the sink */
- rootObject = static_cast<QQuickWindow *> (engine.rootObjects().first());
- videoItem = rootObject->findChild<QQuickItem *> ("videoItem");
- g_assert (videoItem);
- g_object_set(sink, "widget", videoItem, NULL);
-
- rootObject->scheduleRenderJob (new SetPlaying (pipeline),
- QQuickWindow::BeforeSynchronizingStage);
-
- ret = app.exec();
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
- }
-
- gst_deinit ();
-
- return ret;
-}
diff --git a/tests/examples/qt/qmlsink/main.qml b/tests/examples/qt/qmlsink/main.qml
deleted file mode 100644
index ffd3cd165..000000000
--- a/tests/examples/qt/qmlsink/main.qml
+++ /dev/null
@@ -1,60 +0,0 @@
-import QtQuick 2.4
-import QtQuick.Controls 1.1
-import QtQuick.Controls.Styles 1.3
-import QtQuick.Dialogs 1.2
-import QtQuick.Window 2.1
-
-import org.freedesktop.gstreamer.GLVideoItem 1.0
-
-ApplicationWindow {
- id: window
- visible: true
- width: 640
- height: 480
- x: 30
- y: 30
- color: "black"
-
- Item {
- anchors.fill: parent
-
- GstGLVideoItem {
- id: video
- objectName: "videoItem"
- anchors.centerIn: parent
- width: parent.width
- height: parent.height
- }
-
- Rectangle {
- color: Qt.rgba(1, 1, 1, 0.7)
- border.width: 1
- border.color: "white"
- anchors.bottom: video.bottom
- anchors.bottomMargin: 15
- anchors.horizontalCenter: parent.horizontalCenter
- width : parent.width - 30
- height: parent.height - 30
- radius: 8
-
- MouseArea {
- id: mousearea
- anchors.fill: parent
- hoverEnabled: true
- onEntered: {
- parent.opacity = 1.0
- hidetimer.start()
- }
- }
-
- Timer {
- id: hidetimer
- interval: 5000
- onTriggered: {
- parent.opacity = 0.0
- stop()
- }
- }
- }
- }
-}
diff --git a/tests/examples/qt/qmlsink/play.pro b/tests/examples/qt/qmlsink/play.pro
deleted file mode 100644
index 374e40297..000000000
--- a/tests/examples/qt/qmlsink/play.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick widgets
-
-QT_CONFIG -= no-pkg-config
-CONFIG += link_pkgconfig debug
-PKGCONFIG = \
- gstreamer-1.0 \
- gstreamer-video-1.0
-
-DEFINES += GST_USE_UNSTABLE_API
-
-INCLUDEPATH += ../lib
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc
-
-# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH =
diff --git a/tests/examples/qt/qmlsink/qml.qrc b/tests/examples/qt/qmlsink/qml.qrc
deleted file mode 100644
index 5f6483ac3..000000000
--- a/tests/examples/qt/qmlsink/qml.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
diff --git a/tests/examples/qt/qmlsrc/.gitignore b/tests/examples/qt/qmlsrc/.gitignore
deleted file mode 100644
index d2246aeb2..000000000
--- a/tests/examples/qt/qmlsrc/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-grabqml
-qrc_qml.cpp
diff --git a/tests/examples/qt/qmlsrc/grabqml.pro b/tests/examples/qt/qmlsrc/grabqml.pro
deleted file mode 100644
index 374e40297..000000000
--- a/tests/examples/qt/qmlsrc/grabqml.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick widgets
-
-QT_CONFIG -= no-pkg-config
-CONFIG += link_pkgconfig debug
-PKGCONFIG = \
- gstreamer-1.0 \
- gstreamer-video-1.0
-
-DEFINES += GST_USE_UNSTABLE_API
-
-INCLUDEPATH += ../lib
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc
-
-# Additional import path used to resolve QML modules in Qt Creator's code model
-QML_IMPORT_PATH =
diff --git a/tests/examples/qt/qmlsrc/main.cpp b/tests/examples/qt/qmlsrc/main.cpp
deleted file mode 100644
index 35cedcb09..000000000
--- a/tests/examples/qt/qmlsrc/main.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <QApplication>
-#include <QQmlApplicationEngine>
-#include <QQuickWindow>
-#include <QQuickItem>
-#include <QQuickView>
-#include <QRunnable>
-#include <QDebug>
-#include <gst/gst.h>
-
-class SetPlaying : public QRunnable
-{
-public:
- SetPlaying(GstElement *);
- ~SetPlaying();
-
- void run ();
-
-private:
- GstElement * pipeline_;
-};
-
-SetPlaying::SetPlaying (GstElement * pipeline)
-{
- this->pipeline_ = pipeline ? static_cast<GstElement *> (gst_object_ref (pipeline)) : NULL;
-}
-
-SetPlaying::~SetPlaying ()
-{
- if (this->pipeline_)
- gst_object_unref (this->pipeline_);
-
-}
-
-void
-SetPlaying::run ()
-{
- if (this->pipeline_)
- gst_element_set_state (this->pipeline_, GST_STATE_PLAYING);
-}
-
-int main(int argc, char *argv[])
-{
- int ret;
-
- QGuiApplication app(argc, argv);
- gst_init (&argc, &argv);
-
- GstElement *pipeline = gst_pipeline_new (NULL);
- GstElement *src = gst_element_factory_make ("qmlglsrc", NULL);
- GstElement *sink = gst_element_factory_make ("glimagesink", NULL);
-
- g_assert (src && sink);
-
- gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
- gst_element_link_many (src, sink, NULL);
-
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
-
- QQuickWindow *rootObject;
-
- /* find and set the QQuickWindow on the src */
- rootObject = static_cast<QQuickWindow *> (engine.rootObjects().first());
- g_object_set(src, "window", rootObject, NULL);
- g_object_set(src, "use-default-fbo", TRUE, NULL);
- /* output buffer of qmlglsrc is vertical flip, get the image orientation tag */
- g_object_set(sink, "rotate-method", 8, NULL);
-
- rootObject->scheduleRenderJob (new SetPlaying (pipeline),
- QQuickWindow::BeforeSynchronizingStage);
-
- ret = app.exec();
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
- gst_object_unref (pipeline);
-
- gst_deinit ();
-
- return ret;
-}
diff --git a/tests/examples/qt/qmlsrc/main.qml b/tests/examples/qt/qmlsrc/main.qml
deleted file mode 100644
index 18b36e650..000000000
--- a/tests/examples/qt/qmlsrc/main.qml
+++ /dev/null
@@ -1,65 +0,0 @@
-import QtQuick 2.4
-import QtQuick.Controls 1.1
-import QtQuick.Controls.Styles 1.1
-import QtQuick.Dialogs 1.1
-import QtQuick.Window 2.1
-
-ApplicationWindow {
- id: window
- visible: true
- width: 640
- height: 480
- x: 30
- y: 30
- color: "dodgerblue"
-
- Item {
- anchors.fill: parent
-
- Rectangle {
- color: Qt.rgba(1, 1, 1, 0.7)
- border.width: 1
- border.color: "white"
- anchors.bottomMargin: 15
- anchors.horizontalCenter: parent.horizontalCenter
- width : parent.width - 30
- height: parent.height - 30
- radius: 8
-
- Text {
- id: text1
- anchors.centerIn: parent
- text: "Hello World!"
- font.pointSize: 24
- visible: timer.tex1_visible
- }
-
- Text {
- id: text2
- anchors.centerIn: parent
- text: "This is qmlglsrc demo!"
- font.pointSize: 24
- visible: timer.tex2_visible
- }
-
- Timer {
- id: timer
- property int count: 0
- property int tex1_visible: 1
- property int tex2_visible: 0
- interval: 30; running: true; repeat: true
- onTriggered: {
- count++;
- if (count%2 == 0) {
- tex1_visible = 1;
- tex2_visible = 0;
- }
- else {
- tex1_visible = 0;
- tex2_visible = 1;
- }
- }
- }
- }
- }
-}
diff --git a/tests/examples/qt/qmlsrc/qml.qrc b/tests/examples/qt/qmlsrc/qml.qrc
deleted file mode 100644
index 5f6483ac3..000000000
--- a/tests/examples/qt/qmlsrc/qml.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>