Add support for MPRIS playback rate
This will ensure that the playback position can be accurately extrapolated for playback rates other than 1.0.
This commit is contained in:
parent
bbac0aa085
commit
d8cdea9c9b
1 changed files with 10 additions and 0 deletions
|
@ -163,6 +163,10 @@ void MprisControlPlugin::propertiesChanged(const QString &propertyInterface, con
|
||||||
np.set(QStringLiteral("loopStatus"), properties[QStringLiteral("LoopStatus")]);
|
np.set(QStringLiteral("loopStatus"), properties[QStringLiteral("LoopStatus")]);
|
||||||
somethingToSend = true;
|
somethingToSend = true;
|
||||||
}
|
}
|
||||||
|
if (properties.contains(QStringLiteral("Rate"))) {
|
||||||
|
np.set(QStringLiteral("rate"), properties[QStringLiteral("Rate")].toDouble());
|
||||||
|
somethingToSend = true;
|
||||||
|
}
|
||||||
if (properties.contains(QStringLiteral("Shuffle"))) {
|
if (properties.contains(QStringLiteral("Shuffle"))) {
|
||||||
np.set(QStringLiteral("shuffle"), properties[QStringLiteral("Shuffle")].toBool());
|
np.set(QStringLiteral("shuffle"), properties[QStringLiteral("Shuffle")].toBool());
|
||||||
somethingToSend = true;
|
somethingToSend = true;
|
||||||
|
@ -293,6 +297,11 @@ bool MprisControlPlugin::receivePacket(const NetworkPacket &np)
|
||||||
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting loopStatus" << loopStatus << "to" << serviceName;
|
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting loopStatus" << loopStatus << "to" << serviceName;
|
||||||
mprisInterface.setLoopStatus(loopStatus);
|
mprisInterface.setLoopStatus(loopStatus);
|
||||||
}
|
}
|
||||||
|
if (np.has(QStringLiteral("setRate"))) {
|
||||||
|
double rate = np.get<double>(QStringLiteral("setRate"));
|
||||||
|
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting rate" << rate << "to" << serviceName;
|
||||||
|
mprisInterface.setRate(rate);
|
||||||
|
}
|
||||||
if (np.has(QStringLiteral("setShuffle"))) {
|
if (np.has(QStringLiteral("setShuffle"))) {
|
||||||
bool shuffle = np.get<bool>(QStringLiteral("setShuffle"));
|
bool shuffle = np.get<bool>(QStringLiteral("setShuffle"));
|
||||||
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting shuffle" << shuffle << "to" << serviceName;
|
qCDebug(KDECONNECT_PLUGIN_MPRIS) << "Setting shuffle" << shuffle << "to" << serviceName;
|
||||||
|
@ -334,6 +343,7 @@ bool MprisControlPlugin::receivePacket(const NetworkPacket &np)
|
||||||
answer.set(QStringLiteral("canGoNext"), mprisInterface.canGoNext());
|
answer.set(QStringLiteral("canGoNext"), mprisInterface.canGoNext());
|
||||||
answer.set(QStringLiteral("canGoPrevious"), mprisInterface.canGoPrevious());
|
answer.set(QStringLiteral("canGoPrevious"), mprisInterface.canGoPrevious());
|
||||||
answer.set(QStringLiteral("canSeek"), mprisInterface.canSeek());
|
answer.set(QStringLiteral("canSeek"), mprisInterface.canSeek());
|
||||||
|
answer.set(QStringLiteral("rate"), mprisInterface.rate());
|
||||||
|
|
||||||
// LoopStatus is an optional field
|
// LoopStatus is an optional field
|
||||||
if (mprisInterface.property("LoopStatus").isValid()) {
|
if (mprisInterface.property("LoopStatus").isValid()) {
|
||||||
|
|
Loading…
Reference in a new issue