Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I2cba36426d8af40f94712f7f05f4e0dd4efce6e7
This commit is contained in:
@@ -702,7 +702,7 @@ void QAudioOutputPrivate::setVolume(qreal v)
|
|||||||
volumeCache = normalizedVolume;
|
volumeCache = normalizedVolume;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const qint16 scaled = normalizedVolume * 0xFFFF;
|
const quint16 scaled = normalizedVolume * 0xFFFF;
|
||||||
DWORD vol = MAKELONG(scaled, scaled);
|
DWORD vol = MAKELONG(scaled, scaled);
|
||||||
MMRESULT res = waveOutSetVolume(hWaveOut, vol);
|
MMRESULT res = waveOutSetVolume(hWaveOut, vol);
|
||||||
if (res == MMSYSERR_NOERROR)
|
if (res == MMSYSERR_NOERROR)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void BbMediaPlayerControl::closeConnection()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BbMediaPlayerControl::resourcePathForUrl(const QUrl &url)
|
QByteArray BbMediaPlayerControl::resourcePathForUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
// If this is a local file, mmrenderer expects the file:// prefix and an absolute path.
|
// If this is a local file, mmrenderer expects the file:// prefix and an absolute path.
|
||||||
// We treat URLs without scheme as local files, most likely someone just forgot to set the
|
// We treat URLs without scheme as local files, most likely someone just forgot to set the
|
||||||
@@ -149,7 +149,7 @@ QString BbMediaPlayerControl::resourcePathForUrl(const QUrl &url)
|
|||||||
else
|
else
|
||||||
relativeFilePath = url.path();
|
relativeFilePath = url.path();
|
||||||
const QFileInfo fileInfo(relativeFilePath);
|
const QFileInfo fileInfo(relativeFilePath);
|
||||||
return QStringLiteral("file://") + fileInfo.absoluteFilePath();
|
return QFile::encodeName(QStringLiteral("file://") + fileInfo.absoluteFilePath());
|
||||||
|
|
||||||
// QRC, copy to temporary file, as mmrenderer does not support resource files
|
// QRC, copy to temporary file, as mmrenderer does not support resource files
|
||||||
} else if (url.scheme() == QStringLiteral("qrc")) {
|
} else if (url.scheme() == QStringLiteral("qrc")) {
|
||||||
@@ -159,17 +159,17 @@ QString BbMediaPlayerControl::resourcePathForUrl(const QUrl &url)
|
|||||||
QUuid::createUuid().toString() + QStringLiteral(".") +
|
QUuid::createUuid().toString() + QStringLiteral(".") +
|
||||||
resourceFileInfo.suffix();
|
resourceFileInfo.suffix();
|
||||||
if (!QFile::copy(qrcPath, m_tempMediaFileName)) {
|
if (!QFile::copy(qrcPath, m_tempMediaFileName)) {
|
||||||
const QString errorMsg =
|
const QString errorMsg = QString("Failed to copy resource file to temporary file "
|
||||||
QString("Failed to copy resource file to temporary file %1 for playback").arg(m_tempMediaFileName);
|
"%1 for playback").arg(m_tempMediaFileName);
|
||||||
qDebug() << errorMsg;
|
qDebug() << errorMsg;
|
||||||
emit error(0, errorMsg);
|
emit error(0, errorMsg);
|
||||||
return QString();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
return m_tempMediaFileName;
|
return QFile::encodeName(m_tempMediaFileName);
|
||||||
|
|
||||||
// HTTP or similar URL, use as-is
|
// HTTP or similar URL
|
||||||
} else {
|
} else {
|
||||||
return url.toString();
|
return url.toEncoded();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,14 +195,14 @@ void BbMediaPlayerControl::attach()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString resourcePath = resourcePathForUrl(m_media.canonicalUrl());
|
const QByteArray resourcePath = resourcePathForUrl(m_media.canonicalUrl());
|
||||||
if (resourcePath.isEmpty()) {
|
if (resourcePath.isEmpty()) {
|
||||||
detach();
|
detach();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mmr_input_attach(m_context, QFile::encodeName(resourcePath), "track") != 0) {
|
if (mmr_input_attach(m_context, resourcePath.constData(), "track") != 0) {
|
||||||
emitMmError(QString("mmr_input_attach() for %1 failed").arg(resourcePath));
|
emitMmError(QStringLiteral("mmr_input_attach() failed for ") + QString(resourcePath));
|
||||||
setMediaStatus(QMediaPlayer::InvalidMedia);
|
setMediaStatus(QMediaPlayer::InvalidMedia);
|
||||||
detach();
|
detach();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ private Q_SLOTS:
|
|||||||
void continueLoadMedia();
|
void continueLoadMedia();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString resourcePathForUrl(const QUrl &url);
|
QByteArray resourcePathForUrl(const QUrl &url);
|
||||||
void openConnection();
|
void openConnection();
|
||||||
void closeConnection();
|
void closeConnection();
|
||||||
void attach();
|
void attach();
|
||||||
|
|||||||
Reference in New Issue
Block a user