summaryrefslogtreecommitdiff
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
parent0a7482b97a9247f728730c1a2cf222f8a24a88c4 (diff)
downloadqtmultimedia-033bc3e0c5c2fc81fae157bea84469676575941b.tar.gz
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>
-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
-rw-r--r--src/gsttools/gsttools.pro9
-rw-r--r--src/multimedia/configure.json6
-rw-r--r--src/multimedia/doc/src/platform-notes-gstreamer-on-android.qdoc59
-rw-r--r--src/multimedia/multimedia.pro8
10 files changed, 305 insertions, 2 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
diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro
index fff039b3b..0127cbe92 100644
--- a/src/gsttools/gsttools.pro
+++ b/src/gsttools/gsttools.pro
@@ -90,6 +90,15 @@ qtConfig(gstreamer_app) {
SOURCES += qgstappsrc.cpp
}
+android {
+ LIBS_PRIVATE += \
+ -L$$(GSTREAMER_ROOT_ANDROID)/armv7/lib \
+ -Wl,--whole-archive \
+ -lgstapp-1.0 -lgstreamer-1.0 -lgstaudio-1.0 -lgsttag-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstpbutils-1.0 \
+ -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lffi -lintl -liconv -lorc-0.4 \
+ -Wl,--no-whole-archive
+}
+
HEADERS += $$PRIVATE_HEADERS
load(qt_module)
diff --git a/src/multimedia/configure.json b/src/multimedia/configure.json
index 65d9aee80..0e9cfc9f7 100644
--- a/src/multimedia/configure.json
+++ b/src/multimedia/configure.json
@@ -55,7 +55,8 @@
{ "type": "pkgConfig",
"args": "gstreamer-1.0 gstreamer-base-1.0 gstreamer-audio-1.0 gstreamer-video-1.0 gstreamer-pbutils-1.0" },
{ "libs": "-lgstreamer-1.0 -lgstbase-1.0 -lgstaudio-1.0 -lgstvideo-1.0 -lgstpbutils-1.0 -lglib-2.0 -lgobject-2.0",
- "condition": "config.win32 || config.macos" }
+ "condition": "config.win32 || config.macos" },
+ { "libs": "", "condition": "config.android && input.gstreamer != ''" }
]
},
"gstreamer_app_0_10": {
@@ -74,7 +75,8 @@
"use": "gstreamer_1_0",
"sources": [
{ "type": "pkgConfig", "args": "gstreamer-app-1.0" },
- { "libs": "-lgstapp-1.0", "condition": "config.win32 || config.macos" }
+ { "libs": "-lgstapp-1.0", "condition": "config.win32 || config.macos" },
+ { "libs": "", "condition": "config.android && input.gstreamer != ''" }
]
},
"gstreamer_photography_0_10": {
diff --git a/src/multimedia/doc/src/platform-notes-gstreamer-on-android.qdoc b/src/multimedia/doc/src/platform-notes-gstreamer-on-android.qdoc
new file mode 100644
index 000000000..51836d99a
--- /dev/null
+++ b/src/multimedia/doc/src/platform-notes-gstreamer-on-android.qdoc
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page platform-notes-gstreamer-on-android.html
+\title Qt Multimedia GStreamer on Android
+\brief Platform notes for GStreamer on Android
+\since 5.14
+
+This page covers the availability of GStreamer on Android.
+
+\section1 Limitations
+
+Since GStreamer is licensed under LGPL and distributed in archives (and should be statically linked),
+Qt Multimedia does not provide support of GStreamer on Android by default.
+
+Therefore GStreamer support must be explicitly enabled by configuring Qt with the \c -gstreamer option.
+
+\section1 Setup
+
+The GStreamer project provides prebuilt binaries which you can download and unzip into any location of your choice.
+
+The environment variable \c GSTREAMER_ROOT_ANDROID should be set to the location where you unzipped the downloaded package.
+
+\section1 Application
+
+Qt Multimedia does not contain any plugins and all needed plugins must be included
+and registered in applications manually by \c GST_PLUGIN_STATIC_DECLARE and \c GST_PLUGIN_STATIC_REGISTER
+after \c gst_init().
+
+Please refer to the official manual on how to statically link plugins to an application.
+
+https://gstreamer.freedesktop.org/documentation/gstreamer/gstplugin.html?gi-language=c#GST_PLUGIN_STATIC_REGISTER
+
+*/
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 2bc22e51d..6efee8040 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -85,6 +85,14 @@ MODULE_WINRT_CAPABILITIES_DEVICE += \
microphone \
webcam
+qtConfig(gstreamer) {
+ ANDROID_LIB_DEPENDENCIES += \
+ plugins/mediaservice/libgstcamerabin.so \
+ plugins/mediaservice/libgstmediacapture.so \
+ plugins/mediaservice/libgstmediaplayer.so \
+ plugins/mediaservice/libgstaudiodecoder.so
+}
+
win32: LIBS_PRIVATE += -luuid
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS