summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-24 03:02:34 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-24 03:02:34 +0200
commitdf12242c6657bf6e83bf4c4111a3ecb22c9d58c4 (patch)
tree8e0470f057143e5a1c36791d83b42af9729b1745
parentb62171062be100186a71d00610c15a0b07d07c72 (diff)
parentd4a3e85eb86d551bdbeae973ab59c1fcee09393e (diff)
Merge remote-tracking branch 'origin/5.13' into dev
-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 60097d917..8ec7cb072 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 6ff3fc7df..5723a77dd 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -1008,6 +1008,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)