summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--examples/multimedia/spectrum/app/engine.cpp19
-rw-r--r--examples/multimedia/spectrum/app/engine.h1
-rw-r--r--examples/multimedia/spectrum/app/mainwidget.cpp7
-rw-r--r--examples/multimediawidgets/player/player.cpp4
-rw-r--r--src/gsttools/gsttools.pro15
-rw-r--r--src/gsttools/qgstcodecsinfo.cpp2
-rw-r--r--src/gsttools/qgstreameraudioinputselector.cpp12
-rw-r--r--src/gsttools/qgstutils.cpp70
-rw-r--r--src/imports/audioengine/qdeclarative_playvariation_p.cpp5
-rw-r--r--src/imports/audioengine/qdeclarative_sound_p.cpp3
-rw-r--r--src/multimedia/audio/qaudio.cpp22
-rw-r--r--src/multimedia/audio/qaudio.h2
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.cpp6
-rw-r--r--src/multimedia/camera/qcamera.h5
-rw-r--r--src/multimedia/gsttools_headers/gstvideoconnector_p.h8
-rw-r--r--src/multimedia/gsttools_headers/qgstappsrc_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstcodecsinfo_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h4
-rw-r--r--src/multimedia/gsttools_headers/qgstreamerbushelper_p.h4
-rw-r--r--src/multimedia/gsttools_headers/qgstreamermessage_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideowidget_p.h5
-rw-r--r--src/multimedia/gsttools_headers/qgstreamervideowindow_p.h3
-rw-r--r--src/multimedia/gsttools_headers/qgsttools_global_p.h70
-rw-r--r--src/multimedia/gsttools_headers/qgstutils_p.h87
-rw-r--r--src/multimedia/gsttools_headers/qgstvideobuffer_p.h5
-rw-r--r--src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h7
-rw-r--r--src/multimedia/playback/qmedianetworkplaylistprovider.cpp3
-rw-r--r--src/multimedia/playback/qmediaplaylistnavigator.cpp5
-rw-r--r--src/multimedia/qmediaobject.cpp8
-rw-r--r--src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm6
-rw-r--r--src/plugins/gstreamer/common.pri4
-rw-r--r--src/plugins/qnx-audio/audio/qnxaudiooutput.cpp162
-rw-r--r--src/plugins/qnx-audio/audio/qnxaudiooutput.h20
-rw-r--r--src/plugins/qnx/mediaplayer/mediaplayer.pri2
-rw-r--r--src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp68
-rw-r--r--src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h63
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp47
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h5
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp22
-rw-r--r--src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h2
-rw-r--r--src/plugins/qnx/mediaplayer/mmrendererutil.cpp113
-rw-r--r--src/plugins/qnx/mediaplayer/mmrendererutil.h4
-rw-r--r--src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp2
-rw-r--r--src/plugins/wmf/player/mfmetadatacontrol.cpp7
-rw-r--r--src/qtmultimediaquicktools/qtmultimediaquicktools.pro2
-rw-r--r--sync.profile3
-rw-r--r--tests/auto/integration/multimedia.pro3
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/BLACKLIST8
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro8
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp22
-rw-r--r--tests/auto/integration/qmediaplayerbackend/BLACKLIST14
-rw-r--r--tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro10
-rw-r--r--tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp80
-rw-r--r--tests/auto/integration/shared/mediafileselector.h71
-rw-r--r--tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp30
62 files changed, 921 insertions, 268 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 78a277a3f..138038d54 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,3 +1,3 @@
load(qt_build_config)
-MODULE_VERSION = 5.9.2
+MODULE_VERSION = 5.10.0
diff --git a/examples/multimedia/spectrum/app/engine.cpp b/examples/multimedia/spectrum/app/engine.cpp
index 3a01fa7a7..eae4c8e74 100644
--- a/examples/multimedia/spectrum/app/engine.cpp
+++ b/examples/multimedia/spectrum/app/engine.cpp
@@ -103,6 +103,23 @@ Engine::Engine(QObject *parent)
this,
SLOT(spectrumChanged(FrequencySpectrum)));
+ // This code might misinterpret things like "-something -category". But
+ // it's unlikely that that needs to be supported so we'll let it go.
+ QStringList arguments = QCoreApplication::instance()->arguments();
+ for (int i = 0; i < arguments.count(); ++i) {
+ if (arguments.at(i) == QStringLiteral("--"))
+ break;
+
+ if (arguments.at(i) == QStringLiteral("-category")
+ || arguments.at(i) == QStringLiteral("--category")) {
+ ++i;
+ if (i < arguments.count())
+ m_audioOutputCategory = arguments.at(i);
+ else
+ --i;
+ }
+ }
+
initialize();
#ifdef DUMP_DATA
@@ -494,6 +511,7 @@ bool Engine::initialize()
}
m_audioOutput = new QAudioOutput(m_audioOutputDevice, m_format, this);
m_audioOutput->setNotifyInterval(NotifyIntervalMs);
+ m_audioOutput->setCategory(m_audioOutputCategory);
}
} else {
if (m_file)
@@ -508,6 +526,7 @@ bool Engine::initialize()
ENGINE_DEBUG << "Engine::initialize" << "m_bufferLength" << m_bufferLength;
ENGINE_DEBUG << "Engine::initialize" << "m_dataLength" << m_dataLength;
ENGINE_DEBUG << "Engine::initialize" << "format" << m_format;
+ ENGINE_DEBUG << "Engine::initialize" << "m_audioOutputCategory" << m_audioOutputCategory;
return result;
}
diff --git a/examples/multimedia/spectrum/app/engine.h b/examples/multimedia/spectrum/app/engine.h
index db76d7b42..af08b83cc 100644
--- a/examples/multimedia/spectrum/app/engine.h
+++ b/examples/multimedia/spectrum/app/engine.h
@@ -287,6 +287,7 @@ private:
const QList<QAudioDeviceInfo> m_availableAudioOutputDevices;
QAudioDeviceInfo m_audioOutputDevice;
QAudioOutput* m_audioOutput;
+ QString m_audioOutputCategory;
qint64 m_playPosition;
QBuffer m_audioOutputIODevice;
diff --git a/examples/multimedia/spectrum/app/mainwidget.cpp b/examples/multimedia/spectrum/app/mainwidget.cpp
index a69c85a44..35b92d13e 100644
--- a/examples/multimedia/spectrum/app/mainwidget.cpp
+++ b/examples/multimedia/spectrum/app/mainwidget.cpp
@@ -109,7 +109,9 @@ void MainWidget::stateChanged(QAudio::Mode mode, QAudio::State state)
updateButtonStates();
- if (QAudio::ActiveState != state && QAudio::SuspendedState != state) {
+ if (QAudio::ActiveState != state &&
+ QAudio::SuspendedState != state &&
+ QAudio::InterruptedState != state) {
m_levelMeter->reset();
m_spectrograph->reset();
}
@@ -418,7 +420,8 @@ void MainWidget::updateButtonStates()
const bool playEnabled = (/*m_engine->dataLength() &&*/
(QAudio::AudioOutput != m_engine->mode() ||
(QAudio::ActiveState != m_engine->state() &&
- QAudio::IdleState != m_engine->state())));
+ QAudio::IdleState != m_engine->state() &&
+ QAudio::InterruptedState != m_engine->state())));
m_playButton->setEnabled(playEnabled);
}
diff --git a/examples/multimediawidgets/player/player.cpp b/examples/multimediawidgets/player/player.cpp
index 8f291c501..085dff6a7 100644
--- a/examples/multimediawidgets/player/player.cpp
+++ b/examples/multimediawidgets/player/player.cpp
@@ -60,6 +60,10 @@ Player::Player(QWidget *parent)
{
//! [create-objs]
player = new QMediaPlayer(this);
+ player->setAudioRole(QAudio::VideoRole);
+ qInfo() << "Supported audio roles:";
+ for (QAudio::Role role : player->supportedAudioRoles())
+ qInfo() << " " << role;
// owned by PlaylistModel
playlist = new QMediaPlaylist();
player->setPlaylist(playlist);
diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro
index edbf603e3..f5e3fd96f 100644
--- a/src/gsttools/gsttools.pro
+++ b/src/gsttools/gsttools.pro
@@ -1,7 +1,6 @@
-TEMPLATE = lib
-
-TARGET = qgsttools_p
-QPRO_PWD = $$PWD
+TARGET = QtMultimediaGstTools
+MODULE = multimediagsttools
+CONFIG += internal_module
QT = core-private multimedia-private gui-private
@@ -36,7 +35,8 @@ PRIVATE_HEADERS += \
qgstreamervideoprobecontrol_p.h \
qgstreameraudioprobecontrol_p.h \
qgstreamervideowindow_p.h \
- qgstreamervideooverlay_p.h
+ qgstreamervideooverlay_p.h \
+ qgsttools_global_p.h
SOURCES += \
qgstreamerbushelper.cpp \
@@ -101,7 +101,4 @@ qtConfig(gstreamer_app) {
HEADERS += $$PRIVATE_HEADERS
-DESTDIR = $$QT.multimedia.libs
-target.path = $$[QT_INSTALL_LIBS]
-
-INSTALLS += target
+load(qt_module)
diff --git a/src/gsttools/qgstcodecsinfo.cpp b/src/gsttools/qgstcodecsinfo.cpp
index 230dc581b..a05ee92aa 100644
--- a/src/gsttools/qgstcodecsinfo.cpp
+++ b/src/gsttools/qgstcodecsinfo.cpp
@@ -156,7 +156,7 @@ void QGstCodecsInfo::updateCodecs(ElementType elementType)
GstRank rank = GstRank(gst_plugin_feature_get_rank(GST_PLUGIN_FEATURE(factory)));
// If two elements provide the same codec, use the highest ranked one
- QMap<QString, CodecInfo>::const_iterator it = m_codecInfo.find(codec);
+ QMap<QString, CodecInfo>::const_iterator it = m_codecInfo.constFind(codec);
if (it == m_codecInfo.constEnd() || it->rank < rank) {
if (it == m_codecInfo.constEnd())
m_codecs.append(codec);
diff --git a/src/gsttools/qgstreameraudioinputselector.cpp b/src/gsttools/qgstreameraudioinputselector.cpp
index 6d74feb1b..72d079cbc 100644
--- a/src/gsttools/qgstreameraudioinputselector.cpp
+++ b/src/gsttools/qgstreameraudioinputselector.cpp
@@ -104,7 +104,7 @@ void QGstreamerAudioInputSelector::update()
m_descriptions.clear();
//use autoaudiosrc as the first default device
- m_names.append("default:");
+ m_names.append(QLatin1String("default:"));
m_descriptions.append(tr("System default device"));
updatePulseDevices();
@@ -150,12 +150,12 @@ void QGstreamerAudioInputSelector::updateAlsaDevices()
void QGstreamerAudioInputSelector::updateOssDevices()
{
- QDir devDir("/dev");
+ QDir devDir(QStringLiteral("/dev"));
devDir.setFilter(QDir::System);
- const QFileInfoList entries = devDir.entryInfoList(QStringList() << "dsp*");
+ const QFileInfoList entries = devDir.entryInfoList(QStringList() << QLatin1String("dsp*"));
for (const QFileInfo& entryInfo : entries) {
m_names.append(QLatin1String("oss:")+entryInfo.filePath());
- m_descriptions.append(QString("OSS device %1").arg(entryInfo.fileName()));
+ m_descriptions.append(QString::fromLatin1("OSS device %1").arg(entryInfo.fileName()));
}
}
@@ -163,8 +163,8 @@ void QGstreamerAudioInputSelector::updatePulseDevices()
{
GstElementFactory *factory = gst_element_factory_find("pulsesrc");
if (factory) {
- m_names.append("pulseaudio:");
- m_descriptions.append("PulseAudio device.");
+ m_names.append(QLatin1String("pulseaudio:"));
+ m_descriptions.append(QLatin1String("PulseAudio device."));
gst_object_unref(GST_OBJECT(factory));
}
}
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
index 96bd09f86..820ac84b4 100644
--- a/src/gsttools/qgstutils.cpp
+++ b/src/gsttools/qgstutils.cpp
@@ -471,16 +471,16 @@ void QGstUtils::initializeGst()
namespace {
const char* getCodecAlias(const QString &codec)
{
- if (codec.startsWith("avc1."))
+ if (codec.startsWith(QLatin1String("avc1.")))
return "video/x-h264";
- if (codec.startsWith("mp4a."))
+ if (codec.startsWith(QLatin1String("mp4a.")))
return "audio/mpeg4";
- if (codec.startsWith("mp4v.20."))
+ if (codec.startsWith(QLatin1String("mp4v.20.")))
return "video/mpeg4";
- if (codec == "samr")
+ if (codec == QLatin1String("samr"))
return "audio/amr";
return 0;
@@ -488,14 +488,14 @@ namespace {
const char* getMimeTypeAlias(const QString &mimeType)
{
- if (mimeType == "video/mp4")
+ if (mimeType == QLatin1String("video/mp4"))
return "video/mpeg4";
- if (mimeType == "audio/mp4")
+ if (mimeType == QLatin1String("audio/mp4"))
return "audio/mpeg4";
- if (mimeType == "video/ogg"
- || mimeType == "audio/ogg")
+ if (mimeType == QLatin1String("video/ogg")
+ || mimeType == QLatin1String("audio/ogg"))
return "application/ogg";
return 0;
@@ -513,12 +513,12 @@ QMultimedia::SupportEstimate QGstUtils::hasSupport(const QString &mimeType,
bool containsMimeType = supportedMimeTypeSet.contains(mimeTypeLowcase);
if (!containsMimeType) {
const char* mimeTypeAlias = getMimeTypeAlias(mimeTypeLowcase);
- containsMimeType = supportedMimeTypeSet.contains(mimeTypeAlias);
+ containsMimeType = supportedMimeTypeSet.contains(QLatin1String(mimeTypeAlias));
if (!containsMimeType) {
- containsMimeType = supportedMimeTypeSet.contains("video/" + mimeTypeLowcase)
- || supportedMimeTypeSet.contains("video/x-" + mimeTypeLowcase)
- || supportedMimeTypeSet.contains("audio/" + mimeTypeLowcase)
- || supportedMimeTypeSet.contains("audio/x-" + mimeTypeLowcase);
+ containsMimeType = supportedMimeTypeSet.contains(QLatin1String("video/") + mimeTypeLowcase)
+ || supportedMimeTypeSet.contains(QLatin1String("video/x-") + mimeTypeLowcase)
+ || supportedMimeTypeSet.contains(QLatin1String("audio/") + mimeTypeLowcase)
+ || supportedMimeTypeSet.contains(QLatin1String("audio/x-") + mimeTypeLowcase);
}
}
@@ -527,12 +527,12 @@ QMultimedia::SupportEstimate QGstUtils::hasSupport(const QString &mimeType,
QString codecLowcase = codec.toLower();
const char* codecAlias = getCodecAlias(codecLowcase);
if (codecAlias) {
- if (supportedMimeTypeSet.contains(codecAlias))
+ if (supportedMimeTypeSet.contains(QLatin1String(codecAlias)))
supportedCodecCount++;
- } else if (supportedMimeTypeSet.contains("video/" + codecLowcase)
- || supportedMimeTypeSet.contains("video/x-" + codecLowcase)
- || supportedMimeTypeSet.contains("audio/" + codecLowcase)
- || supportedMimeTypeSet.contains("audio/x-" + codecLowcase)) {
+ } else if (supportedMimeTypeSet.contains(QLatin1String("video/") + codecLowcase)
+ || supportedMimeTypeSet.contains(QLatin1String("video/x-") + codecLowcase)
+ || supportedMimeTypeSet.contains(QLatin1String("audio/") + codecLowcase)
+ || supportedMimeTypeSet.contains(QLatin1String("audio/x-") + codecLowcase)) {
supportedCodecCount++;
}
}
@@ -768,8 +768,8 @@ QSet<QString> QGstUtils::supportedMimeTypes(bool (*isValidFactory)(GstElementFac
GstElementFactory *factory;
if (GST_IS_TYPE_FIND_FACTORY(feature)) {
- QString name(gst_plugin_feature_get_name(feature));
- if (name.contains('/')) //filter out any string without '/' which is obviously not a mime type
+ QString name(QLatin1String(gst_plugin_feature_get_name(feature)));
+ if (name.contains(QLatin1Char('/'))) //filter out any string without '/' which is obviously not a mime type
supportedMimeTypes.insert(name.toLower());
continue;
} else if (!GST_IS_ELEMENT_FACTORY (feature)
@@ -787,18 +787,18 @@ QSet<QString> QGstUtils::supportedMimeTypes(bool (*isValidFactory)(GstElementFac
if (gst_caps_is_any(caps) || gst_caps_is_empty(caps)) {
} else for (guint i = 0; i < gst_caps_get_size(caps); i++) {
GstStructure *structure = gst_caps_get_structure(caps, i);
- QString nameLowcase = QString(gst_structure_get_name(structure)).toLower();
+ QString nameLowcase = QString::fromLatin1(gst_structure_get_name(structure)).toLower();
supportedMimeTypes.insert(nameLowcase);
- if (nameLowcase.contains("mpeg")) {
+ if (nameLowcase.contains(QLatin1String("mpeg"))) {
//Because mpeg version number is only included in the detail
//description, it is necessary to manually extract this information
//in order to match the mime type of mpeg4.
const GValue *value = gst_structure_get_value(structure, "mpegversion");
if (value) {
gchar *str = gst_value_serialize(value);
- QString versions(str);
- const QStringList elements = versions.split(QRegExp("\\D+"), QString::SkipEmptyParts);
+ QString versions = QLatin1String(str);
+ const QStringList elements = versions.split(QRegExp(QLatin1String("\\D+")), QString::SkipEmptyParts);
for (const QString &e : elements)
supportedMimeTypes.insert(nameLowcase + e);
g_free(str);
@@ -1238,7 +1238,7 @@ void QGstUtils::setMetaData(GstElement *element, const QMap<QByteArray, QVariant
QMapIterator<QByteArray, QVariant> it(data);
while (it.hasNext()) {
it.next();
- const QString tagName = it.key();
+ const QString tagName = QString::fromLatin1(it.key());
const QVariant tagValue = it.value();
switch (tagValue.type()) {
@@ -1438,26 +1438,26 @@ QString QGstUtils::fileExtensionForMimeType(const QString &mimeType)
{
if (fileExtensionMap->isEmpty()) {
//extension for containers hard to guess from mimetype
- fileExtensionMap->insert("video/x-matroska", "mkv");
- fileExtensionMap->insert("video/quicktime", "mov");
- fileExtensionMap->insert("video/x-msvideo", "avi");
- fileExtensionMap->insert("video/msvideo", "avi");
- fileExtensionMap->insert("audio/mpeg", "mp3");
- fileExtensionMap->insert("application/x-shockwave-flash", "swf");
- fileExtensionMap->insert("application/x-pn-realmedia", "rm");
+ fileExtensionMap->insert(QStringLiteral("video/x-matroska"), QLatin1String("mkv"));
+ fileExtensionMap->insert(QStringLiteral("video/quicktime"), QLatin1String("mov"));
+ fileExtensionMap->insert(QStringLiteral("video/x-msvideo"), QLatin1String("avi"));
+ fileExtensionMap->insert(QStringLiteral("video/msvideo"), QLatin1String("avi"));
+ fileExtensionMap->insert(QStringLiteral("audio/mpeg"), QLatin1String("mp3"));
+ fileExtensionMap->insert(QStringLiteral("application/x-shockwave-flash"), QLatin1String("swf"));
+ fileExtensionMap->insert(QStringLiteral("application/x-pn-realmedia"), QLatin1String("rm"));
}
//for container names like avi instead of video/x-msvideo, use it as extension
- if (!mimeType.contains('/'))
+ if (!mimeType.contains(QLatin1Char('/')))
return mimeType;
- QString format = mimeType.left(mimeType.indexOf(','));
+ QString format = mimeType.left(mimeType.indexOf(QLatin1Char(',')));
QString extension = fileExtensionMap->value(format);
if (!extension.isEmpty() || format.isEmpty())
return extension;
- QRegExp rx("[-/]([\\w]+)$");
+ QRegExp rx(QStringLiteral("[-/]([\\w]+)$"));
if (rx.indexIn(format) != -1)
extension = rx.cap(1);
diff --git a/src/imports/audioengine/qdeclarative_playvariation_p.cpp b/src/imports/audioengine/qdeclarative_playvariation_p.cpp
index 36ffca668..5dd88506b 100644
--- a/src/imports/audioengine/qdeclarative_playvariation_p.cpp
+++ b/src/imports/audioengine/qdeclarative_playvariation_p.cpp
@@ -41,6 +41,7 @@
#include "qdeclarative_audioengine_p.h"
#include "qsoundinstance_p.h"
#include "qdebug.h"
+#include "qrandom.h"
#define DEBUG_AUDIOENGINE
@@ -272,7 +273,7 @@ void QDeclarativePlayVariation::setSampleObject(QDeclarativeAudioSample *sampleO
void QDeclarativePlayVariation::applyParameters(QSoundInstance *soundInstance)
{
- qreal pitch = qreal(qrand() % 1001) * 0.001f * (m_maxPitch - m_minPitch) + m_minPitch;
- qreal gain = qreal(qrand() % 1001) * 0.001f * (m_maxGain - m_minGain) + m_minGain;
+ qreal pitch = QRandomGenerator::bounded(1001 * 0.001f) * (m_maxPitch - m_minPitch) + m_minPitch;
+ qreal gain = QRandomGenerator::bounded(1001 * 0.001f) * (m_maxGain - m_minGain) + m_minGain;
soundInstance->updateVariationParameters(pitch, gain, m_looping);
}
diff --git a/src/imports/audioengine/qdeclarative_sound_p.cpp b/src/imports/audioengine/qdeclarative_sound_p.cpp
index 0849215be..adbe9e53a 100644
--- a/src/imports/audioengine/qdeclarative_sound_p.cpp
+++ b/src/imports/audioengine/qdeclarative_sound_p.cpp
@@ -43,6 +43,7 @@
#include "qdeclarative_soundinstance_p.h"
#include "qdeclarative_audioengine_p.h"
#include "qdebug.h"
+#include "qrandom.h"
#define DEBUG_AUDIOENGINE
@@ -316,7 +317,7 @@ int QDeclarativeSound::genVariationIndex(int oldVariationIndex)
case QDeclarativeSound::Random: {
if (oldVariationIndex < 0)
oldVariationIndex = 0;
- return (oldVariationIndex + (qrand() % (m_playlist.count() + 1))) % m_playlist.count();
+ return (oldVariationIndex + (QRandomGenerator::bounded(m_playlist.count() + 1))) % m_playlist.count();
}
default:
return (oldVariationIndex + 1) % m_playlist.count();
diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp
index d4f89e898..dea9a05a5 100644
--- a/src/multimedia/audio/qaudio.cpp
+++ b/src/multimedia/audio/qaudio.cpp
@@ -79,13 +79,18 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterAudioMetaTypes)
/*!
\enum QAudio::State
- \value ActiveState Audio data is being processed, this state is set after start() is called
- and while audio data is available to be processed.
- \value SuspendedState The audio device is in a suspended state, this state will only be entered
- after suspend() is called.
- \value StoppedState The audio device is closed, and is not processing any audio data
- \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state
- is set after start() is called and while no audio data is available to be processed.
+ \value ActiveState Audio data is being processed, this state is set after start() is called
+ and while audio data is available to be processed.
+ \value SuspendedState The audio stream is in a suspended state. Entered after suspend() is called
+ or when another stream takes control of the audio device. In the later case,
+ a call to resume will return control of the audio device to this stream. This
+ should usually only be done upon user request.
+ \value StoppedState The audio device is closed, and is not processing any audio data
+ \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state
+ is set after start() is called and while no audio data is available to be processed.
+ \value InterruptedState This stream is in a suspended state because another higher priority stream currently
+ has control of the audio device. Playback cannot resume until the higher priority
+ stream relinquishes control of the audio device.
*/
/*!
@@ -285,6 +290,9 @@ QDebug operator<<(QDebug dbg, QAudio::State state)
case QAudio::IdleState:
dbg << "IdleState";
break;
+ case QAudio::InterruptedState:
+ dbg << "InterruptedState";
+ break;
}
return dbg;
}
diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h
index 1c38e9f35..2603d71d1 100644
--- a/src/multimedia/audio/qaudio.h
+++ b/src/multimedia/audio/qaudio.h
@@ -55,7 +55,7 @@ class QString;
namespace QAudio
{
enum Error { NoError, OpenError, IOError, UnderrunError, FatalError };
- enum State { ActiveState, SuspendedState, StoppedState, IdleState };
+ enum State { ActiveState, SuspendedState, StoppedState, IdleState, InterruptedState };
enum Mode { AudioInput, AudioOutput };
enum Role {
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
index 1e9204598..5dbc1a0c9 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
@@ -190,7 +190,11 @@ private Q_SLOTS:
pa_context_set_state_callback(m_context, context_state_callback, this);
- if (pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0) < 0) {
+ const QByteArray srvStrEnv = qgetenv("QT_PULSE_SERVER_STRING");
+ const char *srvStr = srvStrEnv.isNull() ? 0 : srvStrEnv.constData();
+ pa_context_flags_t flags = qEnvironmentVariableIsSet("QT_PULSE_NOAUTOSPAWN") ? PA_CONTEXT_NOAUTOSPAWN : (pa_context_flags_t)0;
+
+ if (pa_context_connect(m_context, srvStr, flags, 0) < 0) {
qWarning("PulseAudioService: pa_context_connect() failed");
pa_context_unref(m_context);
unlock();
diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h
index 685298905..aebd1c013 100644
--- a/src/multimedia/camera/qcamera.h
+++ b/src/multimedia/camera/qcamera.h
@@ -262,7 +262,10 @@ QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
QT_WARNING_DISABLE_GCC("-Wfloat-equal")
Q_DECL_CONSTEXPR Q_INLINE_TEMPLATE bool operator==(const QCamera::FrameRateRange &r1, const QCamera::FrameRateRange &r2) Q_DECL_NOTHROW
-{ return r1.minimumFrameRate == r2.minimumFrameRate && r1.maximumFrameRate == r2.maximumFrameRate; }
+{
+ return qFuzzyCompare(r1.minimumFrameRate, r2.minimumFrameRate)
+ && qFuzzyCompare(r1.maximumFrameRate, r2.maximumFrameRate);
+}
QT_WARNING_POP
diff --git a/src/multimedia/gsttools_headers/gstvideoconnector_p.h b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
index 4fa1456c8..a38ca2e65 100644
--- a/src/multimedia/gsttools_headers/gstvideoconnector_p.h
+++ b/src/multimedia/gsttools_headers/gstvideoconnector_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
+
#include <gst/gst.h>
G_BEGIN_DECLS
@@ -69,7 +71,7 @@ G_BEGIN_DECLS
typedef struct _GstVideoConnector GstVideoConnector;
typedef struct _GstVideoConnectorClass GstVideoConnectorClass;
-struct _GstVideoConnector {
+struct Q_GSTTOOLS_EXPORT _GstVideoConnector {
GstElement element;
GstPad *srcpad;
@@ -81,14 +83,14 @@ struct _GstVideoConnector {
GstBuffer *latest_buffer;
};
-struct _GstVideoConnectorClass {
+struct Q_GSTTOOLS_EXPORT _GstVideoConnectorClass {
GstElementClass parent_class;
/* action signal to resend new segment */
void (*resend_new_segment) (GstElement * element, gboolean emitFailedSignal);
};
-GType gst_video_connector_get_type (void);
+GType Q_GSTTOOLS_EXPORT gst_video_connector_get_type (void);
G_END_DECLS
diff --git a/src/multimedia/gsttools_headers/qgstappsrc_p.h b/src/multimedia/gsttools_headers/qgstappsrc_p.h
index e50915231..c7e87037d 100644
--- a/src/multimedia/gsttools_headers/qgstappsrc_p.h
+++ b/src/multimedia/gsttools_headers/qgstappsrc_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QtCore/qobject.h>
#include <QtCore/qiodevice.h>
@@ -63,7 +64,7 @@
QT_BEGIN_NAMESPACE
-class QGstAppSrc : public QObject
+class Q_GSTTOOLS_EXPORT QGstAppSrc : public QObject
{
Q_OBJECT
public:
diff --git a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
index e03da1ab5..45e573262 100644
--- a/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
+++ b/src/multimedia/gsttools_headers/qgstbufferpoolinterface_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qabstractvideobuffer.h>
#include <qvideosurfaceformat.h>
#include <QtCore/qobject.h>
@@ -65,7 +66,7 @@ const QLatin1String QGstBufferPoolPluginKey("bufferpool");
/*!
Abstract interface for video buffers allocation.
*/
-class QGstBufferPoolInterface
+class Q_GSTTOOLS_EXPORT QGstBufferPoolInterface
{
public:
virtual ~QGstBufferPoolInterface() {}
diff --git a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
index af1a4486f..33ab3de4b 100644
--- a/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
+++ b/src/multimedia/gsttools_headers/qgstcodecsinfo_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QtCore/qmap.h>
#include <QtCore/qstringlist.h>
@@ -58,7 +59,7 @@
QT_BEGIN_NAMESPACE
-class QGstCodecsInfo
+class Q_GSTTOOLS_EXPORT QGstCodecsInfo
{
public:
enum ElementType { AudioEncoder, VideoEncoder, Muxer };
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
index 1a961c6d9..0c193fda9 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioinputselector_p.h
@@ -51,12 +51,13 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qaudioinputselectorcontrol.h>
#include <QtCore/qstringlist.h>
QT_BEGIN_NAMESPACE
-class QGstreamerAudioInputSelector : public QAudioInputSelectorControl
+class Q_GSTTOOLS_EXPORT QGstreamerAudioInputSelector : public QAudioInputSelectorControl
{
Q_OBJECT
public:
diff --git a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
index bacf8c71d..4fc5c7704 100644
--- a/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreameraudioprobecontrol_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <gst/gst.h>
#include <qmediaaudioprobecontrol.h>
#include <QtCore/qmutex.h>
@@ -61,7 +62,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerAudioProbeControl
+class Q_GSTTOOLS_EXPORT QGstreamerAudioProbeControl
: public QMediaAudioProbeControl
, public QGstreamerBufferProbe
, public QSharedData
diff --git a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
index f7ba2bbd9..35644f934 100644
--- a/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamerbufferprobe_p.h
@@ -51,13 +51,15 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <gst/gst.h>
#include <QtCore/qglobal.h>
+
QT_BEGIN_NAMESPACE
-class QGstreamerBufferProbe
+class Q_GSTTOOLS_EXPORT QGstreamerBufferProbe
{
public:
enum Flags
diff --git a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h b/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
index 3216c07da..c7d06faf8 100644
--- a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
@@ -51,9 +51,11 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QObject>
#include "qgstreamermessage_p.h"
+
#include <gst/gst.h>
QT_BEGIN_NAMESPACE
@@ -78,7 +80,7 @@ Q_DECLARE_INTERFACE(QGstreamerBusMessageFilter, QGstreamerBusMessageFilter_iid)
class QGstreamerBusHelperPrivate;
-class QGstreamerBusHelper : public QObject
+class Q_GSTTOOLS_EXPORT QGstreamerBusHelper : public QObject
{
Q_OBJECT
friend class QGstreamerBusHelperPrivate;
diff --git a/src/multimedia/gsttools_headers/qgstreamermessage_p.h b/src/multimedia/gsttools_headers/qgstreamermessage_p.h
index 5d832ccfa..2f9d1745c 100644
--- a/src/multimedia/gsttools_headers/qgstreamermessage_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamermessage_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QMetaType>
#include <gst/gst.h>
@@ -60,7 +61,7 @@ QT_BEGIN_NAMESPACE
// Required for QDoc workaround
class QString;
-class QGstreamerMessage
+class Q_GSTTOOLS_EXPORT QGstreamerMessage
{
public:
QGstreamerMessage();
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
index e1ac453c7..b660cc7b3 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoinputdevicecontrol_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideodeviceselectorcontrol.h>
#include <QtCore/qstringlist.h>
@@ -59,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoInputDeviceControl : public QVideoDeviceSelectorControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoInputDeviceControl : public QVideoDeviceSelectorControl
{
Q_OBJECT
public:
diff --git a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
index b599b0e78..b15b6099c 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideoprobecontrol_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <qmediavideoprobecontrol.h>
@@ -62,7 +63,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoProbeControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoProbeControl
: public QMediaVideoProbeControl
, public QGstreamerBufferProbe
, public QSharedData
diff --git a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
index 1d22e1125..2f0b80d45 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideorenderer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideorenderercontrol.h>
#include <private/qvideosurfacegstsink_p.h>
#include <qabstractvideosurface.h>
@@ -59,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
{
Q_OBJECT
Q_INTERFACES(QGstreamerVideoRendererInterface)
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
index b2dfece60..3e3240725 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowidget_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideowidgetcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
@@ -59,9 +60,9 @@
QT_BEGIN_NAMESPACE
-class QGstreamerVideoWidget;
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWidget;
-class QGstreamerVideoWidgetControl
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWidgetControl
: public QVideoWidgetControl
, public QGstreamerVideoRendererInterface
, public QGstreamerSyncMessageFilter
diff --git a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
index b489650f9..5f893f10e 100644
--- a/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
+++ b/src/multimedia/gsttools_headers/qgstreamervideowindow_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qvideowindowcontrol.h>
#include "qgstreamervideorendererinterface_p.h"
@@ -61,7 +62,7 @@
QT_BEGIN_NAMESPACE
class QAbstractVideoSurface;
-class QGstreamerVideoWindow :
+class Q_GSTTOOLS_EXPORT QGstreamerVideoWindow :
public QVideoWindowControl,
public QGstreamerVideoRendererInterface,
public QGstreamerSyncMessageFilter,
diff --git a/src/multimedia/gsttools_headers/qgsttools_global_p.h b/src/multimedia/gsttools_headers/qgsttools_global_p.h
new file mode 100644
index 000000000..babcd3aaf
--- /dev/null
+++ b/src/multimedia/gsttools_headers/qgsttools_global_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 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 QGSTTOOLS_GLOBAL_H
+#define QGSTTOOLS_GLOBAL_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_MULTIMEDIAGSTTOOLS_LIB)
+# define Q_GSTTOOLS_EXPORT Q_DECL_EXPORT
+# else
+# define Q_GSTTOOLS_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_GSTTOOLS_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QGSTTOOLS_GLOBAL_H
diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h
index 8b7de3661..24d3e889d 100644
--- a/src/multimedia/gsttools_headers/qgstutils_p.h
+++ b/src/multimedia/gsttools_headers/qgstutils_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <QtCore/qmap.h>
#include <QtCore/qset.h>
#include <QtCore/qvector.h>
@@ -85,7 +86,7 @@ class QImage;
class QVideoSurfaceFormat;
namespace QGstUtils {
- struct CameraInfo
+ struct Q_GSTTOOLS_EXPORT CameraInfo
{
QString name;
QString description;
@@ -94,74 +95,74 @@ namespace QGstUtils {
QByteArray driver;
};
- QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list);
+ Q_GSTTOOLS_EXPORT QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list);
- QSize capsResolution(const GstCaps *caps);
- QSize capsCorrectedResolution(const GstCaps *caps);
- QAudioFormat audioFormatForCaps(const GstCaps *caps);
+ Q_GSTTOOLS_EXPORT QSize capsResolution(const GstCaps *caps);
+ Q_GSTTOOLS_EXPORT QSize capsCorrectedResolution(const GstCaps *caps);
+ Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForCaps(const GstCaps *caps);
#if GST_CHECK_VERSION(1,0,0)
- QAudioFormat audioFormatForSample(GstSample *sample);
+ Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForSample(GstSample *sample);
#else
- QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
+ Q_GSTTOOLS_EXPORT QAudioFormat audioFormatForBuffer(GstBuffer *buffer);
#endif
- GstCaps *capsForAudioFormat(const QAudioFormat &format);
- void initializeGst();
- QMultimedia::SupportEstimate hasSupport(const QString &mimeType,
+ Q_GSTTOOLS_EXPORT GstCaps *capsForAudioFormat(const QAudioFormat &format);
+ Q_GSTTOOLS_EXPORT void initializeGst();
+ Q_GSTTOOLS_EXPORT QMultimedia::SupportEstimate hasSupport(const QString &mimeType,
const QStringList &codecs,
const QSet<QString> &supportedMimeTypeSet);
- QVector<CameraInfo> enumerateCameras(GstElementFactory *factory = 0);
- QList<QByteArray> cameraDevices(GstElementFactory * factory = 0);
- QString cameraDescription(const QString &device, GstElementFactory * factory = 0);
- QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0);
- int cameraOrientation(const QString &device, GstElementFactory * factory = 0);
- QByteArray cameraDriver(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QVector<CameraInfo> enumerateCameras(GstElementFactory *factory = 0);
+ Q_GSTTOOLS_EXPORT QList<QByteArray> cameraDevices(GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QString cameraDescription(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QCamera::Position cameraPosition(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT int cameraOrientation(const QString &device, GstElementFactory * factory = 0);
+ Q_GSTTOOLS_EXPORT QByteArray cameraDriver(const QString &device, GstElementFactory * factory = 0);
- QSet<QString> supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory));
+ Q_GSTTOOLS_EXPORT QSet<QString> supportedMimeTypes(bool (*isValidFactory)(GstElementFactory *factory));
#if GST_CHECK_VERSION(1,0,0)
- QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info);
- QVideoSurfaceFormat formatForCaps(
+ Q_GSTTOOLS_EXPORT QImage bufferToImage(GstBuffer *buffer, const GstVideoInfo &info);
+ Q_GSTTOOLS_EXPORT QVideoSurfaceFormat formatForCaps(
GstCaps *caps,
GstVideoInfo *info = 0,
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
#else
- QImage bufferToImage(GstBuffer *buffer);
- QVideoSurfaceFormat formatForCaps(
+ Q_GSTTOOLS_EXPORT QImage bufferToImage(GstBuffer *buffer);
+ Q_GSTTOOLS_EXPORT QVideoSurfaceFormat formatForCaps(
GstCaps *caps,
int *bytesPerLine = 0,
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
#endif
- GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats);
+ Q_GSTTOOLS_EXPORT GstCaps *capsForFormats(const QList<QVideoFrame::PixelFormat> &formats);
void setFrameTimeStamps(QVideoFrame *frame, GstBuffer *buffer);
- void setMetaData(GstElement *element, const QMap<QByteArray, QVariant> &data);
- void setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data);
+ Q_GSTTOOLS_EXPORT void setMetaData(GstElement *element, const QMap<QByteArray, QVariant> &data);
+ Q_GSTTOOLS_EXPORT void setMetaData(GstBin *bin, const QMap<QByteArray, QVariant> &data);
- GstCaps *videoFilterCaps();
+ Q_GSTTOOLS_EXPORT GstCaps *videoFilterCaps();
- QSize structureResolution(const GstStructure *s);
- QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0);
- QSize structurePixelAspectRatio(const GstStructure *s);
- QPair<qreal, qreal> structureFrameRateRange(const GstStructure *s);
+ Q_GSTTOOLS_EXPORT QSize structureResolution(const GstStructure *s);
+ Q_GSTTOOLS_EXPORT QVideoFrame::PixelFormat structurePixelFormat(const GstStructure *s, int *bpp = 0);
+ Q_GSTTOOLS_EXPORT QSize structurePixelAspectRatio(const GstStructure *s);
+ Q_GSTTOOLS_EXPORT QPair<qreal, qreal> structureFrameRateRange(const GstStructure *s);
- QString fileExtensionForMimeType(const QString &mimeType);
+ Q_GSTTOOLS_EXPORT QString fileExtensionForMimeType(const QString &mimeType);
}
-void qt_gst_object_ref_sink(gpointer object);
-GstCaps *qt_gst_pad_get_current_caps(GstPad *pad);
-GstCaps *qt_gst_pad_get_caps(GstPad *pad);
-GstStructure *qt_gst_structure_new_empty(const char *name);
-gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
-gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
-GstCaps *qt_gst_caps_normalize(GstCaps *caps);
-const gchar *qt_gst_element_get_factory_name(GstElement *element);
-gboolean qt_gst_caps_can_intersect(const GstCaps * caps1, const GstCaps * caps2);
-GList *qt_gst_video_sinks();
-void qt_gst_util_double_to_fraction(gdouble src, gint *dest_n, gint *dest_d);
-
-QDebug operator <<(QDebug debug, GstCaps *caps);
+Q_GSTTOOLS_EXPORT void qt_gst_object_ref_sink(gpointer object);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_pad_get_current_caps(GstPad *pad);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_pad_get_caps(GstPad *pad);
+Q_GSTTOOLS_EXPORT GstStructure *qt_gst_structure_new_empty(const char *name);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_element_query_position(GstElement *element, GstFormat format, gint64 *cur);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_element_query_duration(GstElement *element, GstFormat format, gint64 *cur);
+Q_GSTTOOLS_EXPORT GstCaps *qt_gst_caps_normalize(GstCaps *caps);
+Q_GSTTOOLS_EXPORT const gchar *qt_gst_element_get_factory_name(GstElement *element);
+Q_GSTTOOLS_EXPORT gboolean qt_gst_caps_can_intersect(const GstCaps * caps1, const GstCaps * caps2);
+Q_GSTTOOLS_EXPORT GList *qt_gst_video_sinks();
+Q_GSTTOOLS_EXPORT void qt_gst_util_double_to_fraction(gdouble src, gint *dest_n, gint *dest_d);
+
+Q_GSTTOOLS_EXPORT QDebug operator <<(QDebug debug, GstCaps *caps);
QT_END_NAMESPACE
diff --git a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
index d2802d9a2..c67c57021 100644
--- a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
+++ b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qabstractvideobuffer.h>
#include <QtCore/qvariant.h>
@@ -60,14 +61,14 @@
QT_BEGIN_NAMESPACE
#if GST_CHECK_VERSION(1,0,0)
-class QGstVideoBuffer : public QAbstractPlanarVideoBuffer
+class Q_GSTTOOLS_EXPORT QGstVideoBuffer : public QAbstractPlanarVideoBuffer
{
public:
QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info);
QGstVideoBuffer(GstBuffer *buffer, const GstVideoInfo &info,
HandleType handleType, const QVariant &handle);
#else
-class QGstVideoBuffer : public QAbstractVideoBuffer
+class Q_GSTTOOLS_EXPORT QGstVideoBuffer : public QAbstractVideoBuffer
{
public:
QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine);
diff --git a/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h b/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
index 6a0c4c6bd..df36dbe09 100644
--- a/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
+++ b/src/multimedia/gsttools_headers/qgstvideorendererplugin_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
+#include <private/qgsttools_global_p.h>
#include <qabstractvideobuffer.h>
#include <qvideosurfaceformat.h>
#include <QtCore/qobject.h>
@@ -64,7 +65,7 @@ class QAbstractVideoSurface;
const QLatin1String QGstVideoRendererPluginKey("gstvideorenderer");
-class QGstVideoRenderer
+class Q_GSTTOOLS_EXPORT QGstVideoRenderer
{
public:
virtual ~QGstVideoRenderer() {}
@@ -81,7 +82,7 @@ public:
/*
Abstract interface for video buffers allocation.
*/
-class QGstVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstVideoRendererInterface
{
public:
virtual ~QGstVideoRendererInterface() {}
@@ -92,7 +93,7 @@ public:
#define QGstVideoRendererInterface_iid "org.qt-project.qt.gstvideorenderer/5.4"
Q_DECLARE_INTERFACE(QGstVideoRendererInterface, QGstVideoRendererInterface_iid)
-class QGstVideoRendererPlugin : public QObject, public QGstVideoRendererInterface
+class Q_GSTTOOLS_EXPORT QGstVideoRendererPlugin : public QObject, public QGstVideoRendererInterface
{
Q_OBJECT
Q_INTERFACES(QGstVideoRendererInterface)
diff --git a/src/multimedia/playback/qmedianetworkplaylistprovider.cpp b/src/multimedia/playback/qmedianetworkplaylistprovider.cpp
index a4ad97251..50db4fad2 100644
--- a/src/multimedia/playback/qmedianetworkplaylistprovider.cpp
+++ b/src/multimedia/playback/qmedianetworkplaylistprovider.cpp
@@ -42,6 +42,7 @@
#include "qmediacontent.h"
#include "qmediaobject_p.h"
#include "qplaylistfileparser_p.h"
+#include "qrandom.h"
QT_BEGIN_NAMESPACE
@@ -266,7 +267,7 @@ void QMediaNetworkPlaylistProvider::shuffle()
QList<QMediaContent> resources;
while (!d->resources.isEmpty()) {
- resources.append(d->resources.takeAt(qrand() % d->resources.size()));
+ resources.append(d->resources.takeAt(QRandomGenerator::bounded(d->resources.size())));
}
d->resources = resources;
diff --git a/src/multimedia/playback/qmediaplaylistnavigator.cpp b/src/multimedia/playback/qmediaplaylistnavigator.cpp
index 192fd463c..0bacbf2ba 100644
--- a/src/multimedia/playback/qmediaplaylistnavigator.cpp
+++ b/src/multimedia/playback/qmediaplaylistnavigator.cpp
@@ -43,6 +43,7 @@
#include "qmediaobject_p.h"
#include <QtCore/qdebug.h>
+#include <QtCore/qrandom.h>
QT_BEGIN_NAMESPACE
@@ -124,7 +125,7 @@ int QMediaPlaylistNavigatorPrivate::nextItemPos(int steps) const
randomModePositions.append(-1);
int res = randomModePositions[randomPositionsOffset+steps];
if (res<0 || res >= playlist->mediaCount()) {
- res = qrand() % playlist->mediaCount();
+ res = QRandomGenerator::bounded(playlist->mediaCount());
randomModePositions[randomPositionsOffset+steps] = res;
}
@@ -177,7 +178,7 @@ int QMediaPlaylistNavigatorPrivate::previousItemPos(int steps) const
int res = randomModePositions[randomPositionsOffset-steps];
if (res<0 || res >= playlist->mediaCount()) {
- res = qrand() % playlist->mediaCount();
+ res = QRandomGenerator::bounded(playlist->mediaCount());
randomModePositions[randomPositionsOffset-steps] = res;
}
diff --git a/src/multimedia/qmediaobject.cpp b/src/multimedia/qmediaobject.cpp
index a2f0d58aa..71b2d148c 100644
--- a/src/multimedia/qmediaobject.cpp
+++ b/src/multimedia/qmediaobject.cpp
@@ -55,7 +55,13 @@ void QMediaObjectPrivate::_q_notify()
const QMetaObject* m = q->metaObject();
- for (int pi : qAsConst(notifyProperties)) {
+ // QTBUG-57045
+ // we create a copy of notifyProperties container to ensure that if a property is removed
+ // from the original container as a result of invoking propertyChanged signal, the iterator
+ // won't become invalidated
+ QSet<int> properties = notifyProperties;
+
+ for (int pi : qAsConst(properties)) {
QMetaProperty p = m->property(pi);
p.notifySignal().invoke(
q, QGenericArgument(QMetaType::typeName(p.userType()), p.read(q).data()));
diff --git a/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm b/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm
index d657dc17d..0b31bd0bc 100644
--- a/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm
+++ b/src/plugins/avfoundation/camera/avfmediarecordercontrol_ios.mm
@@ -49,6 +49,7 @@
#include "avfmediacontainercontrol.h"
#include "avfcamerautility.h"
+#include <QtCore/qmath.h>
#include <QtCore/qdebug.h>
QT_USE_NAMESPACE
@@ -273,14 +274,11 @@ void AVFMediaRecorderControlIOS::setState(QMediaRecorder::State state)
else
rotation = (screenOrientation + (360 - cameraInfo.orientation)) % 360;
- // convert to radians
- rotation *= M_PI / 180.f;
-
if ([m_writer setupWithFileURL:nsFileURL
cameraService:m_service
audioSettings:m_audioSettings
videoSettings:m_videoSettings
- transform:CGAffineTransformMakeRotation(rotation)]) {
+ transform:CGAffineTransformMakeRotation(qDegreesToRadians(rotation))]) {
m_state = QMediaRecorder::RecordingState;
m_lastStatus = QMediaRecorder::StartingStatus;
diff --git a/src/plugins/gstreamer/common.pri b/src/plugins/gstreamer/common.pri
index cbe87be4f..d0c5c7bdd 100644
--- a/src/plugins/gstreamer/common.pri
+++ b/src/plugins/gstreamer/common.pri
@@ -1,12 +1,10 @@
-QT += core-private multimedia-private network
+QT += core-private multimedia-private multimediagsttools-private network
qtHaveModule(widgets) {
QT += widgets multimediawidgets-private
DEFINES += HAVE_WIDGETS
}
-LIBS += -lqgsttools_p
-
QMAKE_USE += gstreamer
qtConfig(resourcepolicy): \
diff --git a/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp b/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp
index d08d01e6d..c4c09f543 100644
--- a/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp
+++ b/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp
@@ -43,19 +43,24 @@
#include <private/qaudiohelpers_p.h>
+#pragma GCC diagnostic ignored "-Wvla"
+
QT_BEGIN_NAMESPACE
QnxAudioOutput::QnxAudioOutput()
- : m_source(0),
- m_pushSource(false),
- m_notifyInterval(1000),
- m_error(QAudio::NoError),
- m_state(QAudio::StoppedState),
- m_volume(1.0),
- m_periodSize(0),
- m_pcmHandle(0),
- m_bytesWritten(0),
- m_intervalOffset(0)
+ : m_source(0)
+ , m_pushSource(false)
+ , m_notifyInterval(1000)
+ , m_error(QAudio::NoError)
+ , m_state(QAudio::StoppedState)
+ , m_volume(1.0)
+ , m_periodSize(0)
+ , m_pcmHandle(0)
+ , m_bytesWritten(0)
+ , m_intervalOffset(0)
+#if _NTO_VERSION >= 700
+ , m_pcmNotifier(0)
+#endif
{
m_timer.setSingleShot(false);
m_timer.setInterval(20);
@@ -124,20 +129,16 @@ void QnxAudioOutput::reset()
void QnxAudioOutput::suspend()
{
- m_timer.stop();
snd_pcm_playback_pause(m_pcmHandle);
- setState(QAudio::SuspendedState);
+ if (state() != QAudio::InterruptedState)
+ suspendInternal(QAudio::SuspendedState);
}
void QnxAudioOutput::resume()
{
snd_pcm_playback_resume(m_pcmHandle);
- if (m_pushSource)
- setState(QAudio::IdleState);
- else {
- setState(QAudio::ActiveState);
- m_timer.start();
- }
+ if (state() != QAudio::InterruptedState)
+ resumeInternal();
}
int QnxAudioOutput::bytesFree() const
@@ -146,6 +147,7 @@ int QnxAudioOutput::bytesFree() const
return 0;
snd_pcm_channel_status_t status;
+ memset(&status, 0, sizeof(status));
status.channel = SND_PCM_CHANNEL_PLAYBACK;
const int errorCode = snd_pcm_plugin_status(m_pcmHandle, &status);
@@ -214,9 +216,21 @@ qreal QnxAudioOutput::volume() const
return m_volume;
}
+void QnxAudioOutput::setCategory(const QString &category)
+{
+ m_category = category;
+}
+
+QString QnxAudioOutput::category() const
+{
+ return m_category;
+}
+
void QnxAudioOutput::pullData()
{
- if (m_state == QAudio::StoppedState || m_state == QAudio::SuspendedState)
+ if (m_state == QAudio::StoppedState
+ || m_state == QAudio::SuspendedState
+ || m_state == QAudio::InterruptedState)
return;
const int bytesAvailable = bytesFree();
@@ -290,6 +304,8 @@ bool QnxAudioOutput::open()
return false;
}
+ addPcmEventFilter();
+
// Necessary so that bytesFree() which uses the "free" member of the status struct works
snd_pcm_plugin_set_disable(m_pcmHandle, PLUGIN_MMAP);
@@ -303,6 +319,7 @@ bool QnxAudioOutput::open()
}
snd_pcm_channel_params_t params = QnxAudioUtils::formatToChannelParams(m_format, QAudio::AudioOutput, info.max_fragment_size);
+ setTypeName(&params);
if ((errorCode = snd_pcm_plugin_params(m_pcmHandle, &params)) < 0) {
qWarning("QnxAudioOutput: open error, couldn't set channel params (0x%x)", -errorCode);
@@ -331,6 +348,8 @@ bool QnxAudioOutput::open()
m_intervalOffset = 0;
m_bytesWritten = 0;
+ createPcmNotifiers();
+
return true;
}
@@ -338,6 +357,8 @@ void QnxAudioOutput::close()
{
m_timer.stop();
+ destroyPcmNotifiers();
+
if (m_pcmHandle) {
snd_pcm_plugin_flush(m_pcmHandle, SND_PCM_CHANNEL_PLAYBACK);
snd_pcm_close(m_pcmHandle);
@@ -400,6 +421,109 @@ qint64 QnxAudioOutput::write(const char *data, qint64 len)
}
}
+void QnxAudioOutput::suspendInternal(QAudio::State suspendState)
+{
+ m_timer.stop();
+ setState(suspendState);
+}
+
+void QnxAudioOutput::resumeInternal()
+{
+ if (m_pushSource) {
+ setState(QAudio::IdleState);
+ } else {
+ setState(QAudio::ActiveState);
+ m_timer.start();
+ }
+}
+
+#if _NTO_VERSION >= 700
+
+QAudio::State suspendState(const snd_pcm_event_t &event)
+{
+ Q_ASSERT(event.type == SND_PCM_EVENT_AUDIOMGMT_STATUS);
+ Q_ASSERT(event.data.audiomgmt_status.new_status == SND_PCM_STATUS_SUSPENDED);
+ return event.data.audiomgmt_status.flags & SND_PCM_STATUS_EVENT_HARD_SUSPEND
+ ? QAudio::InterruptedState : QAudio::SuspendedState;
+}
+
+void QnxAudioOutput::addPcmEventFilter()
+{
+ /* Enable PCM events */
+ snd_pcm_filter_t filter;
+ memset(&filter, 0, sizeof(filter));
+ filter.enable = (1<<SND_PCM_EVENT_AUDIOMGMT_STATUS) |
+ (1<<SND_PCM_EVENT_AUDIOMGMT_MUTE) |
+ (1<<SND_PCM_EVENT_OUTPUTCLASS);
+ snd_pcm_set_filter(m_pcmHandle, SND_PCM_CHANNEL_PLAYBACK, &filter);
+}
+
+void QnxAudioOutput::createPcmNotifiers()
+{
+ // QSocketNotifier::Read for poll based event dispatcher. Exception for
+ // select based event dispatcher.
+ m_pcmNotifier = new QSocketNotifier(snd_pcm_file_descriptor(m_pcmHandle,
+ SND_PCM_CHANNEL_PLAYBACK),
+ QSocketNotifier::Read, this);
+ connect(m_pcmNotifier, &QSocketNotifier::activated,
+ this, &QnxAudioOutput::pcmNotifierActivated);
+}
+
+void QnxAudioOutput::destroyPcmNotifiers()
+{
+ if (m_pcmNotifier) {
+ delete m_pcmNotifier;
+ m_pcmNotifier = 0;
+ }
+}
+
+void QnxAudioOutput::setTypeName(snd_pcm_channel_params_t *params)
+{
+ if (m_category.isEmpty())
+ return;
+
+ QByteArray latin1Category = m_category.toLatin1();
+
+ if (QString::fromLatin1(latin1Category) != m_category) {
+ qWarning("QnxAudioOutput: audio category name isn't a Latin1 string.");
+ return;
+ }
+
+ if (latin1Category.size() >= static_cast<int>(sizeof(params->audio_type_name))) {
+ qWarning("QnxAudioOutput: audio category name too long.");
+ return;
+ }
+
+ strcpy(params->audio_type_name, latin1Category.constData());
+}
+
+void QnxAudioOutput::pcmNotifierActivated(int socket)
+{
+ Q_UNUSED(socket);
+
+ snd_pcm_event_t pcm_event;
+ memset(&pcm_event, 0, sizeof(pcm_event));
+ while (snd_pcm_channel_read_event(m_pcmHandle, SND_PCM_CHANNEL_PLAYBACK, &pcm_event) == 0) {
+ if (pcm_event.type == SND_PCM_EVENT_AUDIOMGMT_STATUS) {
+ if (pcm_event.data.audiomgmt_status.new_status == SND_PCM_STATUS_SUSPENDED)
+ suspendInternal(suspendState(pcm_event));
+ else if (pcm_event.data.audiomgmt_status.new_status == SND_PCM_STATUS_RUNNING)
+ resumeInternal();
+ else if (pcm_event.data.audiomgmt_status.new_status == SND_PCM_STATUS_PAUSED)
+ suspendInternal(QAudio::SuspendedState);
+ }
+ }
+}
+
+#else
+
+void QnxAudioOutput::addPcmEventFilter() {}
+void QnxAudioOutput::createPcmNotifiers() {}
+void QnxAudioOutput::destroyPcmNotifiers() {}
+void QnxAudioOutput::setTypeName(snd_pcm_channel_params_t *) {}
+
+#endif
+
QnxPushIODevice::QnxPushIODevice(QnxAudioOutput *output)
: QIODevice(output),
m_output(output)
diff --git a/src/plugins/qnx-audio/audio/qnxaudiooutput.h b/src/plugins/qnx-audio/audio/qnxaudiooutput.h
index 5ee69b542..85aadf4b9 100644
--- a/src/plugins/qnx-audio/audio/qnxaudiooutput.h
+++ b/src/plugins/qnx-audio/audio/qnxaudiooutput.h
@@ -45,8 +45,10 @@
#include <QTime>
#include <QTimer>
#include <QIODevice>
+#include <QSocketNotifier>
#include <sys/asoundlib.h>
+#include <sys/neutrino.h>
QT_BEGIN_NAMESPACE
@@ -80,6 +82,8 @@ public:
QAudioFormat format() const Q_DECL_OVERRIDE;
void setVolume(qreal volume) Q_DECL_OVERRIDE;
qreal volume() const Q_DECL_OVERRIDE;
+ void setCategory(const QString &category) Q_DECL_OVERRIDE;
+ QString category() const Q_DECL_OVERRIDE;
private slots:
void pullData();
@@ -90,6 +94,14 @@ private:
void setError(QAudio::Error error);
void setState(QAudio::State state);
+ void addPcmEventFilter();
+ void createPcmNotifiers();
+ void destroyPcmNotifiers();
+ void setTypeName(snd_pcm_channel_params_t *params);
+
+ void suspendInternal(QAudio::State suspendState);
+ void resumeInternal();
+
friend class QnxPushIODevice;
qint64 write(const char *data, qint64 len);
@@ -102,6 +114,7 @@ private:
QAudio::State m_state;
QAudioFormat m_format;
qreal m_volume;
+ QString m_category;
int m_periodSize;
snd_pcm_t *m_pcmHandle;
@@ -109,6 +122,13 @@ private:
QTime m_startTimeStamp;
QTime m_intervalTimeStamp;
qint64 m_intervalOffset;
+
+#if _NTO_VERSION >= 700
+ QSocketNotifier *m_pcmNotifier;
+
+private slots:
+ void pcmNotifierActivated(int socket);
+#endif
};
class QnxPushIODevice : public QIODevice
diff --git a/src/plugins/qnx/mediaplayer/mediaplayer.pri b/src/plugins/qnx/mediaplayer/mediaplayer.pri
index 756857cce..0871f34bc 100644
--- a/src/plugins/qnx/mediaplayer/mediaplayer.pri
+++ b/src/plugins/qnx/mediaplayer/mediaplayer.pri
@@ -1,6 +1,7 @@
INCLUDEPATH += $$PWD
HEADERS += \
+ $$PWD/mmrendereraudiorolecontrol.h \
$$PWD/mmrenderermediaplayercontrol.h \
$$PWD/mmrenderermediaplayerservice.h \
$$PWD/mmrenderermetadata.h \
@@ -10,6 +11,7 @@ HEADERS += \
$$PWD/mmrenderervideowindowcontrol.h \
$$PWD/ppsmediaplayercontrol.h
SOURCES += \
+ $$PWD/mmrendereraudiorolecontrol.cpp \
$$PWD/mmrenderermediaplayercontrol.cpp \
$$PWD/mmrenderermediaplayerservice.cpp \
$$PWD/mmrenderermetadata.cpp \
diff --git a/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp b/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp
new file mode 100644
index 000000000..e470ed4c5
--- /dev/null
+++ b/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 QNX Software Systems. All rights reserved.
+** 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 "mmrendereraudiorolecontrol.h"
+#include "mmrendererutil.h"
+
+QT_BEGIN_NAMESPACE
+
+MmRendererAudioRoleControl::MmRendererAudioRoleControl(QObject *parent)
+ : QAudioRoleControl(parent)
+ , m_role(QAudio::UnknownRole)
+{
+}
+
+QAudio::Role MmRendererAudioRoleControl::audioRole() const
+{
+ return m_role;
+}
+
+void MmRendererAudioRoleControl::setAudioRole(QAudio::Role role)
+{
+ if (m_role != role) {
+ m_role = role;
+ emit audioRoleChanged(m_role);
+ }
+}
+
+QList<QAudio::Role> MmRendererAudioRoleControl::supportedAudioRoles() const
+{
+ return qnxSupportedAudioRoles();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h b/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h
new file mode 100644
index 000000000..7458d3512
--- /dev/null
+++ b/src/plugins/qnx/mediaplayer/mmrendereraudiorolecontrol.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 QNX Software Systems. All rights reserved.
+** 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 MMRENDERERAUDIOROLECONTROL_H
+#define MMRENDERERAUDIOROLECONTROL_H
+
+#include <qaudiorolecontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class MmRendererAudioRoleControl : public QAudioRoleControl
+{
+ Q_OBJECT
+public:
+ explicit MmRendererAudioRoleControl(QObject *parent = 0);
+
+ QAudio::Role audioRole() const Q_DECL_OVERRIDE;
+ void setAudioRole(QAudio::Role role) Q_DECL_OVERRIDE;
+
+ QList<QAudio::Role> supportedAudioRoles() const Q_DECL_OVERRIDE;
+
+private:
+ QAudio::Role m_role;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
index 5cd3bc3d2..0350958de 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
+++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp
@@ -36,6 +36,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+#include "mmrendereraudiorolecontrol.h"
#include "mmrenderermediaplayercontrol.h"
#include "mmrenderermetadatareadercontrol.h"
#include "mmrendererplayervideorenderercontrol.h"
@@ -70,7 +71,6 @@ MmRendererMediaPlayerControl::MmRendererMediaPlayerControl(QObject *parent)
m_mediaStatus(QMediaPlayer::NoMedia),
m_playAfterMediaLoaded(false),
m_inputAttached(false),
- m_stopEventsToIgnore(0),
m_bufferLevel(0)
{
m_loadingTimer.setSingleShot(true);
@@ -109,30 +109,12 @@ void MmRendererMediaPlayerControl::openConnection()
startMonitoring(m_id, m_contextName);
}
-void MmRendererMediaPlayerControl::handleMmStatusUpdate(qint64 newPosition)
-{
- // Prevent spurious position change events from overriding our own position, for example
- // when setting the position to 0 in stop().
- // Also, don't change the position while we're loading the media, as then play() would
- // set a wrong initial position.
- if (m_state != QMediaPlayer::PlayingState ||
- m_mediaStatus == QMediaPlayer::LoadingMedia ||
- m_mediaStatus == QMediaPlayer::NoMedia ||
- m_mediaStatus == QMediaPlayer::InvalidMedia)
- return;
-
- setMmPosition(newPosition);
-}
-
void MmRendererMediaPlayerControl::handleMmStopped()
{
// Only react to stop events that happen when the end of the stream is reached and
// playback is stopped because of this.
- // Ignore other stop event sources, souch as calling mmr_stop() ourselves and
- // mmr_input_attach().
- if (m_stopEventsToIgnore > 0) {
- --m_stopEventsToIgnore;
- } else {
+ // Ignore other stop event sources, such as calling mmr_stop() ourselves.
+ if (m_state != QMediaPlayer::StoppedState) {
setMediaStatus(QMediaPlayer::EndOfMedia);
stopInternal(IgnoreMmRenderer);
}
@@ -197,6 +179,17 @@ void MmRendererMediaPlayerControl::attach()
return;
}
+ if (m_audioId != -1 && m_audioRoleControl) {
+ QString audioType = qnxAudioType(m_audioRoleControl->audioRole());
+ QByteArray latin1AudioType = audioType.toLatin1();
+ if (!audioType.isEmpty() && latin1AudioType == audioType) {
+ strm_dict_t *dict = strm_dict_new();
+ dict = strm_dict_set(dict, "audio_type", latin1AudioType.constData());
+ if (mmr_output_parameters(m_context, m_audioId, dict) != 0)
+ emitMmError("mmr_output_parameters: Setting audio_type failed");
+ }
+ }
+
const QByteArray resourcePath = resourcePathForUrl(m_media.canonicalUrl());
if (resourcePath.isEmpty()) {
detach();
@@ -210,11 +203,6 @@ void MmRendererMediaPlayerControl::attach()
return;
}
- // For whatever reason, the mmrenderer sends out a MMR_STOPPED event when calling
- // mmr_input_attach() above. Ignore it, as otherwise we'll trigger stopping right after we
- // started.
- m_stopEventsToIgnore++;
-
m_inputAttached = true;
setMediaStatus(QMediaPlayer::LoadedMedia);
@@ -351,7 +339,6 @@ void MmRendererMediaPlayerControl::stopInternal(StopCommand stopCommand)
if (m_state != QMediaPlayer::StoppedState) {
if (stopCommand == StopMmRenderer) {
- ++m_stopEventsToIgnore;
mmr_stop(m_context);
}
@@ -524,7 +511,6 @@ void MmRendererMediaPlayerControl::play()
return;
}
- m_stopEventsToIgnore = 0; // once playing, stop events must be proccessed
setState( QMediaPlayer::PlayingState);
}
@@ -561,6 +547,11 @@ void MmRendererMediaPlayerControl::setMetaDataReaderControl(MmRendererMetaDataRe
m_metaDataReaderControl = metaDataReaderControl;
}
+void MmRendererMediaPlayerControl::setAudioRoleControl(MmRendererAudioRoleControl *audioRoleControl)
+{
+ m_audioRoleControl = audioRoleControl;
+}
+
void MmRendererMediaPlayerControl::setMmPosition(qint64 newPosition)
{
if (newPosition != 0 && newPosition != m_position) {
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h
index 00f70db34..655570656 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h
+++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h
@@ -51,6 +51,7 @@ typedef struct mmrenderer_monitor mmrenderer_monitor_t;
QT_BEGIN_NAMESPACE
+class MmRendererAudioRoleControl;
class MmRendererMetaDataReaderControl;
class MmRendererPlayerVideoRendererControl;
class MmRendererVideoWindowControl;
@@ -102,6 +103,7 @@ public:
MmRendererVideoWindowControl *videoWindowControl() const;
void setVideoWindowControl(MmRendererVideoWindowControl *videoControl);
void setMetaDataReaderControl(MmRendererMetaDataReaderControl *metaDataReaderControl);
+ void setAudioRoleControl(MmRendererAudioRoleControl *audioRoleControl);
protected:
virtual void startMonitoring(int contextId, const QString &contextName) = 0;
@@ -115,7 +117,6 @@ protected:
void setMmBufferStatus(const QString &bufferStatus);
void setMmBufferLevel(const QString &bufferLevel);
void handleMmStopped();
- void handleMmStatusUpdate(qint64 position);
// must be called from subclass dtors (calls virtual function stopMonitoring())
void destroy();
@@ -154,13 +155,13 @@ private:
QPointer<MmRendererPlayerVideoRendererControl> m_videoRendererControl;
QPointer<MmRendererVideoWindowControl> m_videoWindowControl;
QPointer<MmRendererMetaDataReaderControl> m_metaDataReaderControl;
+ QPointer<MmRendererAudioRoleControl> m_audioRoleControl;
MmRendererMetaData m_metaData;
int m_id;
qint64 m_position;
QMediaPlayer::MediaStatus m_mediaStatus;
bool m_playAfterMediaLoaded;
bool m_inputAttached;
- int m_stopEventsToIgnore;
int m_bufferLevel;
QTimer m_loadingTimer;
};
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp
index e253c68d8..6136f9465 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp
+++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "mmrenderermediaplayerservice.h"
+#include "mmrendereraudiorolecontrol.h"
#include "mmrenderermediaplayercontrol.h"
#include "mmrenderermetadatareadercontrol.h"
#include "mmrendererplayervideorenderercontrol.h"
@@ -66,6 +67,7 @@ MmRendererMediaPlayerService::~MmRendererMediaPlayerService()
delete m_videoWindowControl;
delete m_mediaPlayerControl;
delete m_metaDataReaderControl;
+ delete m_audioRoleControl;
}
QMediaControl *MmRendererMediaPlayerService::requestControl(const char *name)
@@ -76,15 +78,19 @@ QMediaControl *MmRendererMediaPlayerService::requestControl(const char *name)
updateControls();
}
return m_mediaPlayerControl;
- }
- else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
+ } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
if (!m_metaDataReaderControl) {
m_metaDataReaderControl = new MmRendererMetaDataReaderControl();
updateControls();
}
return m_metaDataReaderControl;
- }
- else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
+ } else if (qstrcmp(name, QAudioRoleControl_iid) == 0) {
+ if (!m_audioRoleControl) {
+ m_audioRoleControl = new MmRendererAudioRoleControl();
+ updateControls();
+ }
+ return m_audioRoleControl;
+ } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
if (!m_appHasDrmPermissionChecked) {
m_appHasDrmPermission = checkForDrmPermission();
m_appHasDrmPermissionChecked = true;
@@ -102,8 +108,7 @@ QMediaControl *MmRendererMediaPlayerService::requestControl(const char *name)
updateControls();
}
return m_videoRendererControl;
- }
- else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
+ } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
if (!m_videoWindowControl) {
m_videoWindowControl = new MmRendererVideoWindowControl();
updateControls();
@@ -123,6 +128,8 @@ void MmRendererMediaPlayerService::releaseControl(QMediaControl *control)
m_mediaPlayerControl = 0;
if (control == m_metaDataReaderControl)
m_metaDataReaderControl = 0;
+ if (control == m_audioRoleControl)
+ m_audioRoleControl = 0;
delete control;
}
@@ -136,6 +143,9 @@ void MmRendererMediaPlayerService::updateControls()
if (m_metaDataReaderControl && m_mediaPlayerControl)
m_mediaPlayerControl->setMetaDataReaderControl(m_metaDataReaderControl);
+
+ if (m_audioRoleControl && m_mediaPlayerControl)
+ m_mediaPlayerControl->setAudioRoleControl(m_audioRoleControl);
}
QT_END_NAMESPACE
diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h
index de85293cb..9434b85b2 100644
--- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h
+++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h
@@ -44,6 +44,7 @@
QT_BEGIN_NAMESPACE
+class MmRendererAudioRoleControl;
class MmRendererMediaPlayerControl;
class MmRendererMetaDataReaderControl;
class MmRendererPlayerVideoRendererControl;
@@ -66,6 +67,7 @@ private:
QPointer<MmRendererVideoWindowControl> m_videoWindowControl;
QPointer<MmRendererMediaPlayerControl> m_mediaPlayerControl;
QPointer<MmRendererMetaDataReaderControl> m_metaDataReaderControl;
+ QPointer<MmRendererAudioRoleControl> m_audioRoleControl;
bool m_appHasDrmPermission : 1;
bool m_appHasDrmPermissionChecked : 1;
diff --git a/src/plugins/qnx/mediaplayer/mmrendererutil.cpp b/src/plugins/qnx/mediaplayer/mmrendererutil.cpp
index 239d9d52e..7a9f6393b 100644
--- a/src/plugins/qnx/mediaplayer/mmrendererutil.cpp
+++ b/src/plugins/qnx/mediaplayer/mmrendererutil.cpp
@@ -41,6 +41,11 @@
#include <QDebug>
#include <QDir>
#include <QFile>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonValue>
+#include <QMutex>
+#include <QMutex>
#include <QString>
#include <QXmlStreamReader>
@@ -85,6 +90,91 @@ static const MmError mmErrors[] = {
};
static const unsigned int numMmErrors = sizeof(mmErrors) / sizeof(MmError);
+static QBasicMutex roleMapMutex;
+static bool roleMapInitialized = false;
+static QString roleMap[QAudio::GameRole + 1];
+
+template <typename T, size_t N>
+constexpr size_t countof(T (&)[N])
+{
+ return N;
+}
+
+constexpr bool inBounds(QAudio::Role r)
+{
+ return r >= 0 && r < countof(roleMap);
+}
+
+QString keyValueMapsLocation()
+{
+ QByteArray qtKeyValueMaps = qgetenv("QT_KEY_VALUE_MAPS");
+ if (qtKeyValueMaps.isNull())
+ return QStringLiteral("/etc/qt/keyvaluemaps");
+ else
+ return qtKeyValueMaps;
+}
+
+QJsonObject loadMapObject(const QString &keyValueMapPath)
+{
+ QFile mapFile(keyValueMapsLocation() + keyValueMapPath);
+ if (mapFile.open(QIODevice::ReadOnly)) {
+ QByteArray mapFileContents = mapFile.readAll();
+ QJsonDocument mapDocument = QJsonDocument::fromJson(mapFileContents);
+ if (mapDocument.isObject()) {
+ QJsonObject mapObject = mapDocument.object();
+ return mapObject;
+ }
+ }
+ return QJsonObject();
+}
+
+static void loadRoleMap()
+{
+ QMutexLocker locker(&roleMapMutex);
+
+ if (!roleMapInitialized) {
+ QJsonObject mapObject = loadMapObject("/QAudio/Role.json");
+ if (!mapObject.isEmpty()) {
+ // Wrapping the loads in a switch like this ensures that anyone adding
+ // a new enumerator will be notified that this code must be updated. A
+ // compile error will occur because the enumerator is missing from the
+ // switch. A compile error will also occur if the enumerator used to
+ // size the mapping table isn't updated when a new enumerator is added.
+ // One or more enumerators will be outside the bounds of the array when
+ // the wrong enumerator is used to size the array.
+ //
+ // The code loads a mapping for each enumerator because role is set
+ // to UnknownRole and all the cases drop through to the next case.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic error "-Wswitch"
+#define loadRoleMapping(r) \
+ case QAudio::r: \
+ static_assert(inBounds(QAudio::r), #r " out-of-bounds." \
+ " Do you need to change the enumerator used to size the mapping table" \
+ " because you added new QAudio::Role enumerators?"); \
+ roleMap[QAudio::r] = mapObject.value(QLatin1String(#r)).toString();
+
+ QAudio::Role role = QAudio::UnknownRole;
+ switch (role) {
+ loadRoleMapping(UnknownRole);
+ loadRoleMapping(MusicRole);
+ loadRoleMapping(VideoRole);
+ loadRoleMapping(VoiceCommunicationRole);
+ loadRoleMapping(AlarmRole);
+ loadRoleMapping(NotificationRole);
+ loadRoleMapping(RingtoneRole);
+ loadRoleMapping(AccessibilityRole);
+ loadRoleMapping(SonificationRole);
+ loadRoleMapping(GameRole);
+ }
+#undef loadRoleMapping
+#pragma GCC diagnostic pop
+ }
+
+ roleMapInitialized = true;
+ }
+}
+
QString mmErrorMessage(const QString &msg, mmr_context_t *context, int *errorCode)
{
const mmr_error_info_t * const mmError = mmr_error_info(context);
@@ -124,4 +214,27 @@ bool checkForDrmPermission()
return false;
}
+QString qnxAudioType(QAudio::Role role)
+{
+ loadRoleMap();
+
+ if (role >= 0 && role < countof(roleMap))
+ return roleMap[role];
+ else
+ return QString();
+}
+
+QList<QAudio::Role> qnxSupportedAudioRoles()
+{
+ loadRoleMap();
+
+ QList<QAudio::Role> result;
+ for (size_t i = 0; i < countof(roleMap); ++i) {
+ if (!roleMap[i].isEmpty() || (i == QAudio::UnknownRole))
+ result.append(static_cast<QAudio::Role>(i));
+ }
+
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/qnx/mediaplayer/mmrendererutil.h b/src/plugins/qnx/mediaplayer/mmrendererutil.h
index 8017b2690..ac6f73a7d 100644
--- a/src/plugins/qnx/mediaplayer/mmrendererutil.h
+++ b/src/plugins/qnx/mediaplayer/mmrendererutil.h
@@ -40,6 +40,7 @@
#define MMRENDERERUTIL_H
#include <QtCore/qglobal.h>
+#include <QtMultimedia/qaudio.h>
typedef struct mmr_context mmr_context_t;
@@ -51,6 +52,9 @@ QString mmErrorMessage(const QString &msg, mmr_context_t *context, int * errorCo
bool checkForDrmPermission();
+QString qnxAudioType(QAudio::Role role);
+QList<QAudio::Role> qnxSupportedAudioRoles();
+
QT_END_NAMESPACE
#endif
diff --git a/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp
index de5e3e0cf..402461331 100644
--- a/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp
+++ b/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp
@@ -151,7 +151,7 @@ void PpsMediaPlayerControl::ppsReadyRead(int fd)
// nread is the real space necessary, not the amount read.
if (static_cast<size_t>(nread) > bufferSize - 1) {
//TODO emit error?
- qCritical("BBMediaPlayerControl: PPS buffer size too short; need %u.", nread + 1);
+ qCritical("PpsMediaPlayerControl: PPS buffer size too short; need %zd.", nread + 1);
return;
}
diff --git a/src/plugins/wmf/player/mfmetadatacontrol.cpp b/src/plugins/wmf/player/mfmetadatacontrol.cpp
index 01be95e84..ac57ccfb5 100644
--- a/src/plugins/wmf/player/mfmetadatacontrol.cpp
+++ b/src/plugins/wmf/player/mfmetadatacontrol.cpp
@@ -193,6 +193,11 @@ QVariant MFMetaDataControl::metaData(const QString &key) const
if (m_content && SUCCEEDED(m_content->GetValue(PKEY_Video_FrameWidth, &var)))
res.setWidth(convertValue(var).toUInt());
value = res;
+ } else if (key == QMediaMetaData::Orientation) {
+ uint orientation = 0;
+ if (m_content && SUCCEEDED(m_content->GetValue(PKEY_Video_Orientation, &var)))
+ orientation = convertValue(var).toUInt();
+ value = orientation;
} else if (key == QMediaMetaData::PixelAspectRatio) {
QSize aspectRatio;
aspectRatio.setWidth(value.toUInt());
@@ -352,6 +357,8 @@ void MFMetaDataControl::updateSource(IMFPresentationDescriptor* sourcePD, IMFMed
m_availableMetaDatas.push_back(QMediaMetaData::ThumbnailImage);
} else if (key == PKEY_Video_FrameHeight) {
m_availableMetaDatas.push_back(QMediaMetaData::Resolution);
+ } else if (key == PKEY_Video_Orientation) {
+ m_availableMetaDatas.push_back(QMediaMetaData::Orientation);
} else if (key == PKEY_Video_HorizontalAspectRatio) {
m_availableMetaDatas.push_back(QMediaMetaData::PixelAspectRatio);
} else if (key == PKEY_Video_FrameRate) {
diff --git a/src/qtmultimediaquicktools/qtmultimediaquicktools.pro b/src/qtmultimediaquicktools/qtmultimediaquicktools.pro
index e4e157a54..bffdc6ec2 100644
--- a/src/qtmultimediaquicktools/qtmultimediaquicktools.pro
+++ b/src/qtmultimediaquicktools/qtmultimediaquicktools.pro
@@ -1,4 +1,4 @@
-TARGET = QtMultimediaQuick_p
+TARGET = QtMultimediaQuick
QT = core quick multimedia-private
CONFIG += internal_module
diff --git a/sync.profile b/sync.profile
index 4623849da..2ac22b5bd 100644
--- a/sync.profile
+++ b/sync.profile
@@ -1,7 +1,8 @@
%modules = ( # path to module name map
"QtMultimedia" => "$basedir/src/multimedia",
"QtMultimediaWidgets" => "$basedir/src/multimediawidgets",
- "QtMultimediaQuick_p" => "$basedir/src/qtmultimediaquicktools",
+ "QtMultimediaQuick" => "$basedir/src/qtmultimediaquicktools",
+ "QtMultimediaGstTools" => "$basedir/src/gsttools",
);
%moduleheaders = ( # restrict the module headers to those found in relative path
diff --git a/tests/auto/integration/multimedia.pro b/tests/auto/integration/multimedia.pro
index de152d942..88960ec03 100644
--- a/tests/auto/integration/multimedia.pro
+++ b/tests/auto/integration/multimedia.pro
@@ -17,6 +17,3 @@ qtHaveModule(quick) {
}
!qtHaveModule(widgets): SUBDIRS -= qcamerabackend
-
-# QTBUG-60268
-boot2qt: SUBDIRS -= qdeclarativevideooutput_window
diff --git a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST b/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
index 8b6712728..316c5a083 100644
--- a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
+++ b/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
@@ -1,10 +1,2 @@
# QTBUG-56796
windows
-
-[fileTest]
-# QTBUG-60268
-b2qt
-
-[deviceTest]
-# QTBUG-60268
-b2qt
diff --git a/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro b/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro
index 7464a8aa2..672bcfa6a 100644
--- a/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro
+++ b/tests/auto/integration/qaudiodecoderbackend/qaudiodecoderbackend.pro
@@ -9,5 +9,13 @@ TESTDATA += testdata/*
INCLUDEPATH += \
../../../../src/multimedia/audio
+HEADERS += \
+ ../shared/mediafileselector.h
+
SOURCES += \
tst_qaudiodecoderbackend.cpp
+
+boot2qt: {
+ # Yocto sysroot does not have gstreamer/wav
+ QMAKE_CXXFLAGS += -DWAV_SUPPORT_NOT_FORCED
+}
diff --git a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
index 2af06b46c..1e582d14b 100644
--- a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
+++ b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
@@ -30,6 +30,8 @@
#include <QDebug>
#include "qaudiodecoder.h"
+#include "../shared/mediafileselector.h"
+
#define TEST_FILE_NAME "testdata/test.wav"
#define TEST_UNSUPPORTED_FILE_NAME "testdata/test-unsupported.avi"
#define TEST_CORRUPTED_FILE_NAME "testdata/test-corrupted.wav"
@@ -56,6 +58,9 @@ private slots:
void unsupportedFileTest();
void corruptedFileTest();
void deviceTest();
+
+private:
+ bool isWavSupported();
};
void tst_QAudioDecoderBackend::init()
@@ -67,14 +72,28 @@ void tst_QAudioDecoderBackend::initTestCase()
QAudioDecoder d;
if (!d.isAvailable())
QSKIP("Audio decoder service is not available");
+
+ qRegisterMetaType<QMediaContent>();
}
void tst_QAudioDecoderBackend::cleanup()
{
}
+bool tst_QAudioDecoderBackend::isWavSupported()
+{
+#ifdef WAV_SUPPORT_NOT_FORCED
+ return !MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA(TEST_FILE_NAME)).isNull();
+#else
+ return true;
+#endif
+}
+
void tst_QAudioDecoderBackend::fileTest()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QAudioDecoder d;
if (d.error() == QAudioDecoder::ServiceMissingError)
QSKIP("There is no audio decoding support on this platform.");
@@ -411,6 +430,9 @@ void tst_QAudioDecoderBackend::corruptedFileTest()
void tst_QAudioDecoderBackend::deviceTest()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QAudioDecoder d;
if (d.error() == QAudioDecoder::ServiceMissingError)
QSKIP("There is no audio decoding support on this platform.");
diff --git a/tests/auto/integration/qmediaplayerbackend/BLACKLIST b/tests/auto/integration/qmediaplayerbackend/BLACKLIST
index 4f8656e0a..8aa622881 100644
--- a/tests/auto/integration/qmediaplayerbackend/BLACKLIST
+++ b/tests/auto/integration/qmediaplayerbackend/BLACKLIST
@@ -9,13 +9,9 @@ opensuse-13.1 64bit
[loadMedia]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[unloadMedia]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[playPauseStop]
linux
@@ -23,18 +19,12 @@ windows 64bit developer-build
[processEOS]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[deleteLaterAtEOS]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[initialVolume]
windows 64bit developer-build
-# QTBUG-60268
-b2qt
[playlist]
redhatenterpriselinuxworkstation-6.6
@@ -53,7 +43,3 @@ redhatenterpriselinuxworkstation-6.6
[surfaceTest]
redhatenterpriselinuxworkstation-6.6
-
-[playlistObject]
-# QTBUG-60268
-b2qt
diff --git a/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro b/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro
index 87637fadc..b9417f7c2 100644
--- a/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro
+++ b/tests/auto/integration/qmediaplayerbackend/qmediaplayerbackend.pro
@@ -9,4 +9,14 @@ CONFIG += testcase
SOURCES += \
tst_qmediaplayerbackend.cpp
+HEADERS += \
+ ../shared/mediafileselector.h
+
TESTDATA += testdata/*
+
+boot2qt: {
+ # Yocto sysroot does not have gstreamer/wav
+ QMAKE_CXXFLAGS += -DWAV_SUPPORT_NOT_FORCED
+ # OGV testing is unstable with qemu
+ QMAKE_CXXFLAGS += -DSKIP_OGV_TEST
+}
diff --git a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
index fb72a239c..8e45a2ccb 100644
--- a/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
+++ b/tests/auto/integration/qmediaplayerbackend/tst_qmediaplayerbackend.cpp
@@ -36,6 +36,7 @@
#include <qmediaplaylist.h>
#include <qmediametadata.h>
+#include "../shared/mediafileselector.h"
//TESTED_COMPONENT=src/multimedia
QT_USE_NAMESPACE
@@ -78,7 +79,7 @@ private slots:
private:
QMediaContent selectVideoFile(const QStringList& mediaCandidates);
- QMediaContent selectMediaFile(const QStringList& mediaCandidates);
+ bool isWavSupported();
//one second local wav file
QMediaContent localWavFile;
@@ -170,31 +171,13 @@ QMediaContent tst_QMediaPlayerBackend::selectVideoFile(const QStringList& mediaC
return QMediaContent();
}
-QMediaContent tst_QMediaPlayerBackend::selectMediaFile(const QStringList& mediaCandidates)
+bool tst_QMediaPlayerBackend::isWavSupported()
{
- QMediaPlayer player;
-
- QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error)));
-
- foreach (QString s, mediaCandidates) {
- QFileInfo mediaFile(s);
- if (!mediaFile.exists())
- continue;
- QMediaContent media = QMediaContent(QUrl::fromLocalFile(mediaFile.absoluteFilePath()));
- player.setMedia(media);
- player.play();
-
- for (int i = 0; i < 2000 && player.mediaStatus() != QMediaPlayer::BufferedMedia && errorSpy.isEmpty(); i+=50) {
- QTest::qWait(50);
- }
-
- if (player.mediaStatus() == QMediaPlayer::BufferedMedia && errorSpy.isEmpty()) {
- return media;
- }
- errorSpy.clear();
- }
-
- return QMediaContent();
+#ifdef WAV_SUPPORT_NOT_FORCED
+ return !localWavFile.isNull();
+#else
+ return true;
+#endif
}
void tst_QMediaPlayerBackend::initTestCase()
@@ -203,33 +186,24 @@ void tst_QMediaPlayerBackend::initTestCase()
if (!player.isAvailable())
QSKIP("Media player service is not available");
- const QString testFileName = QFINDTESTDATA("testdata/test.wav");
- QFileInfo wavFile(testFileName);
-
- QVERIFY(wavFile.exists());
-
- localWavFile = QMediaContent(QUrl::fromLocalFile(wavFile.absoluteFilePath()));
-
- const QString testFileName2 = QFINDTESTDATA("testdata/_test.wav");
- QFileInfo wavFile2(testFileName2);
-
- QVERIFY(wavFile2.exists());
-
- localWavFile2 = QMediaContent(QUrl::fromLocalFile(wavFile2.absoluteFilePath()));
-
qRegisterMetaType<QMediaContent>();
+ localWavFile = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/test.wav"));
+ localWavFile2 = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/_test.wav"));;
+
QStringList mediaCandidates;
mediaCandidates << QFINDTESTDATA("testdata/colors.mp4");
+#ifndef SKIP_OGV_TEST
mediaCandidates << QFINDTESTDATA("testdata/colors.ogv");
- localVideoFile = selectMediaFile(mediaCandidates);
+#endif
+ localVideoFile = MediaFileSelector::selectMediaFile(mediaCandidates);
mediaCandidates.clear();
mediaCandidates << QFINDTESTDATA("testdata/nokia-tune.mp3");
mediaCandidates << QFINDTESTDATA("testdata/nokia-tune.mkv");
- localCompressedSoundFile = selectMediaFile(mediaCandidates);
+ localCompressedSoundFile = MediaFileSelector::selectMediaFile(mediaCandidates);
- localFileWithMetadata = selectMediaFile(QStringList() << QFINDTESTDATA("testdata/nokia-tune.mp3"));
+ localFileWithMetadata = MediaFileSelector::selectMediaFile(QStringList() << QFINDTESTDATA("testdata/nokia-tune.mp3"));
qgetenv("QT_TEST_CI").toInt(&m_inCISystem,10);
}
@@ -246,7 +220,11 @@ void tst_QMediaPlayerBackend::construction()
void tst_QMediaPlayerBackend::loadMedia()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
+
QCOMPARE(player.state(), QMediaPlayer::StoppedState);
QCOMPARE(player.mediaStatus(), QMediaPlayer::NoMedia);
@@ -278,6 +256,9 @@ void tst_QMediaPlayerBackend::loadMedia()
void tst_QMediaPlayerBackend::unloadMedia()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
player.setNotifyInterval(50);
@@ -326,6 +307,9 @@ void tst_QMediaPlayerBackend::unloadMedia()
void tst_QMediaPlayerBackend::playPauseStop()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
player.setNotifyInterval(50);
@@ -478,6 +462,9 @@ void tst_QMediaPlayerBackend::playPauseStop()
void tst_QMediaPlayerBackend::processEOS()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
player.setNotifyInterval(50);
@@ -610,6 +597,9 @@ private:
// QTBUG-24927 - deleteLater() called to QMediaPlayer from its signal handler does not work as expected
void tst_QMediaPlayerBackend::deleteLaterAtEOS()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QPointer<QMediaPlayer> player(new QMediaPlayer);
DeleteLaterAtEos deleter(player);
player->setMedia(localWavFile);
@@ -734,6 +724,9 @@ void tst_QMediaPlayerBackend::volumeAcrossFiles()
void tst_QMediaPlayerBackend::initialVolume()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
{
QMediaPlayer player;
player.setVolume(1);
@@ -1193,6 +1186,9 @@ void tst_QMediaPlayerBackend::playlist()
void tst_QMediaPlayerBackend::playlistObject()
{
+ if (!isWavSupported())
+ QSKIP("Sound format is not supported");
+
QMediaPlayer player;
QSignalSpy mediaSpy(&player, SIGNAL(mediaChanged(QMediaContent)));
diff --git a/tests/auto/integration/shared/mediafileselector.h b/tests/auto/integration/shared/mediafileselector.h
new file mode 100644
index 000000000..8b88d14a4
--- /dev/null
+++ b/tests/auto/integration/shared/mediafileselector.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite 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$
+**
+****************************************************************************/
+
+#ifndef MEDIAFILESELECTOR_H
+#define MEDIAFILESELECTOR_H
+
+#include <QMediaContent>
+#include <QMediaPlayer>
+
+QT_BEGIN_NAMESPACE
+
+namespace MediaFileSelector {
+
+static QMediaContent selectMediaFile(const QStringList& mediaCandidates)
+{
+ QMediaPlayer player;
+
+ QSignalSpy errorSpy(&player, SIGNAL(error(QMediaPlayer::Error)));
+
+ foreach (QString s, mediaCandidates) {
+ QFileInfo mediaFile(s);
+ if (!mediaFile.exists())
+ continue;
+ QMediaContent media = QMediaContent(QUrl::fromLocalFile(mediaFile.absoluteFilePath()));
+ player.setMedia(media);
+ player.play();
+
+ for (int i = 0; i < 2000 && player.mediaStatus() != QMediaPlayer::BufferedMedia && errorSpy.isEmpty(); i+=50) {
+ QTest::qWait(50);
+ }
+
+ if (player.mediaStatus() == QMediaPlayer::BufferedMedia && errorSpy.isEmpty()) {
+ return media;
+ }
+ errorSpy.clear();
+ }
+
+ return QMediaContent();
+}
+
+} // MediaFileSelector namespace
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
index 4b2136a5c..c2f18d2a4 100644
--- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
@@ -557,6 +557,11 @@ void tst_QPainterVideoSurface::shaderType()
{
QPainterVideoSurface surface;
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -649,6 +654,11 @@ void tst_QPainterVideoSurface::shaderTypeStarted()
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -894,6 +904,11 @@ void tst_QPainterVideoSurface::shaderSupportedFormat()
QFETCH(bool, supportedFormat);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -1011,6 +1026,11 @@ void tst_QPainterVideoSurface::shaderPresent()
QFETCH(int, bytesPerLineB);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -1142,6 +1162,11 @@ void tst_QPainterVideoSurface::shaderPresentOpaqueFrame()
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();
@@ -1191,6 +1216,11 @@ void tst_QPainterVideoSurface::shaderPresentGLFrame()
QFETCH(QPainterVideoSurface::ShaderType, shaderType);
QGLWidget widget;
+ if (!widget.context()
+ || !widget.context()->isValid()) {
+ QSKIP("Platform does not support GLContext");
+ }
+
widget.show();
QTest::qWaitForWindowExposed(&widget);
widget.makeCurrent();