summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-20 03:01:23 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-20 03:01:24 +0200
commitc796fffc8d727c2eb469cdb183b7b1d4ddab0a68 (patch)
treef68385bcae10575566bb1039cdeada618e39b4ac
parent7b1bb300166aa19dc0f4c6838eb6d284af73236c (diff)
parent9fba45e999f7c65f3cecf8fc914befd3d8b6db80 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
-rw-r--r--src/imports/multimedia/qdeclarativeaudio.cpp10
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.pngbin0 -> 1301 bytes
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/media.cpp31
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/multimedia-snippets.pro3
-rw-r--r--src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml61
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp12
6 files changed, 116 insertions, 1 deletions
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp
index 692aec2d0..9d41c77fa 100644
--- a/src/imports/multimedia/qdeclarativeaudio.cpp
+++ b/src/imports/multimedia/qdeclarativeaudio.cpp
@@ -1303,6 +1303,16 @@ void QDeclarativeAudio::_q_mediaChanged(const QMediaContent &media)
This property holds the source URL of the media.
Setting the \l source property clears the current \l playlist, if any.
+
+ Since Qt 5.12.2, the url scheme \c gst-pipeline provides custom pipelines
+ for the GStreamer backend.
+
+ If the pipeline contains a \c qtvideosink element,
+ the current VideoOutput will be used for rendering video.
+
+ \snippet multimedia-snippets/qtvideosink.qml complete
+
+ \sa QMediaPlayer::setMedia()
*/
/*!
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.png b/src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.png
new file mode 100644
index 000000000..dff772951
--- /dev/null
+++ b/src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.png
Binary files differ
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
index 7cabfabf3..4e8c06409 100644
--- a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
+++ b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp
@@ -40,6 +40,7 @@
/* Media related snippets */
#include <QFile>
#include <QTimer>
+#include <QBuffer>
#include "qmediaplaylist.h"
#include "qmediarecorder.h"
@@ -189,6 +190,36 @@ void MediaExample::MediaPlayer()
player->play();
//! [Movie playlist]
+
+ //! [Pipeline]
+ player = new QMediaPlayer;
+ player->setMedia(QUrl("gst-pipeline: videotestsrc ! autovideosink"));
+ player->play();
+ //! [Pipeline]
+
+ //! [Pipeline appsrc]
+ QImage img("images/qt-logo.png");
+ img = img.convertToFormat(QImage::Format_ARGB32);
+ QByteArray ba(reinterpret_cast<const char *>(img.bits()), img.sizeInBytes());
+ QBuffer buffer(&ba);
+ buffer.open(QIODevice::ReadOnly);
+ player = new QMediaPlayer;
+ player->setMedia(QUrl("gst-pipeline: appsrc blocksize=4294967295 ! \
+ video/x-raw,format=BGRx,framerate=30/1,width=200,height=147 ! \
+ coloreffects preset=heat ! videoconvert ! video/x-raw,format=I420 ! jpegenc ! rtpjpegpay ! \
+ udpsink host=127.0.0.1 port=5000"), &buffer);
+ player->play();
+
+ QMediaPlayer *receiver = new QMediaPlayer;
+ videoWidget = new QVideoWidget;
+ receiver->setVideoOutput(videoWidget);
+ receiver->setMedia(QUrl("gst-pipeline: udpsrc port=5000 ! \
+ application/x-rtp,encoding-name=JPEG,payload=26 ! rtpjpegdepay ! jpegdec ! \
+ xvimagesink name=qtvideosink"));
+ receiver->play();
+ // Content will be shown in this widget.
+ videoWidget->show();
+ //! [Pipeline appsrc]
}
void MediaExample::MediaRecorder()
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/multimedia-snippets.pro b/src/multimedia/doc/snippets/multimedia-snippets/multimedia-snippets.pro
index 9571b026e..c13090a79 100644
--- a/src/multimedia/doc/snippets/multimedia-snippets/multimedia-snippets.pro
+++ b/src/multimedia/doc/snippets/multimedia-snippets/multimedia-snippets.pro
@@ -21,4 +21,5 @@ SOURCES += \
qsound.cpp
OTHER_FILES += \
- soundeffect.qml
+ soundeffect.qml \
+ qtvideosink.qml
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml b/src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml
new file mode 100644
index 000000000..a4ae07f30
--- /dev/null
+++ b/src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** 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.12
+
+//! [complete]
+Item {
+ MediaPlayer {
+ id: mediaplayer
+ source: "gst-pipeline: videotestsrc ! qtvideosink"
+ }
+
+ VideoOutput {
+ anchors.fill: parent
+ source: mediaplayer
+ }
+
+ MouseArea {
+ id: playArea
+ anchors.fill: parent
+ onPressed: mediaplayer.play();
+ }
+}
+//! [complete]
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 81d525ea8..c4d574d4e 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -1005,6 +1005,18 @@ void QMediaPlayer::setPlaybackRate(qreal rate)
It does not wait for the media to finish loading and does not check for errors. Listen for
the mediaStatusChanged() and error() signals to be notified when the media is loaded and
when an error occurs during loading.
+
+ Since Qt 5.12.2, the url scheme \c gst-pipeline provides custom pipelines
+ for the GStreamer backend.
+
+ \snippet multimedia-snippets/media.cpp Pipeline
+
+ If the pipeline contains a video sink element named \c qtvideosink,
+ current QVideoWidget can be used to render the video.
+
+ If the pipeline contains appsrc element, it will be used to push data from \a stream.
+
+ \snippet multimedia-snippets/media.cpp Pipeline appsrc
*/
void QMediaPlayer::setMedia(const QMediaContent &media, QIODevice *stream)