diff options
Diffstat (limited to 'src/multimedia/doc')
-rw-r--r-- | src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.png | bin | 0 -> 1301 bytes | |||
-rw-r--r-- | src/multimedia/doc/snippets/multimedia-snippets/media.cpp | 31 | ||||
-rw-r--r-- | src/multimedia/doc/snippets/multimedia-snippets/multimedia-snippets.pro | 3 | ||||
-rw-r--r-- | src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml | 61 |
4 files changed, 94 insertions, 1 deletions
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.png b/src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.png Binary files differnew file mode 100644 index 000000000..dff772951 --- /dev/null +++ b/src/multimedia/doc/snippets/multimedia-snippets/images/qt-logo.png 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] |