summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--dependencies.yaml7
-rw-r--r--examples/multimedia/audiodecoder/audiodecoder.cpp24
-rw-r--r--examples/multimedia/audiodecoder/main.cpp10
-rw-r--r--examples/multimedia/audiodecoder/wavefilewriter.cpp2
-rw-r--r--src/imports/audioengine/audioengine.cpp4
-rw-r--r--src/imports/multimedia/multimedia.cpp5
-rw-r--r--src/multimedia/controls/qmetadatareadercontrol.h2
-rw-r--r--src/multimedia/controls/qmetadatawritercontrol.h2
-rw-r--r--src/multimedia/playback/playback.pri4
-rw-r--r--src/multimedia/playback/qmediacontent.cpp86
-rw-r--r--src/multimedia/playback/qmediacontent.h14
-rw-r--r--src/multimedia/playback/qmediaresource.cpp420
-rw-r--r--src/multimedia/playback/qmediaresource.h127
-rw-r--r--src/multimedia/playback/qplaylistfileparser.cpp1
-rw-r--r--src/plugins/coreaudio/coreaudiodeviceinfo.mm2
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.h1
-rw-r--r--src/plugins/m3u/qm3uhandler.cpp1
-rw-r--r--src/plugins/qnx/camera/bbcameraorientationhandler.cpp6
-rw-r--r--src/plugins/qnx/camera/bbcameraorientationhandler.h4
-rw-r--r--src/plugins/qnx/common/windowgrabber.cpp6
-rw-r--r--src/plugins/qnx/common/windowgrabber.h4
-rw-r--r--src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.cpp8
-rw-r--r--src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.h8
-rw-r--r--src/plugins/winrt/qwinrtmediaplayercontrol.cpp9
-rw-r--r--src/plugins/wmf/player/mfplayerservice.h1
-rw-r--r--src/plugins/wmf/player/mfplayersession.h1
-rw-r--r--src/plugins/wmf/sourceresolver.h2
-rw-r--r--tests/auto/unit/multimedia.pro1
-rw-r--r--tests/auto/unit/qmediacontent/tst_qmediacontent.cpp60
-rw-r--r--tests/auto/unit/qmediaresource/qmediaresource.pro7
-rw-r--r--tests/auto/unit/qmediaresource/tst_qmediaresource.cpp697
32 files changed, 70 insertions, 1458 deletions
diff --git a/.qmake.conf b/.qmake.conf
index b3c7403c2..85f18db7a 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,4 +2,4 @@ load(qt_build_config)
DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
-MODULE_VERSION = 5.15.0
+MODULE_VERSION = 6.0.0
diff --git a/dependencies.yaml b/dependencies.yaml
new file mode 100644
index 000000000..8b1668ae2
--- /dev/null
+++ b/dependencies.yaml
@@ -0,0 +1,7 @@
+dependencies:
+ ../qtbase:
+ ref: 8652c79df0a47264a2d525424484e15744e2462b
+ required: true
+ ../qtdeclarative:
+ ref: d5dc3c4cbdc4455143626d7a3e0f9a9a211515a9
+ required: false
diff --git a/examples/multimedia/audiodecoder/audiodecoder.cpp b/examples/multimedia/audiodecoder/audiodecoder.cpp
index 86904f7c9..15c88ebc9 100644
--- a/examples/multimedia/audiodecoder/audiodecoder.cpp
+++ b/examples/multimedia/audiodecoder/audiodecoder.cpp
@@ -129,16 +129,16 @@ void AudioDecoder::error(QAudioDecoder::Error error)
case QAudioDecoder::NoError:
return;
case QAudioDecoder::ResourceError:
- m_cout << "Resource error" << endl;
+ m_cout << "Resource error" << Qt::endl;
break;
case QAudioDecoder::FormatError:
- m_cout << "Format error" << endl;
+ m_cout << "Format error" << Qt::endl;
break;
case QAudioDecoder::AccessDeniedError:
- m_cout << "Access denied error" << endl;
+ m_cout << "Access denied error" << Qt::endl;
break;
case QAudioDecoder::ServiceMissingError:
- m_cout << "Service missing error" << endl;
+ m_cout << "Service missing error" << Qt::endl;
break;
}
@@ -149,10 +149,10 @@ void AudioDecoder::stateChanged(QAudioDecoder::State newState)
{
switch (newState) {
case QAudioDecoder::DecodingState:
- m_cout << "Decoding..." << endl;
+ m_cout << "Decoding..." << Qt::endl;
break;
case QAudioDecoder::StoppedState:
- m_cout << "Decoding stopped" << endl;
+ m_cout << "Decoding stopped" << Qt::endl;
break;
}
}
@@ -160,12 +160,12 @@ void AudioDecoder::stateChanged(QAudioDecoder::State newState)
void AudioDecoder::finished()
{
if (!m_fileWriter.close())
- m_cout << "Failed to finilize output file" << endl;
+ m_cout << "Failed to finilize output file" << Qt::endl;
- m_cout << "Decoding finished" << endl;
+ m_cout << "Decoding finished" << Qt::endl;
if (m_isPlayback) {
- m_cout << "Starting playback" << endl;
+ m_cout << "Starting playback" << Qt::endl;
m_soundEffect.setSource(QUrl::fromLocalFile(m_targetFilename));
m_soundEffect.play();
} else {
@@ -176,7 +176,7 @@ void AudioDecoder::finished()
void AudioDecoder::playbackStatusChanged()
{
if (m_soundEffect.status() == QSoundEffect::Error) {
- m_cout << "Playback error" << endl;
+ m_cout << "Playback error" << Qt::endl;
emit done();
}
}
@@ -184,7 +184,7 @@ void AudioDecoder::playbackStatusChanged()
void AudioDecoder::playingChanged()
{
if (!m_soundEffect.isPlaying()) {
- m_cout << "Playback finished" << endl;
+ m_cout << "Playback finished" << Qt::endl;
if (m_isDelete)
QFile::remove(m_targetFilename);
emit done();
@@ -200,7 +200,7 @@ void AudioDecoder::updateProgress()
progress = position / (qreal)duration;
if (progress > m_progress + 0.1) {
- m_cout << "Decoding progress: " << (int)(progress * 100.0) << "%" << endl;
+ m_cout << "Decoding progress: " << (int)(progress * 100.0) << "%" << Qt::endl;
m_progress = progress;
}
}
diff --git a/examples/multimedia/audiodecoder/main.cpp b/examples/multimedia/audiodecoder/main.cpp
index c0947b83f..46e70445e 100644
--- a/examples/multimedia/audiodecoder/main.cpp
+++ b/examples/multimedia/audiodecoder/main.cpp
@@ -63,10 +63,10 @@ int main(int argc, char *argv[])
QTextStream cout(stdout, QIODevice::WriteOnly);
if (app.arguments().size() < 2) {
- cout << "Usage: audiodecoder [-p] [-pd] SOURCEFILE [TARGETFILE]" << endl;
- cout << "Set -p option if you want to play output file." << endl;
- cout << "Set -pd option if you want to play output file and delete it after successful playback." << endl;
- cout << "Default TARGETFILE name is \"out.wav\" in the same directory as the source file." << endl;
+ cout << "Usage: audiodecoder [-p] [-pd] SOURCEFILE [TARGETFILE]" << Qt::endl;
+ cout << "Set -p option if you want to play output file." << Qt::endl;
+ cout << "Set -pd option if you want to play output file and delete it after successful playback." << Qt::endl;
+ cout << "Default TARGETFILE name is \"out.wav\" in the same directory as the source file." << Qt::endl;
return 0;
}
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
int sourceFileIndex = (isPlayback || isDelete) ? 2 : 1;
if (app.arguments().size() <= sourceFileIndex) {
- cout << "Error: source filename is not specified." << endl;
+ cout << "Error: source filename is not specified." << Qt::endl;
return 0;
}
sourceFile.setFile(app.arguments().at(sourceFileIndex));
diff --git a/examples/multimedia/audiodecoder/wavefilewriter.cpp b/examples/multimedia/audiodecoder/wavefilewriter.cpp
index 7b047b00d..cb1abbc9f 100644
--- a/examples/multimedia/audiodecoder/wavefilewriter.cpp
+++ b/examples/multimedia/audiodecoder/wavefilewriter.cpp
@@ -50,6 +50,8 @@
#include "wavefilewriter.h"
+#include <limits.h>
+
struct chunk
{
char id[4];
diff --git a/src/imports/audioengine/audioengine.cpp b/src/imports/audioengine/audioengine.cpp
index 537b09ab8..698f41bdc 100644
--- a/src/imports/audioengine/audioengine.cpp
+++ b/src/imports/audioengine/audioengine.cpp
@@ -80,7 +80,9 @@ public:
qmlRegisterType<QDeclarativeAudioEngine, 1>(uri, 1, 1, "AudioEngine");
qmlRegisterType<QDeclarativeSound, 1>(uri, 1, 1, "Sound");
- qmlRegisterModule(uri, 1, QT_VERSION_MINOR);
+ // The minor version used to be the current Qt 5 minor. For compatibility it is the last
+ // Qt 5 release.
+ qmlRegisterModule(uri, 1, 15);
}
};
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp
index 6106bb45d..7dadaea32 100644
--- a/src/imports/multimedia/multimedia.cpp
+++ b/src/imports/multimedia/multimedia.cpp
@@ -165,8 +165,9 @@ public:
qmlRegisterType<QDeclarativeVideoOutput, 15>(uri, 5, 15, "VideoOutput");
qmlRegisterType<QAbstractVideoSurface>();
- // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward
- qmlRegisterModule(uri, 5, QT_VERSION_MINOR);
+ // The minor version used to be the current Qt 5 minor. For compatibility it is the last
+ // Qt 5 release.
+ qmlRegisterModule(uri, 5, 15);
}
void initializeEngine(QQmlEngine *engine, const char *uri) override
diff --git a/src/multimedia/controls/qmetadatareadercontrol.h b/src/multimedia/controls/qmetadatareadercontrol.h
index b7be6b7b5..b13c7ea00 100644
--- a/src/multimedia/controls/qmetadatareadercontrol.h
+++ b/src/multimedia/controls/qmetadatareadercontrol.h
@@ -43,8 +43,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qmediaobject.h>
-#include <QtMultimedia/qmediaresource.h>
-
#include <QtMultimedia/qtmultimediaglobal.h>
#include <QtMultimedia/qmultimedia.h>
diff --git a/src/multimedia/controls/qmetadatawritercontrol.h b/src/multimedia/controls/qmetadatawritercontrol.h
index 95a314b90..a1d4449c3 100644
--- a/src/multimedia/controls/qmetadatawritercontrol.h
+++ b/src/multimedia/controls/qmetadatawritercontrol.h
@@ -43,8 +43,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qmediaobject.h>
-#include <QtMultimedia/qmediaresource.h>
-
#include <QtMultimedia/qtmultimediaglobal.h>
#include <QtMultimedia/qmultimedia.h>
diff --git a/src/multimedia/playback/playback.pri b/src/multimedia/playback/playback.pri
index cc55fc1b0..81a3b298f 100644
--- a/src/multimedia/playback/playback.pri
+++ b/src/multimedia/playback/playback.pri
@@ -3,8 +3,7 @@ INCLUDEPATH += playback
PUBLIC_HEADERS += \
playback/qmediacontent.h \
playback/qmediaplayer.h \
- playback/qmediaplaylist.h \
- playback/qmediaresource.h
+ playback/qmediaplaylist.h
PRIVATE_HEADERS += \
playback/qmediaplaylist_p.h \
@@ -22,5 +21,4 @@ SOURCES += \
playback/qmediaplaylistioplugin.cpp \
playback/qmediaplaylistnavigator.cpp \
playback/qmediaplaylistprovider.cpp \
- playback/qmediaresource.cpp \
playback/qplaylistfileparser.cpp
diff --git a/src/multimedia/playback/qmediacontent.cpp b/src/multimedia/playback/qmediacontent.cpp
index 6915ae7af..08ce49587 100644
--- a/src/multimedia/playback/qmediacontent.cpp
+++ b/src/multimedia/playback/qmediacontent.cpp
@@ -61,15 +61,6 @@ public:
isPlaylistOwned(false)
{}
-#if QT_DEPRECATED_SINCE(6, 0)
- QMediaContentPrivate(const QMediaResourceList &r):
- isPlaylistOwned(false)
- {
- for (auto &item : r)
- requests << item.request();
- }
-#endif
-
QMediaContentPrivate(const QNetworkRequest &r):
isPlaylistOwned(false)
{
@@ -162,31 +153,6 @@ QMediaContent::QMediaContent(const QNetworkRequest &request):
d->requests << request;
}
-#if QT_DEPRECATED_SINCE(6, 0)
-/*!
- \obsolete
-
- Constructs a media content with \a resource providing a reference to the content.
-*/
-
-QMediaContent::QMediaContent(const QMediaResource &resource):
- d(new QMediaContentPrivate)
-{
- d->requests << resource.request();
-}
-
-/*!
- \obsolete
-
- Constructs a media content with \a resources providing a reference to the content.
-*/
-
-QMediaContent::QMediaContent(const QMediaResourceList &resources):
- d(new QMediaContentPrivate(resources))
-{
-}
-#endif
-
/*!
Constructs a copy of the media content \a other.
*/
@@ -268,58 +234,6 @@ QNetworkRequest QMediaContent::request() const
return (d && !d->requests.isEmpty()) ? d->requests.first() : QNetworkRequest();
}
-#if QT_DEPRECATED_SINCE(6, 0)
-/*!
- \obsolete
-
- Returns a QUrl that represents that canonical resource for this media content.
-*/
-
-QUrl QMediaContent::canonicalUrl() const
-{
- return request().url();
-}
-
-/*!
- \obsolete
-
- Returns a QNetworkRequest that represents that canonical resource for this media content.
-*/
-
-QNetworkRequest QMediaContent::canonicalRequest() const
-{
- return request();
-}
-
-/*!
- \obsolete
-
- Returns a QMediaResource that represents that canonical resource for this media content.
-*/
-
-QMediaResource QMediaContent::canonicalResource() const
-{
- return (d && !d->requests.isEmpty()) ? d->requests.first() : QMediaResource();
-}
-
-/*!
- \obsolete
-
- Returns a list of alternative resources for this media content. The first item in this list
- is always the canonical resource.
-*/
-
-QMediaResourceList QMediaContent::resources() const
-{
- QMediaResourceList list;
- if (d) {
- for (auto &item : d->requests)
- list << item;
- }
- return list;
-}
-#endif // #if QT_DEPRECATED_SINCE(6, 0)
-
/*!
Returns a playlist for this media content or 0 if this QMediaContent is not a playlist.
*/
diff --git a/src/multimedia/playback/qmediacontent.h b/src/multimedia/playback/qmediacontent.h
index 244715b41..983df47ef 100644
--- a/src/multimedia/playback/qmediacontent.h
+++ b/src/multimedia/playback/qmediacontent.h
@@ -43,8 +43,7 @@
#include <QtCore/qmetatype.h>
#include <QtCore/qshareddata.h>
-#include <QtMultimedia/qmediaresource.h>
-
+#include <QNetworkRequest>
#include <QtMultimedia/qtmultimediaglobal.h>
QT_BEGIN_NAMESPACE
@@ -58,10 +57,6 @@ public:
QMediaContent();
QMediaContent(const QUrl &contentUrl);
QMediaContent(const QNetworkRequest &contentRequest);
-#if QT_DEPRECATED_SINCE(6, 0)
- QT_DEPRECATED QMediaContent(const QMediaResource &contentResource);
- QT_DEPRECATED QMediaContent(const QMediaResourceList &resources);
-#endif
QMediaContent(const QMediaContent &other);
QMediaContent(QMediaPlaylist *playlist, const QUrl &contentUrl = QUrl(), bool takeOwnership = false);
~QMediaContent();
@@ -74,13 +69,6 @@ public:
bool isNull() const;
QNetworkRequest request() const;
-#if QT_DEPRECATED_SINCE(6, 0)
- QT_DEPRECATED_X("Use QMediaContent::request().url()") QUrl canonicalUrl() const;
- QT_DEPRECATED_X("Use QMediaContent::request()") QNetworkRequest canonicalRequest() const;
- QT_DEPRECATED QMediaResource canonicalResource() const;
- QT_DEPRECATED QMediaResourceList resources() const;
-#endif
-
QMediaPlaylist *playlist() const;
private:
QSharedDataPointer<QMediaContentPrivate> d;
diff --git a/src/multimedia/playback/qmediaresource.cpp b/src/multimedia/playback/qmediaresource.cpp
deleted file mode 100644
index 97d42bd0b..000000000
--- a/src/multimedia/playback/qmediaresource.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qmediaresource.h"
-
-#include <QtCore/qsize.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-static void qRegisterMediaResourceMetaTypes()
-{
- qRegisterMetaType<QMediaResource>();
- qRegisterMetaType<QMediaResourceList>();
-}
-
-Q_CONSTRUCTOR_FUNCTION(qRegisterMediaResourceMetaTypes)
-
-
-/*!
- \class QMediaResource
-
- \brief The QMediaResource class provides a description of a media resource.
- \inmodule QtMultimedia
- \ingroup multimedia
- \ingroup multimedia_playback
- \obsolete
-
- A media resource is composed of a \l {url()}{URL} containing the
- location of the resource and a set of properties that describe the
- format of the resource. The properties provide a means to assess a
- resource without first attempting to load it, and in situations where
- media be represented by multiple alternative representations provide a
- means to select the appropriate resource.
-
- Media made available by a remote services can often be available in
- multiple encodings or quality levels, this allows a client to select
- an appropriate resource based on considerations such as codecs supported,
- network bandwidth, and display constraints. QMediaResource includes
- information such as the \l {mimeType()}{MIME type}, \l {audioCodec()}{audio}
- and \l {videoCodec()}{video} codecs, \l {audioBitRate()}{audio} and
- \l {videoBitRate()}{video} bit rates, and \l {resolution()}{resolution}
- so these constraints and others can be evaluated.
-
- The only mandatory property of a QMediaResource is the url().
-
- \sa QMediaContent
-*/
-
-/*!
- \typedef QMediaResourceList
-
- Synonym for \c QList<QMediaResource>
-
- \relates QMediaResource
-*/
-
-/*!
- Constructs a null media resource.
-*/
-QMediaResource::QMediaResource()
-{
-}
-
-/*!
- Constructs a media resource with the given \a mimeType from a \a url.
-*/
-QMediaResource::QMediaResource(const QUrl &url, const QString &mimeType)
-{
- values.insert(Url, url);
- values.insert(MimeType, mimeType);
-}
-
-/*!
- Constructs a media resource with the given \a mimeType from a network \a request.
-*/
-QMediaResource::QMediaResource(const QNetworkRequest &request, const QString &mimeType)
-{
- values.insert(Request, QVariant::fromValue(request));
- values.insert(Url, request.url());
- values.insert(MimeType, mimeType);
-}
-
-/*!
- Constructs a copy of a media resource \a other.
-*/
-QMediaResource::QMediaResource(const QMediaResource &other)
- : values(other.values)
-{
-}
-
-/*!
- Assigns the value of \a other to a media resource.
-*/
-QMediaResource &QMediaResource::operator =(const QMediaResource &other)
-{
- values = other.values;
-
- return *this;
-}
-
-/*!
- Destroys a media resource.
-*/
-QMediaResource::~QMediaResource()
-{
-}
-
-
-/*!
- Compares a media resource to \a other.
-
- Returns true if the resources are identical, and false otherwise.
-*/
-bool QMediaResource::operator ==(const QMediaResource &other) const
-{
- // Compare requests directly as QNetworkRequests are "custom types".
- for (auto it = values.cbegin(), end = values.cend(); it != end; ++it) {
- switch (it.key()) {
- case Request:
- if (request() != other.request())
- return false;
- break;
- default:
- if (it.value() != other.values.value(it.key()))
- return false;
- }
- }
- return true;
-}
-
-/*!
- Compares a media resource to \a other.
-
- Returns true if they are different, and false otherwise.
-*/
-bool QMediaResource::operator !=(const QMediaResource &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Identifies if a media resource is null.
-
- Returns true if the resource is null, and false otherwise.
-*/
-bool QMediaResource::isNull() const
-{
- return values.isEmpty();
-}
-
-/*!
- Returns the URL of a media resource.
-*/
-QUrl QMediaResource::url() const
-{
- return qvariant_cast<QUrl>(values.value(Url));
-}
-
-/*!
- Returns the network request associated with this media resource.
-*/
-QNetworkRequest QMediaResource::request() const
-{
- if(values.contains(Request))
- return qvariant_cast<QNetworkRequest>(values.value(Request));
-
- return QNetworkRequest(url());
-}
-
-/*!
- Returns the MIME type of a media resource.
-
- This may be null if the MIME type is unknown.
-*/
-QString QMediaResource::mimeType() const
-{
- return qvariant_cast<QString>(values.value(MimeType));
-}
-
-/*!
- Returns the language of a media resource as an ISO 639-2 code.
-
- This may be null if the language is unknown.
-*/
-QString QMediaResource::language() const
-{
- return qvariant_cast<QString>(values.value(Language));
-}
-
-/*!
- Sets the \a language of a media resource.
-*/
-void QMediaResource::setLanguage(const QString &language)
-{
- if (!language.isNull())
- values.insert(Language, language);
- else
- values.remove(Language);
-}
-
-/*!
- Returns the audio codec of a media resource.
-
- This may be null if the media resource does not contain an audio stream, or the codec is
- unknown.
-*/
-QString QMediaResource::audioCodec() const
-{
- return qvariant_cast<QString>(values.value(AudioCodec));
-}
-
-/*!
- Sets the audio \a codec of a media resource.
-*/
-void QMediaResource::setAudioCodec(const QString &codec)
-{
- if (!codec.isNull())
- values.insert(AudioCodec, codec);
- else
- values.remove(AudioCodec);
-}
-
-/*!
- Returns the video codec of a media resource.
-
- This may be null if the media resource does not contain a video stream, or the codec is
- unknonwn.
-*/
-QString QMediaResource::videoCodec() const
-{
- return qvariant_cast<QString>(values.value(VideoCodec));
-}
-
-/*!
- Sets the video \a codec of media resource.
-*/
-void QMediaResource::setVideoCodec(const QString &codec)
-{
- if (!codec.isNull())
- values.insert(VideoCodec, codec);
- else
- values.remove(VideoCodec);
-}
-
-/*!
- Returns the size in bytes of a media resource.
-
- This may be zero if the size is unknown.
-*/
-qint64 QMediaResource::dataSize() const
-{
- return qvariant_cast<qint64>(values.value(DataSize));
-}
-
-/*!
- Sets the \a size in bytes of a media resource.
-*/
-void QMediaResource::setDataSize(const qint64 size)
-{
- if (size != 0)
- values.insert(DataSize, size);
- else
- values.remove(DataSize);
-}
-
-/*!
- Returns the bit rate in bits per second of a media resource's audio stream.
-
- This may be zero if the bit rate is unknown, or the resource contains no audio stream.
-*/
-int QMediaResource::audioBitRate() const
-{
- return values.value(AudioBitRate).toInt();
-}
-
-/*!
- Sets the bit \a rate in bits per second of a media resource's video stream.
-*/
-void QMediaResource::setAudioBitRate(int rate)
-{
- if (rate != 0)
- values.insert(AudioBitRate, rate);
- else
- values.remove(AudioBitRate);
-}
-
-/*!
- Returns the audio sample rate of a media resource.
-
- This may be zero if the sample size is unknown, or the resource contains no audio stream.
-*/
-int QMediaResource::sampleRate() const
-{
- return qvariant_cast<int>(values.value(SampleRate));
-}
-
-/*!
- Sets the audio \a sampleRate of a media resource.
-*/
-void QMediaResource::setSampleRate(int sampleRate)
-{
- if (sampleRate != 0)
- values.insert(SampleRate, sampleRate);
- else
- values.remove(SampleRate);
-}
-
-/*!
- Returns the number of audio channels in a media resource.
-
- This may be zero if the sample size is unknown, or the resource contains no audio stream.
-*/
-int QMediaResource::channelCount() const
-{
- return qvariant_cast<int>(values.value(ChannelCount));
-}
-
-/*!
- Sets the number of audio \a channels in a media resource.
-*/
-void QMediaResource::setChannelCount(int channels)
-{
- if (channels != 0)
- values.insert(ChannelCount, channels);
- else
- values.remove(ChannelCount);
-}
-
-/*!
- Returns the bit rate in bits per second of a media resource's video stream.
-
- This may be zero if the bit rate is unknown, or the resource contains no video stream.
-*/
-int QMediaResource::videoBitRate() const
-{
- return values.value(VideoBitRate).toInt();
-}
-
-/*!
- Sets the bit \a rate in bits per second of a media resource's video stream.
-*/
-void QMediaResource::setVideoBitRate(int rate)
-{
- if (rate != 0)
- values.insert(VideoBitRate, rate);
- else
- values.remove(VideoBitRate);
-}
-
-/*!
- Returns the resolution in pixels of a media resource.
-
- This may be null is the resolution is unknown, or the resource contains no pixel data (i.e. the
- resource is an audio stream.
-*/
-QSize QMediaResource::resolution() const
-{
- return qvariant_cast<QSize>(values.value(Resolution));
-}
-
-/*!
- Sets the \a resolution in pixels of a media resource.
-*/
-void QMediaResource::setResolution(const QSize &resolution)
-{
- if (resolution.width() != -1 || resolution.height() != -1)
- values.insert(Resolution, resolution);
- else
- values.remove(Resolution);
-}
-
-/*!
- Sets the \a width and \a height in pixels of a media resource.
-*/
-void QMediaResource::setResolution(int width, int height)
-{
- if (width != -1 || height != -1)
- values.insert(Resolution, QSize(width, height));
- else
- values.remove(Resolution);
-}
-QT_END_NAMESPACE
diff --git a/src/multimedia/playback/qmediaresource.h b/src/multimedia/playback/qmediaresource.h
deleted file mode 100644
index 9740166c6..000000000
--- a/src/multimedia/playback/qmediaresource.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#ifndef QMEDIARESOURCE_H
-#define QMEDIARESOURCE_H
-
-#include <QtCore/qmap.h>
-#include <QtCore/qmetatype.h>
-#include <QtNetwork/qnetworkrequest.h>
-
-#include <QtMultimedia/qtmultimediaglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-// Class forward declaration required for QDoc bug
-class QString;
-class Q_MULTIMEDIA_EXPORT QMediaResource
-{
-public:
- QMediaResource();
- QMediaResource(const QUrl &url, const QString &mimeType = QString());
- QMediaResource(const QNetworkRequest &request, const QString &mimeType = QString());
- QMediaResource(const QMediaResource &other);
- QMediaResource &operator =(const QMediaResource &other);
- ~QMediaResource();
-
- bool isNull() const;
-
- bool operator ==(const QMediaResource &other) const;
- bool operator !=(const QMediaResource &other) const;
-
- QUrl url() const;
- QNetworkRequest request() const;
- QString mimeType() const;
-
- QString language() const;
- void setLanguage(const QString &language);
-
- QString audioCodec() const;
- void setAudioCodec(const QString &codec);
-
- QString videoCodec() const;
- void setVideoCodec(const QString &codec);
-
- qint64 dataSize() const;
- void setDataSize(const qint64 size);
-
- int audioBitRate() const;
- void setAudioBitRate(int rate);
-
- int sampleRate() const;
- void setSampleRate(int frequency);
-
- int channelCount() const;
- void setChannelCount(int channels);
-
- int videoBitRate() const;
- void setVideoBitRate(int rate);
-
- QSize resolution() const;
- void setResolution(const QSize &resolution);
- void setResolution(int width, int height);
-
-
-private:
- enum Property
- {
- Url,
- Request,
- MimeType,
- Language,
- AudioCodec,
- VideoCodec,
- DataSize,
- AudioBitRate,
- VideoBitRate,
- SampleRate,
- ChannelCount,
- Resolution
- };
- QMap<int, QVariant> values;
-};
-
-typedef QList<QMediaResource> QMediaResourceList;
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaResource)
-Q_DECLARE_METATYPE(QMediaResourceList)
-
-#endif
diff --git a/src/multimedia/playback/qplaylistfileparser.cpp b/src/multimedia/playback/qplaylistfileparser.cpp
index 9af447032..16934a3dd 100644
--- a/src/multimedia/playback/qplaylistfileparser.cpp
+++ b/src/multimedia/playback/qplaylistfileparser.cpp
@@ -47,7 +47,6 @@
#include "qmediaobject_p.h"
#include "qmediametadata.h"
#include "qmediacontent.h"
-#include "qmediaresource.h"
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/coreaudio/coreaudiodeviceinfo.mm b/src/plugins/coreaudio/coreaudiodeviceinfo.mm
index 1a79438cb..594ea225b 100644
--- a/src/plugins/coreaudio/coreaudiodeviceinfo.mm
+++ b/src/plugins/coreaudio/coreaudiodeviceinfo.mm
@@ -189,7 +189,7 @@ QList<int> CoreAudioDeviceInfo::supportedSampleRates()
//with available hardware
sampleRates << 8000 << 11025 << 22050 << 44100 << 48000;
#endif
- return sampleRates.toList();
+ return sampleRates.values();
}
diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h
index 69b4b0a6c..e0b011f4a 100644
--- a/src/plugins/directshow/player/directshowplayerservice.h
+++ b/src/plugins/directshow/player/directshowplayerservice.h
@@ -43,7 +43,6 @@
#include <dshow.h>
#include "qmediaplayer.h"
-#include "qmediaresource.h"
#include "qmediaservice.h"
#include "qmediatimerange.h"
diff --git a/src/plugins/m3u/qm3uhandler.cpp b/src/plugins/m3u/qm3uhandler.cpp
index 5e05994ef..df1f3fd7e 100644
--- a/src/plugins/m3u/qm3uhandler.cpp
+++ b/src/plugins/m3u/qm3uhandler.cpp
@@ -38,7 +38,6 @@
****************************************************************************/
#include "qm3uhandler.h"
-#include <qmediaresource.h>
#include <QtCore/qiodevice.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qtextstream.h>
diff --git a/src/plugins/qnx/camera/bbcameraorientationhandler.cpp b/src/plugins/qnx/camera/bbcameraorientationhandler.cpp
index eee0f2581..a4c7b43ba 100644
--- a/src/plugins/qnx/camera/bbcameraorientationhandler.cpp
+++ b/src/plugins/qnx/camera/bbcameraorientationhandler.cpp
@@ -76,7 +76,11 @@ BbCameraOrientationHandler::~BbCameraOrientationHandler()
QCoreApplication::eventDispatcher()->removeNativeEventFilter(this);
}
-bool BbCameraOrientationHandler::nativeEventFilter(const QByteArray&, void *message, long*)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+bool BbCameraOrientationHandler::nativeEventFilter(const QByteArray&, void *message, qintptr *)
+#else
+bool BbCameraOrientationHandler::nativeEventFilter(const QByteArray&, void *message, long *)
+#endif
{
bps_event_t* const event = static_cast<bps_event_t*>(message);
if (!event || bps_event_get_domain(event) != orientation_get_domain())
diff --git a/src/plugins/qnx/camera/bbcameraorientationhandler.h b/src/plugins/qnx/camera/bbcameraorientationhandler.h
index 006a259cc..a98582d84 100644
--- a/src/plugins/qnx/camera/bbcameraorientationhandler.h
+++ b/src/plugins/qnx/camera/bbcameraorientationhandler.h
@@ -51,7 +51,11 @@ public:
explicit BbCameraOrientationHandler(QObject *parent = 0);
~BbCameraOrientationHandler();
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
+#else
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
+#endif
int orientation() const;
diff --git a/src/plugins/qnx/common/windowgrabber.cpp b/src/plugins/qnx/common/windowgrabber.cpp
index 9a65ad3a0..f431f98a2 100644
--- a/src/plugins/qnx/common/windowgrabber.cpp
+++ b/src/plugins/qnx/common/windowgrabber.cpp
@@ -189,7 +189,11 @@ bool WindowGrabber::handleScreenEvent(screen_event_t screen_event)
return false;
}
-bool WindowGrabber::nativeEventFilter(const QByteArray &eventType, void *message, long*)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+bool WindowGrabber::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *)
+#else
+bool WindowGrabber::nativeEventFilter(const QByteArray &eventType, void *message, long *)
+#endif
{
if (eventType == "screen_event_t") {
const screen_event_t event = static_cast<screen_event_t>(message);
diff --git a/src/plugins/qnx/common/windowgrabber.h b/src/plugins/qnx/common/windowgrabber.h
index 3ebd0e8a6..5603d9634 100644
--- a/src/plugins/qnx/common/windowgrabber.h
+++ b/src/plugins/qnx/common/windowgrabber.h
@@ -100,7 +100,11 @@ public:
void pause();
void resume();
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
+#else
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
+#endif
bool handleScreenEvent(screen_event_t event);
diff --git a/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.cpp
index c050c03c5..29fd082d8 100644
--- a/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.cpp
+++ b/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.cpp
@@ -113,9 +113,11 @@ void MmrEventMediaPlayerControl::resetMonitoring()
m_speed = 0;
}
-bool MmrEventMediaPlayerControl::nativeEventFilter(const QByteArray &eventType,
- void *message,
- long *result)
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+bool MmrEventMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
+#else
+bool MmrEventMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
+#endif
{
Q_UNUSED(result)
if (eventType == "screen_event_t") {
diff --git a/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.h b/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.h
index 0e4defc5c..cb80ccbfc 100644
--- a/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.h
+++ b/src/plugins/qnx/mediaplayer/mmreventmediaplayercontrol.h
@@ -58,9 +58,11 @@ public:
void stopMonitoring() override;
void resetMonitoring() override;
- bool nativeEventFilter(const QByteArray &eventType,
- void *message,
- long *result) override;
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
+#else
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
+#endif
private Q_SLOTS:
void readEvents();
diff --git a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp
index ee916b750..0ed9f027e 100644
--- a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp
+++ b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp
@@ -299,20 +299,21 @@ public:
DWORD __stdcall GetLength()
{
- return DWORD(d->media.resources().length());
+ return 1;
}
HRESULT __stdcall GetURL(DWORD index, BSTR *url)
{
- const QString resourceUrl = d->media.resources().value(int(index)).url().toString();
+ Q_UNUSED(index);
+ const QString resourceUrl = d->media.request().url().toString();
*url = SysAllocString((const OLECHAR *)resourceUrl.utf16());
return S_OK;
}
HRESULT __stdcall GetType(DWORD index, BSTR *type)
{
- const QString resourceType = d->media.resources().value(int(index)).mimeType();
- *type = SysAllocString((const OLECHAR *)resourceType.utf16());
+ Q_UNUSED(index);
+ *type = SysAllocString(L"");
return S_OK;
}
diff --git a/src/plugins/wmf/player/mfplayerservice.h b/src/plugins/wmf/player/mfplayerservice.h
index 6e3c74fc2..78423c0b1 100644
--- a/src/plugins/wmf/player/mfplayerservice.h
+++ b/src/plugins/wmf/player/mfplayerservice.h
@@ -44,7 +44,6 @@
#include <mfidl.h>
#include "qmediaplayer.h"
-#include "qmediaresource.h"
#include "qmediaservice.h"
#include "qmediatimerange.h"
diff --git a/src/plugins/wmf/player/mfplayersession.h b/src/plugins/wmf/player/mfplayersession.h
index 21fabbd92..c6ffba91f 100644
--- a/src/plugins/wmf/player/mfplayersession.h
+++ b/src/plugins/wmf/player/mfplayersession.h
@@ -44,7 +44,6 @@
#include <mfidl.h>
#include "qmediaplayer.h"
-#include "qmediaresource.h"
#include "qmediaservice.h"
#include "qmediatimerange.h"
diff --git a/src/plugins/wmf/sourceresolver.h b/src/plugins/wmf/sourceresolver.h
index aa104a60e..007552cb0 100644
--- a/src/plugins/wmf/sourceresolver.h
+++ b/src/plugins/wmf/sourceresolver.h
@@ -41,7 +41,7 @@
#define SOURCERESOLVER_H
#include "mfstream.h"
-#include "qmediaresource.h"
+#include <QUrl>
class SourceResolver: public QObject, public IMFAsyncCallback
{
diff --git a/tests/auto/unit/multimedia.pro b/tests/auto/unit/multimedia.pro
index 5c9a831eb..94a6dba89 100644
--- a/tests/auto/unit/multimedia.pro
+++ b/tests/auto/unit/multimedia.pro
@@ -18,7 +18,6 @@ SUBDIRS += \
qmediaplaylistnavigator \
qmediapluginloader \
qmediarecorder \
- qmediaresource \
qmediaservice \
qmediaserviceprovider \
qmediatimerange \
diff --git a/tests/auto/unit/qmediacontent/tst_qmediacontent.cpp b/tests/auto/unit/qmediacontent/tst_qmediacontent.cpp
index 3c68a32b1..53fae3224 100644
--- a/tests/auto/unit/qmediacontent/tst_qmediacontent.cpp
+++ b/tests/auto/unit/qmediacontent/tst_qmediacontent.cpp
@@ -43,16 +43,9 @@ private slots:
void testNull();
void testUrlCtor();
void testRequestCtor();
-#if QT_DEPRECATED_SINCE(6, 0)
- void testResourceCtor();
- void testResourceListCtor();
-#endif
void testCopy();
void testAssignment();
void testEquality();
-#if QT_DEPRECATED_SINCE(6, 0)
- void testResources();
-#endif
void testPlaylist();
};
@@ -62,22 +55,12 @@ void tst_QMediaContent::testNull()
QCOMPARE(media.isNull(), true);
QCOMPARE(media.request().url(), QUrl());
-#if QT_DEPRECATED_SINCE(6, 0)
- QCOMPARE(media.canonicalUrl(), QUrl());
- QCOMPARE(media.canonicalResource(), QMediaResource());
- QCOMPARE(media.resources(), QMediaResourceList());
-#endif
}
void tst_QMediaContent::testUrlCtor()
{
QMediaContent media(QUrl("http://example.com/movie.mov"));
QCOMPARE(media.request().url(), QUrl("http://example.com/movie.mov"));
-
-#if QT_DEPRECATED_SINCE(6, 0)
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-#endif
}
void tst_QMediaContent::testRequestCtor()
@@ -88,34 +71,7 @@ void tst_QMediaContent::testRequestCtor()
QMediaContent media(request);
QCOMPARE(media.request().url(), QUrl("http://example.com/movie.mov"));
QCOMPARE(media.request(), request);
-
-#if QT_DEPRECATED_SINCE(6, 0)
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalRequest(),request);
- QCOMPARE(media.canonicalResource().request(), request);
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
-#endif
-}
-
-#if QT_DEPRECATED_SINCE(6, 0)
-void tst_QMediaContent::testResourceCtor()
-{
- QMediaContent media(QMediaResource(QUrl("http://example.com/movie.mov")));
-
- QCOMPARE(media.canonicalResource(), QMediaResource(QUrl("http://example.com/movie.mov")));
-}
-
-void tst_QMediaContent::testResourceListCtor()
-{
- QMediaResourceList resourceList;
- resourceList << QMediaResource(QUrl("http://example.com/movie.mov"));
-
- QMediaContent media(resourceList);
-
- QCOMPARE(media.canonicalUrl(), QUrl("http://example.com/movie.mov"));
- QCOMPARE(media.canonicalResource().url(), QUrl("http://example.com/movie.mov"));
}
-#endif
void tst_QMediaContent::testCopy()
{
@@ -163,22 +119,6 @@ void tst_QMediaContent::testEquality()
QCOMPARE(media4 != media5, true);
}
-#if QT_DEPRECATED_SINCE(6, 0)
-void tst_QMediaContent::testResources()
-{
- QMediaResourceList resourceList;
-
- resourceList << QMediaResource(QUrl("http://example.com/movie-main.mov"));
- resourceList << QMediaResource(QUrl("http://example.com/movie-big.mov"));
- QMediaContent media(resourceList);
-
- QMediaResourceList res = media.resources();
- QCOMPARE(res.size(), 2);
- QCOMPARE(res[0], QMediaResource(QUrl("http://example.com/movie-main.mov")));
- QCOMPARE(res[1], QMediaResource(QUrl("http://example.com/movie-big.mov")));
-}
-#endif
-
void tst_QMediaContent::testPlaylist()
{
QMediaContent media(QUrl("http://example.com/movie.mov"));
diff --git a/tests/auto/unit/qmediaresource/qmediaresource.pro b/tests/auto/unit/qmediaresource/qmediaresource.pro
deleted file mode 100644
index e728fb4f5..000000000
--- a/tests/auto/unit/qmediaresource/qmediaresource.pro
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qmediaresource
-
-QT += network multimedia-private testlib
-
-SOURCES += tst_qmediaresource.cpp
-
diff --git a/tests/auto/unit/qmediaresource/tst_qmediaresource.cpp b/tests/auto/unit/qmediaresource/tst_qmediaresource.cpp
deleted file mode 100644
index 786570bec..000000000
--- a/tests/auto/unit/qmediaresource/tst_qmediaresource.cpp
+++ /dev/null
@@ -1,697 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** 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-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include <QtTest/QtTest>
-
-#include "qmediaresource.h"
-
-QT_USE_NAMESPACE
-class tst_QMediaResource : public QObject
-{
- Q_OBJECT
-private slots:
-#if QT_DEPRECATED_SINCE(6, 0)
- void constructNull();
- void construct_data();
- void construct();
- void setResolution();
- void equality();
- void copy();
- void assign();
-
- void constructorRequest();
- void copyConstructor();
-#else
- void initTestCase()
- {
- QSKIP("Skipping this test, QMediaResource is deprecated.");
- }
-#endif
-};
-
-#if QT_DEPRECATED_SINCE(6, 0)
-void tst_QMediaResource::constructNull()
-{
- QMediaResource resource;
-
- QCOMPARE(resource.isNull(), true);
- QCOMPARE(resource.url(), QUrl());
- QCOMPARE(resource.request(), QNetworkRequest());
- QCOMPARE(resource.mimeType(), QString());
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-}
-
-void tst_QMediaResource::construct_data()
-{
- QTest::addColumn<QUrl>("url");
- QTest::addColumn<QNetworkRequest>("request");
- QTest::addColumn<QString>("mimeType");
- QTest::addColumn<QString>("language");
- QTest::addColumn<QString>("audioCodec");
- QTest::addColumn<QString>("videoCodec");
- QTest::addColumn<qint64>("dataSize");
- QTest::addColumn<int>("audioBitRate");
- QTest::addColumn<int>("sampleRate");
- QTest::addColumn<int>("channelCount");
- QTest::addColumn<int>("videoBitRate");
- QTest::addColumn<QSize>("resolution");
-
- QTest::newRow("audio content")
- << QUrl(QString::fromLatin1("http:://test.com/test.mp3"))
- << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.mp3")))
- << QString::fromLatin1("audio/mpeg")
- << QString::fromLatin1("eng")
- << QString::fromLatin1("mp3")
- << QString()
- << qint64(5465433)
- << 128000
- << 44100
- << 2
- << 0
- << QSize();
- QTest::newRow("image content")
- << QUrl(QString::fromLatin1("http:://test.com/test.jpg"))
- << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.jpg")))
- << QString::fromLatin1("image/jpeg")
- << QString()
- << QString()
- << QString()
- << qint64(23600)
- << 0
- << 0
- << 0
- << 0
- << QSize(640, 480);
- QTest::newRow("video content")
- << QUrl(QString::fromLatin1("http:://test.com/test.mp4"))
- << QNetworkRequest(QUrl(QString::fromLatin1("http:://test.com/test.mp4")))
- << QString::fromLatin1("video/mp4")
- << QString()
- << QString::fromLatin1("aac")
- << QString::fromLatin1("h264")
- << qint64(36245851)
- << 96000
- << 44000
- << 5
- << 750000
- << QSize(720, 576);
- QTest::newRow("thumbnail")
- << QUrl(QString::fromLatin1("file::///thumbs/test.png"))
- << QNetworkRequest(QUrl(QString::fromLatin1("file::///thumbs/test.png")))
- << QString::fromLatin1("image/png")
- << QString()
- << QString()
- << QString()
- << qint64(2360)
- << 0
- << 0
- << 0
- << 0
- << QSize(128, 128);
-}
-
-void tst_QMediaResource::construct()
-{
- QFETCH(QUrl, url);
- QFETCH(QNetworkRequest, request);
- QFETCH(QString, mimeType);
- QFETCH(QString, language);
- QFETCH(QString, audioCodec);
- QFETCH(QString, videoCodec);
- QFETCH(qint64, dataSize);
- QFETCH(int, audioBitRate);
- QFETCH(int, sampleRate);
- QFETCH(int, channelCount);
- QFETCH(int, videoBitRate);
- QFETCH(QSize, resolution);
-
- {
- QMediaResource resource(url);
-
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.mimeType(), QString());
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
- }
- {
- QMediaResource resource(url, mimeType);
-
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.request(), request);
- QCOMPARE(resource.mimeType(), mimeType);
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-
- resource.setLanguage(language);
- resource.setAudioCodec(audioCodec);
- resource.setVideoCodec(videoCodec);
- resource.setDataSize(dataSize);
- resource.setAudioBitRate(audioBitRate);
- resource.setSampleRate(sampleRate);
- resource.setChannelCount(channelCount);
- resource.setVideoBitRate(videoBitRate);
- resource.setResolution(resolution);
-
- QCOMPARE(resource.language(), language);
- QCOMPARE(resource.audioCodec(), audioCodec);
- QCOMPARE(resource.videoCodec(), videoCodec);
- QCOMPARE(resource.dataSize(), dataSize);
- QCOMPARE(resource.audioBitRate(), audioBitRate);
- QCOMPARE(resource.sampleRate(), sampleRate);
- QCOMPARE(resource.channelCount(), channelCount);
- QCOMPARE(resource.videoBitRate(), videoBitRate);
- QCOMPARE(resource.resolution(), resolution);
- }
- {
- QMediaResource resource(request, mimeType);
-
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.request(), request);
- QCOMPARE(resource.mimeType(), mimeType);
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-
- resource.setLanguage(language);
- resource.setAudioCodec(audioCodec);
- resource.setVideoCodec(videoCodec);
- resource.setDataSize(dataSize);
- resource.setAudioBitRate(audioBitRate);
- resource.setSampleRate(sampleRate);
- resource.setChannelCount(channelCount);
- resource.setVideoBitRate(videoBitRate);
- resource.setResolution(resolution);
-
- QCOMPARE(resource.language(), language);
- QCOMPARE(resource.audioCodec(), audioCodec);
- QCOMPARE(resource.videoCodec(), videoCodec);
- QCOMPARE(resource.dataSize(), dataSize);
- QCOMPARE(resource.audioBitRate(), audioBitRate);
- QCOMPARE(resource.sampleRate(), sampleRate);
- QCOMPARE(resource.channelCount(), channelCount);
- QCOMPARE(resource.videoBitRate(), videoBitRate);
- QCOMPARE(resource.resolution(), resolution);
- }
-}
-
-void tst_QMediaResource::setResolution()
-{
- QMediaResource resource(
- QUrl(QString::fromLatin1("file::///thumbs/test.png")),
- QString::fromLatin1("image/png"));
-
- QCOMPARE(resource.resolution(), QSize());
-
- resource.setResolution(QSize(120, 80));
- QCOMPARE(resource.resolution(), QSize(120, 80));
-
- resource.setResolution(QSize(-1, 23));
- QCOMPARE(resource.resolution(), QSize(-1, 23));
-
- resource.setResolution(QSize(-43, 34));
- QCOMPARE(resource.resolution(), QSize(-43, 34));
-
- resource.setResolution(QSize(64, -1));
- QCOMPARE(resource.resolution(), QSize(64, -1));
-
- resource.setResolution(QSize(64, -83));
- QCOMPARE(resource.resolution(), QSize(64, -83));
-
- resource.setResolution(QSize(-12, -83));
- QCOMPARE(resource.resolution(), QSize(-12, -83));
-
- resource.setResolution(QSize());
- QCOMPARE(resource.resolution(), QSize(-1, -1));
-
- resource.setResolution(120, 80);
- QCOMPARE(resource.resolution(), QSize(120, 80));
-
- resource.setResolution(-1, 23);
- QCOMPARE(resource.resolution(), QSize(-1, 23));
-
- resource.setResolution(-43, 34);
- QCOMPARE(resource.resolution(), QSize(-43, 34));
-
- resource.setResolution(64, -1);
- QCOMPARE(resource.resolution(), QSize(64, -1));
-
- resource.setResolution(64, -83);
- QCOMPARE(resource.resolution(), QSize(64, -83));
-
- resource.setResolution(-12, -83);
- QCOMPARE(resource.resolution(), QSize(-12, -83));
-
- resource.setResolution(-1, -1);
- QCOMPARE(resource.resolution(), QSize());
-}
-
-void tst_QMediaResource::equality()
-{
- QMediaResource resource1(
- QUrl(QString::fromLatin1("http://test.com/test.mp4")),
- QString::fromLatin1("video/mp4"));
- QMediaResource resource2(
- QUrl(QString::fromLatin1("http://test.com/test.mp4")),
- QString::fromLatin1("video/mp4"));
- QMediaResource resource3(
- QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
- QMediaResource resource4(
- QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
- QMediaResource resource5(
- QUrl(QString::fromLatin1("http://test.com/test.mp3")),
- QString::fromLatin1("audio/mpeg"));
-
- QNetworkRequest request(QUrl("http://test.com/test.mp3"));
- QString requestMimeType("audio/mp3");
-
- QMediaResource requestResource1(request, requestMimeType);
- QMediaResource requestResource2(request, requestMimeType);
-
- QCOMPARE(requestResource1 == requestResource2, true);
- QCOMPARE(requestResource1 != requestResource2, false);
- QCOMPARE(requestResource1 != resource5, true);
-
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- QCOMPARE(resource3 == resource4, true);
- QCOMPARE(resource3 != resource4, false);
-
- QCOMPARE(resource1 == resource3, false);
- QCOMPARE(resource1 != resource3, true);
-
- QCOMPARE(resource1 == resource5, false);
- QCOMPARE(resource1 != resource5, true);
-
- resource1.setAudioCodec(QString::fromLatin1("mp3"));
- resource2.setAudioCodec(QString::fromLatin1("aac"));
-
- // Not equal differing audio codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource1.setAudioCodec(QString::fromLatin1("aac"));
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setVideoCodec(QString());
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setVideoCodec(QString::fromLatin1("h264"));
-
- // Not equal differing video codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setVideoCodec(QString::fromLatin1("h264"));
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource2.setDataSize(0);
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setDataSize(546423);
-
- // Not equal differing video codecs.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setDataSize(546423);
-
- // Equal.
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setAudioBitRate(96000);
- resource1.setSampleRate(48000);
- resource2.setSampleRate(44100);
- resource1.setChannelCount(0);
- resource1.setVideoBitRate(900000);
- resource2.setLanguage(QString::fromLatin1("eng"));
-
- // Not equal, audio bit rate, sample rate, video bit rate, and
- // language.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setAudioBitRate(96000);
- resource1.setSampleRate(44100);
-
- // Not equal, differing video bit rate, and language.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource2.setVideoBitRate(900000);
- resource1.setLanguage(QString::fromLatin1("eng"));
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setResolution(QSize());
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource2.setResolution(-1, -1);
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- resource1.setResolution(QSize(-640, -480));
-
- // Not equal, differing resolution.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
- resource1.setResolution(QSize(640, 480));
- resource2.setResolution(QSize(800, 600));
-
- // Not equal, differing resolution.
- QCOMPARE(resource1 == resource2, false);
- QCOMPARE(resource1 != resource2, true);
-
- resource1.setResolution(800, 600);
-
- // Equal
- QCOMPARE(resource1 == resource2, true);
- QCOMPARE(resource1 != resource2, false);
-
- /* equality tests for constructor of QMediaresource(QNetworkrequest,mimeType)*/
- QNetworkRequest request2(QUrl(QString::fromLatin1("http://test.com/test.mp4")));
- QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- QString mimeType(QLatin1String("video/mp4"));
-
- QMediaResource resource6(request2,mimeType);
- QMediaResource resource7(request2,mimeType);
-
-
- QVERIFY(resource6.request()==request2);
- QVERIFY(resource6.mimeType()==mimeType);
-
-
- QVERIFY(resource7.request()==request2);
- QVERIFY(resource7.mimeType()==mimeType);
-
- QVERIFY(resource6.request()==resource7.request());
- QVERIFY(resource6.mimeType()==resource7.mimeType());
-
- QVERIFY(resource6==resource7);
-
- /*for copy constructor*/
- QMediaResource resource8(resource7);
-
- QVERIFY(resource8.request()==request2);
- QVERIFY(resource8.mimeType()==mimeType);
-
-
- QVERIFY(resource7.request()==request2);
- QVERIFY(resource7.mimeType()==mimeType);
-
- QVERIFY(resource8.request()==resource7.request());
- QVERIFY(resource8.mimeType()==resource7.mimeType());
-
-
- QVERIFY(resource8==resource7);
-
- /*for assign constructor*/
-
- QMediaResource resource9(request2,mimeType);
-
- QMediaResource resource10=resource9;
-
- QVERIFY(resource10.request()==request2);
- QVERIFY(resource10.mimeType()==mimeType);
-
-
- QVERIFY(resource9.request()==request2);
- QVERIFY(resource9.mimeType()==mimeType);
-
- QVERIFY(resource8.request()==resource7.request());
- QVERIFY(resource8.mimeType()==resource7.mimeType());
-
- QVERIFY(resource8==resource7);
-}
-
-void tst_QMediaResource::copy()
-{
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString mp3Codec(QLatin1String("mp3"));
- const QString aacCodec(QLatin1String("aac"));
- const QString h264Codec(QLatin1String("h264"));
-
- QMediaResource original(url, mimeType);
- original.setAudioCodec(amrCodec);
-
- QMediaResource copy(original);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- original.setAudioCodec(mp3Codec);
-
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-
- copy.setAudioCodec(aacCodec);
- copy.setVideoCodec(h264Codec);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
-
- QCOMPARE(original.audioCodec(), mp3Codec);
-}
-
-void tst_QMediaResource::assign()
-{
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString mp3Codec(QLatin1String("mp3"));
- const QString aacCodec(QLatin1String("aac"));
- const QString h264Codec(QLatin1String("h264"));
-
- QNetworkRequest request(QUrl(QString::fromLatin1("http://test.com/test.mp4")));
- const qint64 dataSize(23600);
- int audioBitRate = 1, sampleRate = 2, channelCount = 3, videoBitRate = 4;
- QSize resolution(QSize(640, 480));
- QString language("eng");
-
- QMediaResource copy(QUrl(QString::fromLatin1("file:///thumbs/test.jpg")));
-
- QMediaResource original(url, mimeType);
- original.setAudioCodec(amrCodec);
-
- copy = original;
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
-
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- original.setAudioCodec(mp3Codec);
-
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(original == copy, false);
- QCOMPARE(original != copy, true);
-
- copy.setAudioCodec(aacCodec);
- copy.setVideoCodec(h264Codec);
-
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
-
- QCOMPARE(original.audioCodec(), mp3Codec);
-
- /* for constructor of QMediaresource(QNetworkrequest,mimeType)*/
-
- QMediaResource copy1(QNetworkRequest(QUrl(QString::fromLatin1("file:///thumbs/test.jpg"))));
-
- QMediaResource original1(request, mimeType);
-
- original1.setAudioCodec(amrCodec);
- original1.setLanguage(QString("eng"));
- original1.setVideoCodec(h264Codec);
- original1.setDataSize(dataSize);
- original1.setAudioBitRate(audioBitRate);
- original1.setSampleRate(sampleRate);
- original1.setChannelCount(channelCount);
- original1.setVideoBitRate(videoBitRate);
- original1.setResolution(resolution);
-
- copy1 = original1;
-
- QCOMPARE(original1 == copy1, true);
-}
-
-// Constructor for request without passing mimetype.
-void tst_QMediaResource::constructorRequest()
-{
- //Initialise the request and url.
- QNetworkRequest request(QUrl(QString::fromLatin1("http:://test.com/test.mp3")));
- QUrl url(QString::fromLatin1("http:://test.com/test.mp3"));
-
- // Create the instance with request as parameter.
- QMediaResource resource(request);
-
- // Verify all the parameters of objects.
- QCOMPARE(resource.isNull(), false);
- QCOMPARE(resource.url(), url);
- QCOMPARE(resource.request(), request);
- QCOMPARE(resource.mimeType(), QString());
- QCOMPARE(resource.language(), QString());
- QCOMPARE(resource.audioCodec(), QString());
- QCOMPARE(resource.videoCodec(), QString());
- QCOMPARE(resource.dataSize(), qint64(0));
- QCOMPARE(resource.audioBitRate(), 0);
- QCOMPARE(resource.sampleRate(), 0);
- QCOMPARE(resource.channelCount(), 0);
- QCOMPARE(resource.videoBitRate(), 0);
- QCOMPARE(resource.resolution(), QSize());
-}
-
-// Copy constructor with all the parameter and copy constructor for constructor with request and mimetype as parameter.
-void tst_QMediaResource::copyConstructor()
-{
- // Initialise all the parameters.
- const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
- const QString mimeType(QLatin1String("video/mp4"));
- const QString amrCodec(QLatin1String("amr"));
- const QString h264Codec(QLatin1String("h264"));
-
- const qint64 dataSize(23600);
- int audioBitRate = 1, sampleRate = 2, channelCount = 3, videoBitRate = 4;
- QSize resolution(QSize(640, 480));
- QString language("eng");
-
- // Create the instance with url and mimetype.
- QMediaResource original(url, mimeType);
-
- // Set all the parameters.
- original.setAudioCodec(amrCodec);
- original.setLanguage(QString("eng"));
- original.setVideoCodec(h264Codec);
- original.setDataSize(dataSize);
- original.setAudioBitRate(audioBitRate);
- original.setSampleRate(sampleRate);
- original.setChannelCount(channelCount);
- original.setVideoBitRate(videoBitRate);
- original.setResolution(resolution);
-
- // Copy the instance to new object.
- QMediaResource copy(original);
-
- // Verify all the parameters of the copied object.
- QCOMPARE(copy.url(), url);
- QCOMPARE(copy.mimeType(), mimeType);
- QCOMPARE(copy.audioCodec(), amrCodec);
- QCOMPARE(copy.language(), language );
- QCOMPARE(copy.videoCodec(), h264Codec);
- QCOMPARE(copy.dataSize(), dataSize);
- QCOMPARE(copy.audioBitRate(), audioBitRate);
- QCOMPARE(copy.sampleRate(), sampleRate);
- QCOMPARE(copy.channelCount(), channelCount);
- QCOMPARE(copy.videoBitRate(), videoBitRate);
- QCOMPARE(copy.resolution(), resolution);
-
- // Compare both the objects are equal.
- QCOMPARE(original == copy, true);
- QCOMPARE(original != copy, false);
-
- // Initialise the request parameter.
- QNetworkRequest request1(QUrl(QString::fromLatin1("http://test.com/test.mp4")));
-
- // Constructor with rerquest and mimetype.
- QMediaResource original1(request1, mimeType);
-
- // Copy the object and verify if both are eqaul or not.
- QMediaResource copy1(original1);
- QCOMPARE(copy1.url(), url);
- QCOMPARE(copy1.mimeType(), mimeType);
- QCOMPARE(copy1.request(), request1);
- QCOMPARE(original1 == copy1, true);
-}
-
-#endif // QT_DEPRECATED_SINCE(6, 0)
-
-QTEST_MAIN(tst_QMediaResource)
-
-#include "tst_qmediaresource.moc"