diff options
Diffstat (limited to 'src/multimedia/doc/snippets/multimedia-snippets')
9 files changed, 98 insertions, 354 deletions
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp b/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp index 24045adab..565f7b29b 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause /* Audio related snippets */ #include <QFile> @@ -87,9 +51,9 @@ void AudioInputExample::setup() } audio = new QAudioSource(format, this); - connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); + connect(audio, &QAudioSource::stateChanged, this, &AudioInputExample::handleStateChanged); - QTimer::singleShot(3000, this, SLOT(stopRecording())); + QTimer::singleShot(3000, this, &AudioInputExample::stopRecording); audio->start(&destinationFile); // Records audio for 3000ms } @@ -135,6 +99,7 @@ public: public Q_SLOTS: void handleStateChanged(QAudio::State newState); + void stopAudioOutput(); private: //! [Audio output class members] @@ -156,27 +121,34 @@ void AudioOutputExample::setup() format.setChannelCount(1); format.setSampleFormat(QAudioFormat::UInt8); - QAudioDevice info(QAudioDevice::defaultOutputDevice()); + QAudioDevice info(QMediaDevices::defaultAudioOutput()); if (!info.isFormatSupported(format)) { qWarning() << "Raw audio format not supported by backend, cannot play audio."; return; } audio = new QAudioSink(format, this); - connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); + connect(audio, QAudioSink::stateChanged, this, &AudioInputExample::handleStateChanged); audio->start(&sourceFile); } //! [Audio output setup] +//! [Audio output stop] +void AudioOutputExample::stopAudioOutput() +{ + audio->stop(); + sourceFile.close(); + delete audio; +} +//! [Audio output stop] + //! [Audio output state changed] void AudioOutputExample::handleStateChanged(QAudio::State newState) { switch (newState) { case QAudio::IdleState: // Finished playing (no more data) - audio->stop(); - sourceFile.close(); - delete audio; + AudioOutputExample::stopAudioOutput(); break; case QAudio::StoppedState: @@ -203,9 +175,9 @@ void AudioDeviceInfo() //! [Setting audio format] //! [Dumping audio formats] - const auto deviceInfos = QMediaDevices::availableDevices(QAudioDevice::Output); - for (const QAudioDevice &deviceInfo : deviceInfos) - qDebug() << "Device: " << deviceInfo.description(); + const auto devices = QMediaDevices::audioOutputs(); + for (const QAudioDevice &device : devices) + qDebug() << "Device: " << device.description(); //! [Dumping audio formats] } @@ -231,7 +203,7 @@ void AudioDecodingExample::decode() decoder->setAudioFormat(desiredFormat); decoder->setSource("level1.mp3"); - connect(decoder, SIGNAL(bufferReady()), this, SLOT(readBuffer())); + connect(decoder, &QAudioDecoder::bufferReady, this, &AudioDecodingExample::readBuffer); decoder->start(); // Now wait for bufferReady() signal and call decoder->read() @@ -245,9 +217,9 @@ void applyVolume(int volumeSliderValue) { // volumeSliderValue is in the range [0..100] - qreal linearVolume = QAudio::convertVolume(volumeSliderValue / qreal(100.0), - QAudio::LogarithmicVolumeScale, - QAudio::LinearVolumeScale); + qreal linearVolume = QtAudio::convertVolume(volumeSliderValue / qreal(100.0), + QtAudio::LogarithmicVolumeScale, + QtAudio::LinearVolumeScale); player.setVolume(qRound(linearVolume * 100)); } diff --git a/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp b/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp index 0abc4062f..053af088f 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/camera.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause /* Camera snippets */ @@ -55,6 +19,7 @@ QCamera *camera = 0; QMediaRecorder *recorder = 0; QImageCapture *imageCapture = 0; +QVideoWidget *viewfinder = 0; //! [Camera overview check] bool checkCameraAvailability() @@ -72,11 +37,11 @@ void overview_viewfinder() QMediaCaptureSession captureSession; camera = new QCamera; captureSession.setCamera(camera); - QVideoWidget *preview = new QVideoWidget; - camera->setVideoOutput(preview); - preview->show(); + viewfinder = new QVideoWidget; + captureSession.setVideoOutput(viewfinder); + viewfinder->show(); - camera->start(); // to start the viewfinder + camera->start(); // to start the camera //! [Camera overview viewfinder] } @@ -96,7 +61,7 @@ void overview_surface() camera = new QCamera; captureSession.setCamera(camera); mySink = new QVideoSink; - camera->setVideoOutput(mySink); + captureSession.setVideoOutput(mySink); camera->start(); // MyVideoSink::setVideoFrame(..) will be called with video frames @@ -135,7 +100,7 @@ void overview_still() QMediaCaptureSession captureSession; camera = new QCamera; captureSession.setCamera(camera); - imageCapture = new QImageCapture(camera); + imageCapture = new QImageCapture; captureSession.setImageCapture(imageCapture); camera->start(); // Viewfinder frames start flowing @@ -152,7 +117,7 @@ void overview_movie() camera = new QCamera; captureSession.setCamera(camera); recorder = new QMediaRecorder(camera); - captureSession.setMediaEncoder(recorder); + captureSession.setRecorder(recorder); camera->start(); @@ -200,8 +165,6 @@ void camera_info() qDebug() << "The camera is on the front face of the hardware system."; else if (cameraDevice.position() == QCameraDevice::BackFace) qDebug() << "The camera is on the back face of the hardware system."; - - qDebug() << "The camera sensor orientation is " << cameraDevice.orientation() << " degrees."; //! [Camera info] } @@ -212,9 +175,9 @@ void camera_blah() camera = new QCamera; captureSession.setCamera(camera); - QVideoWidget *preview = new QVideoWidget(); - preview->show(); - captureSession.setVideoOutput(preview); + viewfinder = new QVideoWidget(); + viewfinder->show(); + captureSession.setVideoOutput(viewfinder); imageCapture = new QImageCapture(camera); captureSession.setImageCapture(imageCapture); diff --git a/src/multimedia/doc/snippets/multimedia-snippets/devices.cpp b/src/multimedia/doc/snippets/multimedia-snippets/devices.cpp new file mode 100644 index 000000000..652400364 --- /dev/null +++ b/src/multimedia/doc/snippets/multimedia-snippets/devices.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include <QAudioDevice> +#include <QCameraDevice> +#include <QMediaDevices> +#include <QString> +#include <QTextStream> + +int main(int argc, char *argv[]) +{ + Q_UNUSED(argc); + Q_UNUSED(argv); + + QTextStream out(stdout); + + //! [Media Audio Input Device Enumeration] + const QList<QAudioDevice> audioDevices = QMediaDevices::audioInputs(); + for (const QAudioDevice &device : audioDevices) + { + out << "ID: " << device.id() << Qt::endl; + out << "Description: " << device.description() << Qt::endl; + out << "Is default: " << (device.isDefault() ? "Yes" : "No") << Qt::endl; + } + //! [Media Audio Input Device Enumeration] + + //! [Media Video Input Device Enumeration] + const QList<QCameraDevice> videoDevices = QMediaDevices::videoInputs(); + for (const QCameraDevice &device : videoDevices) + { + out << "ID: " << device.id() << Qt::endl; + out << "Description: " << device.description() << Qt::endl; + out << "Is default: " << (device.isDefault() ? "Yes" : "No") << Qt::endl; + } + //! [Media Video Input Device Enumeration] + + return 0; +} diff --git a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp index 770bdec44..a4b9a9fb5 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/media.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/media.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause /* Media related snippets */ #include <QFile> @@ -68,6 +32,7 @@ private: QVideoWidget *videoWidget; QWidget *widget; QMediaPlayer *player; + QAudioOutput *audioOutput; QMediaPlaylist *playlist; QMediaContent video; QMediaRecorder *recorder; @@ -109,17 +74,21 @@ void MediaExample::MediaPlayer() { //! [Player] player = new QMediaPlayer; - connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64))); + audioOutput = new QAudioOutput; + player->setAudioOutput(audioOutput); + connect(player, &QMediaPlayer::positionChanged, this, &MediaExample::positionChanged); player->setSource(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3")); - player->setVolume(50); + audioOutput->setVolume(50); player->play(); //! [Player] //! [Local playback] player = new QMediaPlayer; + audioOutput = new QAudioOutput; + player->setAudioOutput(audioOutput); // ... player->setSource(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3")); - player->setVolume(50); + audioOutput->setVolume(50); player->play(); //! [Local playback] } @@ -131,7 +100,7 @@ void MediaExample::MediaRecorder() QAudioInput audioInput; session.setAudioInput(&input); QMediaRecorder recorder; - session.setMediaRecorder(&recorder); + session.setRecorder(&recorder); recorder.setQuality(QMediaRecorder::HighQuality); recorder.setOutputLocation(QUrl::fromLocalFile("test.mp3")); recorder.record(); diff --git a/src/multimedia/doc/snippets/multimedia-snippets/multiple-videooutputs.qml b/src/multimedia/doc/snippets/multimedia-snippets/multiple-videooutputs.qml index 8484a5f28..0c673cc42 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/multiple-videooutputs.qml +++ b/src/multimedia/doc/snippets/multimedia-snippets/multiple-videooutputs.qml @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2020 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$ -** -****************************************************************************/ +// Copyright (C) 2020 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import QtQuick import QtQuick.Window @@ -45,7 +9,6 @@ import QtMultimedia Item { MediaPlayer { id: mediaplayer - autoPlay: true source: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" videoOutput: [v1, v2] audioOutput: AudioOutput { diff --git a/src/multimedia/doc/snippets/multimedia-snippets/qsound.cpp b/src/multimedia/doc/snippets/multimedia-snippets/qsound.cpp index 246589767..644dcb228 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/qsound.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/qsound.cpp @@ -1,52 +1,5 @@ - /**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the documentation 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$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "qpushbutton.h" #include "qsoundeffect.h" diff --git a/src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml b/src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml index 842b3138c..eeac9c28e 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml +++ b/src/multimedia/doc/snippets/multimedia-snippets/qtvideosink.qml @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import QtQuick import QtMultimedia diff --git a/src/multimedia/doc/snippets/multimedia-snippets/soundeffect.qml b/src/multimedia/doc/snippets/multimedia-snippets/soundeffect.qml index 501443d25..e91e54e3c 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/soundeffect.qml +++ b/src/multimedia/doc/snippets/multimedia-snippets/soundeffect.qml @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import QtQuick import QtMultimedia diff --git a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp index ac920d858..8cc3b41b3 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/video.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/video.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Mobility Components. -** -** $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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause /* Video related snippets */ #include "qvideorenderercontrol.h" @@ -43,7 +7,6 @@ #include "qvideosink.h" #include "qvideowindowcontrol.h" #include "qgraphicsvideoitem.h" -#include "qmediaplaylist.h" #include "qvideoframeformat.h" #include <QFormLayout> @@ -90,7 +53,6 @@ public: private: // Common naming - QMediaPlaylist *playlist; QVideoWidget *videoWidget; QWidget *widget; QFormLayout *layout; @@ -104,16 +66,12 @@ void VideoExample::VideoWidget() { //! [Video widget] player = new QMediaPlayer; - - playlist = new QMediaPlaylist(player); - playlist->addMedia(QUrl("http://example.com/myclip1.mp4")); - playlist->addMedia(QUrl("http://example.com/myclip2.mp4")); + player->setSource(QUrl("http://example.com/myclip1.mp4")); videoWidget = new QVideoWidget; player->setVideoOutput(videoWidget); videoWidget->show(); - playlist->setCurrentIndex(1); player->play(); //! [Video widget] @@ -154,7 +112,7 @@ void VideoExample::VideoGraphicsItem() graphicsView->scene()->addItem(item); graphicsView->show(); - player->setMedia(QUrl("http://example.com/myclip4.ogv")); + player->setSource(QUrl("http://example.com/myclip4.ogv")); player->play(); //! [Video graphics item] } |