diff options
authorRoman Gilg <[email protected]>2016-12-15 13:15:58 +0100
committerRoman Gilg <[email protected]>2016-12-15 13:23:06 +0100
commitd78b63b9ea7763dda37b9d790a0281e7137a6d1c (patch)
parent1463f43ed81453849de0c1c7465367799f17ddc3 (diff)
[MPRIS Dataengine] Export process id of player instance as separate data entry
The MPRIS specification recommends to media players to distinguish instances of them by appending its process id. For example this is supported by the Dragon Player. The patch makes it possible for connected clients of MPRIS Dataengine to query this directly and by that distinguish multiple instances of a player. While clients were able to do this earlier already by checking the source name and doing the same string operations as here, it's more convenient with this patch, since they then don't have to do it on their own anymore but just need to query the data. Reviewers: #Plasma, davidedmundson Tags: #Plasma Differential Revision:
1 files changed, 9 insertions, 0 deletions
diff --git a/dataengines/mpris2/playercontainer.cpp b/dataengines/mpris2/playercontainer.cpp
index fc1b6e3..7df7adc 100644
--- a/dataengines/mpris2/playercontainer.cpp
+++ b/dataengines/mpris2/playercontainer.cpp
@@ -113,6 +113,15 @@ PlayerContainer::PlayerContainer(const QString& busAddress, QObject* parent)
+ // MPRIS specifies, that in case a player supports several instances, each additional
+ // instance after the first one is supposed to append ".instance<pid>" at the end of
+ // its dbus address. So instances of media players, which implement this correctly
+ // can have one D-Bus connection per instance and can be identified by their pids.
+ QDBusReply<uint> pidReply = QDBusConnection::sessionBus().interface()->servicePid(busAddress);
+ if (pidReply.isValid()) {
+ setData("InstancePid", pidReply.value());
+ }
m_propsIface = new OrgFreedesktopDBusPropertiesInterface(
busAddress, MPRIS2_PATH,
QDBusConnection::sessionBus(), this);