summaryrefslogtreecommitdiffstats
path: root/examples/multimedia
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2019-05-16 14:35:16 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-10-18 12:56:41 +0200
commit033bc3e0c5c2fc81fae157bea84469676575941b (patch)
treea057d39d5a1a6d9beca1f34ae505242545ccafcd /examples/multimedia
parent0a7482b97a9247f728730c1a2cf222f8a24a88c4 (diff)
GStreamer: Add support of Androidv5.14.0-beta2
Since for Android GStreamer is distributed in archives, and should be staticlly linked, so by default it is not built and should be explicitly enabled within configuring by -gstreamer option. (currently it is auto and enabled if gstreamer exists) ("libs" of the gstreamer library in configure.json is empty to prevent any libs to be added while building any code that uses gstreamer library) Some base gst archives are fully included to Qt5MultimediaGstTools. Users would need to just use: QT += multimediagsttools-private Before building, GSTREAMER_ROOT_ANDROID env var should be set to point to gst binaries. Also all necessary plugins must be registered in user's code by GST_PLUGIN_STATIC_DECLARE/GST_PLUGIN_STATIC_REGISTER macros after QGstUtils::initializeGst(). and e.g. project file might contain: INCLUDEPATH += $$(GSTREAMER_ROOT_ANDROID)/armv7/include/ \ $(GSTREAMER_ROOT_ANDROID)/armv7/include/gstreamer-1.0 \ $(GSTREAMER_ROOT_ANDROID)/armv7/include/glib-2.0 \ $(GSTREAMER_ROOT_ANDROID)/armv7/lib/glib-2.0/include LIBS += -L$$(GSTREAMER_ROOT_ANDROID)/armv7/lib/ \ -L$$(GSTREAMER_ROOT_ANDROID)/armv7/lib/gstreamer-1.0 \ __here_list_of_plugins__ See video/android/gstreamer example Change-Id: Ie4e586fa8489f1bd23622763f5578abed1729272 Task-number: QTBUG-72125 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Diffstat (limited to 'examples/multimedia')
-rw-r--r--examples/multimedia/video/android/android.pro5
-rw-r--r--examples/multimedia/video/android/gstreamer/gstreamer.pro23
-rw-r--r--examples/multimedia/video/android/gstreamer/main.cpp115
-rw-r--r--examples/multimedia/video/android/gstreamer/main.qml75
-rw-r--r--examples/multimedia/video/android/gstreamer/qml.qrc5
-rw-r--r--examples/multimedia/video/video.pro2
6 files changed, 225 insertions, 0 deletions
diff --git a/examples/multimedia/video/android/android.pro b/examples/multimedia/video/android/android.pro
new file mode 100644
index 000000000..95ed21e17
--- /dev/null
+++ b/examples/multimedia/video/android/android.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+QT_FOR_CONFIG += multimedia-private
+
+qtConfig(gstreamer): SUBDIRS += gstreamer
diff --git a/examples/multimedia/video/android/gstreamer/gstreamer.pro b/examples/multimedia/video/android/gstreamer/gstreamer.pro
new file mode 100644
index 000000000..edc040adc
--- /dev/null
+++ b/examples/multimedia/video/android/gstreamer/gstreamer.pro
@@ -0,0 +1,23 @@
+QT += quick multimedia multimediawidgets
+CONFIG += c++11
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/video/android/gstreamer
+INSTALLS += target
+
+GSTREAMER_ROOT_ANDROID = $$(GSTREAMER_ROOT_ANDROID)
+isEmpty(GSTREAMER_ROOT_ANDROID): error("GSTREAMER_ROOT_ANDROID is empty")
+
+INCLUDEPATH += $(GSTREAMER_ROOT_ANDROID)/armv7/include/ $(GSTREAMER_ROOT_ANDROID)/armv7/include/gstreamer-1.0 $(GSTREAMER_ROOT_ANDROID)/armv7/include/glib-2.0 $(GSTREAMER_ROOT_ANDROID)/armv7/lib/glib-2.0/include
+
+QT+=multimediagsttools-private
+LIBS += -L$(GSTREAMER_ROOT_ANDROID)/armv7/lib/ -L$(GSTREAMER_ROOT_ANDROID)/armv7/lib/gstreamer-1.0 \
+-lgstcoreelements -lgstplayback -lgstvideotestsrc -lgstaudioconvert -lgstvideoconvert -lgstautodetect -lgsttypefindfunctions \
+#PLUGINS codecs
+-lgstvorbis -lvorbis -lgstivorbisdec -lvorbisenc -lvorbisfile -lgstsubparse -lgstaudioparsers \
+-lgstgio -lgstapp -lgstisomp4 -lgstavi -lgstogg -lgstwavenc -lgstwavpack -lgstwavparse -lgsttheora -lgstmpg123 -lgstx264 -lgstlibav \
+-lgsttcp -lgstsoup -logg -ltheora -lmpg123 -lx264 -lavfilter -lavformat -lavcodec -lavutil -lbz2 -lswresample \
+-lsoup-2.4 -lgio-2.0 -lgstrtp-1.0 -lgstriff-1.0 -lgstnet-1.0
diff --git a/examples/multimedia/video/android/gstreamer/main.cpp b/examples/multimedia/video/android/gstreamer/main.cpp
new file mode 100644
index 000000000..56037aece
--- /dev/null
+++ b/examples/multimedia/video/android/gstreamer/main.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+#include <private/qgstutils_p.h>
+
+#include <gst/gstplugin.h>
+extern "C" {
+GST_PLUGIN_STATIC_DECLARE(coreelements);
+GST_PLUGIN_STATIC_DECLARE(playback);
+GST_PLUGIN_STATIC_DECLARE(videotestsrc);
+GST_PLUGIN_STATIC_DECLARE(audioconvert);
+GST_PLUGIN_STATIC_DECLARE(videoconvert);
+GST_PLUGIN_STATIC_DECLARE(autodetect);
+GST_PLUGIN_STATIC_DECLARE(gio);
+GST_PLUGIN_STATIC_DECLARE(soup);
+GST_PLUGIN_STATIC_DECLARE(app);
+GST_PLUGIN_STATIC_DECLARE(isomp4);
+GST_PLUGIN_STATIC_DECLARE(avi);
+GST_PLUGIN_STATIC_DECLARE(ogg);
+GST_PLUGIN_STATIC_DECLARE(vorbis);
+GST_PLUGIN_STATIC_DECLARE(tcp);
+GST_PLUGIN_STATIC_DECLARE(audioparsers);
+GST_PLUGIN_STATIC_DECLARE(theora);
+GST_PLUGIN_STATIC_DECLARE(mpg123);
+GST_PLUGIN_STATIC_DECLARE(typefindfunctions);
+GST_PLUGIN_STATIC_DECLARE(x264);
+GST_PLUGIN_STATIC_DECLARE(libav);
+};
+
+int main(int argc, char *argv[])
+{
+ QGstUtils::initializeGst();
+
+ GST_PLUGIN_STATIC_REGISTER(coreelements);
+ GST_PLUGIN_STATIC_REGISTER(playback);
+ GST_PLUGIN_STATIC_REGISTER(videotestsrc);
+ GST_PLUGIN_STATIC_REGISTER(audioconvert);
+ GST_PLUGIN_STATIC_REGISTER(videoconvert);
+ GST_PLUGIN_STATIC_REGISTER(autodetect);
+ GST_PLUGIN_STATIC_REGISTER(soup);
+ GST_PLUGIN_STATIC_REGISTER(gio);
+ GST_PLUGIN_STATIC_REGISTER(app);
+ GST_PLUGIN_STATIC_REGISTER(isomp4);
+ GST_PLUGIN_STATIC_REGISTER(avi);
+ GST_PLUGIN_STATIC_REGISTER(ogg);
+ GST_PLUGIN_STATIC_REGISTER(vorbis);
+ GST_PLUGIN_STATIC_REGISTER(tcp);
+ GST_PLUGIN_STATIC_REGISTER(audioparsers);
+ GST_PLUGIN_STATIC_REGISTER(theora);
+ GST_PLUGIN_STATIC_REGISTER(mpg123);
+ GST_PLUGIN_STATIC_REGISTER(typefindfunctions);
+ GST_PLUGIN_STATIC_REGISTER(x264);
+ GST_PLUGIN_STATIC_REGISTER(libav);
+
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
+ QGuiApplication app(argc, argv);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QLatin1String("qrc:/main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
diff --git a/examples/multimedia/video/android/gstreamer/main.qml b/examples/multimedia/video/android/gstreamer/main.qml
new file mode 100644
index 000000000..99acb558c
--- /dev/null
+++ b/examples/multimedia/video/android/gstreamer/main.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.3
+import QtMultimedia 5.12
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 480
+
+ Video {
+ id: video
+ anchors.fill: parent
+ autoPlay: true
+ autoLoad: true
+ source: "gst-pipeline: videotestsrc ! qtvideosink"
+ }
+
+ MouseArea {
+ anchors.fill: video
+ onClicked: {
+ video.play()
+ }
+ }
+}
diff --git a/examples/multimedia/video/android/gstreamer/qml.qrc b/examples/multimedia/video/android/gstreamer/qml.qrc
new file mode 100644
index 000000000..5f6483ac3
--- /dev/null
+++ b/examples/multimedia/video/android/gstreamer/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/multimedia/video/video.pro b/examples/multimedia/video/video.pro
index f38cbc124..ef5bc849d 100644
--- a/examples/multimedia/video/video.pro
+++ b/examples/multimedia/video/video.pro
@@ -5,3 +5,5 @@ SUBDIRS += qmlvideo qmlvideofx
EXAMPLE_FILES += \
qmlvideofilter_opencl \ # FIXME: this one should use a configure check instead
snippets
+
+android: SUBDIRS += android