Commit fe2684b3 authored by Val Doroshchuk's avatar Val Doroshchuk

up

parent 1797a2f0
TEMPLATE = subdirs
QT_FOR_CONFIG += multimedia-private
SUBDIRS += filters qt-launch playbin
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.0
import QtMultimedia 5.11
import QtGstreamerExtras 5.12
Item {
id: video
property alias pipeline: gst.pipeline
VideoOutput {
id: videoOut
anchors.fill: video
source: player
}
MediaPlayer {
id: player
autoPlay: true
}
GstreamerPipeline {
id: gst
source: player
}
}
TEMPLATE = app
TARGET = filters
QT += qml quick multimediagsttools-private
# Input
SOURCES += main.cpp
RESOURCES += qml.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/gstreamer/filters
INSTALLS += target
/****************************************************************************
**
** 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>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.12
import QtMultimedia 5.11
ApplicationWindow {
id: window
title: "Gstreamer pipeline example"
visible: true
width: 1920
height: 1080
color: "black"
property var filter: "queue"
RowLayout {
anchors.fill: parent
ListView {
visible: true
id: view
Layout.fillHeight: true
width: 200
readonly property int columnCount: 3
model: ListModel {
ListElement { filters: "identity" }
ListElement { filters: "bulge" }
ListElement { filters: "dicetv" }
ListElement { filters: "edgetv" }
ListElement { filters: "videoflip method=horizontal-flip" }
}
delegate: Pipeline {
id: video
height: 200
width: 200
pipeline: "filesrc location=images/qt-logo.png ! decodebin ! videoconvert ! imagefreeze ! " + model.filters + " ! qtvideosink"
MouseArea {
anchors.fill:parent
onClicked: filter = model.filters
}
}
}
Pipeline {
Layout.fillWidth: true
Layout.fillHeight: true
pipeline: "v4l2src ! queue ! avdec_h264 ! videoconvert ! " + filter + " ! videoconvert ! qtvideosink"
}
}
}
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>Pipeline.qml</file>
</qresource>
</RCC>
/****************************************************************************
**
** 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 <QtCore/QCommandLineParser>
#include <QtQuick/QQuickView>
#include <QtQuick/QQuickItem>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QCoreApplication::setApplicationName("QtMultimedia Gstreamer Playbin Example");
QCoreApplication::setOrganizationName("QtProject");
QGuiApplication::setApplicationDisplayName(QCoreApplication::applicationName());
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption uriOpt("uri", "URI of the media to play.", "uri");
parser.addOption(uriOpt);
QCommandLineOption videoSinkOpt("video-sink", "The video output element to use.", "video-sink");
parser.addOption(videoSinkOpt);
QCommandLineOption showTextOpt("show-text", "Enable a subtitle.");
parser.addOption(showTextOpt);
QCommandLineOption textUriOpt("text-uri", "The currently playing URI of a subtitle.", "text-uri");
parser.addOption(textUriOpt);
QCommandLineOption fontOpt("text-font", "Pango font description of font to be used for subtitle rendering.", "text-font");
parser.addOption(fontOpt);
QCommandLineOption audioOpt("audio-stream", "Currently playing audio stream.", "audio-stream");
parser.addOption(audioOpt);
QCommandLineOption videoOpt("video-stream", "Currently playing video stream.", "video-stream");
parser.addOption(videoOpt);
QCommandLineOption textOpt("text-stream", "Currently playing text stream.", "text-stream");
parser.addOption(textOpt);
parser.process(app);
QString uri = parser.isSet(uriOpt) ? parser.value(uriOpt) : QString();
QString videoSink = parser.isSet(videoSinkOpt) ? parser.value(videoSinkOpt) : QString();
QString textUri = parser.isSet(textUriOpt) ? parser.value(textUriOpt) : QString();
QString textFont = parser.isSet(fontOpt) ? parser.value(fontOpt) : QString();
QString audioStream = parser.isSet(audioOpt) ? parser.value(audioOpt) : QString();
QString videoStream = parser.isSet(videoOpt) ? parser.value(videoOpt) : QString();
QString textStream = parser.isSet(textOpt) ? parser.value(textOpt) : QString();
QQuickView viewer;
viewer.setSource(QUrl("qrc:/main.qml"));
QObject::connect(viewer.engine(), &QQmlEngine::quit, &viewer, &QQuickView::close);
QQuickItem *rootObject = viewer.rootObject();
if (!uri.isEmpty())
rootObject->setProperty("uri", uri);
if (!videoSink.isEmpty())
rootObject->setProperty("videoSink", videoSink);
if (parser.isSet(showTextOpt))
rootObject->setProperty("showText", true);
if (!textUri.isEmpty())
rootObject->setProperty("textUri", textUri);
if (!textFont.isEmpty())
rootObject->setProperty("textFont", textFont);
if (!audioStream.isEmpty())
rootObject->setProperty("audioStream", audioStream);
if (!videoStream.isEmpty())
rootObject->setProperty("videoStream", videoStream);
if (!textStream.isEmpty())
rootObject->setProperty("textStream", textStream);
QMetaObject::invokeMethod(rootObject, "init");
viewer.setMinimumSize(QSize(640, 360));
viewer.show();
return app.exec();
}
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** 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 Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.7
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.12
import QtMultimedia 5.11
import QtGstreamerExtras 5.12
Rectangle {
id: root
anchors.fill: parent
color: "black"
property string uri
property string pipeline
property string videoSink
property bool showText: false
property string textUri
property string textFont
property int audioStream: -1
property int videoStream: -1
property int textStream: -1
Component {
id: comp
Item {
anchors.fill: root
VideoOutput {
id: videoOut
anchors.fill: parent
source: player
}
MediaPlayer {
id: player
autoPlay: true
}
GstreamerPlaybin {
id: gst
source: player
videoSink: root.videoSink
showText: root.showText
textUri: root.textUri
textFont: root.textFont
audioStream: root.audioStream
videoStream: root.videoStream
textStream: root.textStream
}
MouseArea {
anchors.fill: parent
onClicked: {
if (player.playbackState == MediaPlayer.PlayingState)
player.pause()
else
player.play()
}
}
Component.onCompleted: {
if (root.uri)
player.source = root.uri
else
gst.pipeline = "videotestsrc ! qtvideosink"
}
}
}
function init() {
comp.createObject(root)
}
}
TEMPLATE = app
TARGET = playbin
QT += qml quick multimedia widgets multimediagsttools-private
# Input
SOURCES += main.cpp
RESOURCES += qml.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/gstreamer/playbin
INSTALLS += target
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>
/****************************************************************************
**
** 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 <QGstreamerPipeline>
#include <QApplication>
#include <QMediaPlayer>
#include <QVideoWidget>
#include <QtCore/QCommandLineParser>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCoreApplication::setApplicationName("QtMultimedia GStreamer Launch Example");
QCoreApplication::setOrganizationName("QtProject");
QGuiApplication::setApplicationDisplayName(QCoreApplication::applicationName());
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("pipeline", "The pipeline to launch.");
parser.process(app);
QVideoWidget widget;
widget.resize(QSize(800, 600));
QMediaPlayer player;
player.setVideoOutput(&widget);
QObject::connect(&player, &QMediaPlayer::mediaStatusChanged,
[&](QMediaPlayer::MediaStatus status) {
if (status == QMediaPlayer::EndOfMedia || status == QMediaPlayer::InvalidMedia)
app.exit();
});
QString pipeline = !parser.positionalArguments().isEmpty()
? parser.positionalArguments().join(" ")
: QLatin1String("videotestsrc ! xvimagesink name=qtvideosink");
QGstreamerPipeline gst(&player);
QObject::connect(&gst, &QGstreamerPipeline::pipelineChanged, [&](){
if (!gst_bin_get_by_name(GST_BIN(gst.pipeline()), "qtvideosink"))
return;
widget.show();
});
gst.setPipeline(pipeline);
player.play();
return app.exec();
}
TEMPLATE = app
TARGET = qt-launch
QT += multimedia multimediawidgets multimediagsttools-private
# Input
SOURCES = main.cpp
target.path = $$[QT_INSTALL_EXAMPLES]/gstreamer/qt-launch
INSTALLS += target
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment