kdeconnect-kde/plugins/mpriscontrol
Friedrich W. H. Kossebau 72fc67ee05 MPRIS control: do not accumulate interface objects
Summary:
If MPRIS players were appearing and disappearing multiple times, the
OrgFreedesktopDBusPropertiesInterface & OrgMprisMediaPlayer2PlayerInterface
instances created for listening to the signals had been accumulating and
thus resulting in X signals per X restarted player, because the instances
were not deleted when a player disappeared.
Additionally were instances of them created on the fly on the stack in
some of the methods, instead of reusing the existing ones.

This patch changes that by introducing a class MprisPlayer which holds all
data & instances per player. This allows to look up the respective
interfaces instances to reuse them as well as properly controlling their
lifetime.

Test Plan:
Starting and restarting multiple MPRIS players (incl. multiple instances of
the same player app) works as expected as befire. They are listed on the
Android Media control as well as have proper states there when selected.
Additionally no longer multiple change signals are emitted if restarting a
player.

Reviewers: #kde_connect, mtijink

Reviewed By: #kde_connect, mtijink

Subscribers: mtijink

Differential Revision: https://phabricator.kde.org/D11389
2018-03-16 23:53:40 +01:00
..
CMakeLists.txt Revert "Add album art support for mpris plugin" 2016-12-08 23:49:59 +01:00
kdeconnect_mpriscontrol.json Rename NetworkPackage -> NetworkPacket 2018-03-05 20:03:23 +01:00
mpriscontrolplugin.cpp MPRIS control: do not accumulate interface objects 2018-03-16 23:53:40 +01:00
mpriscontrolplugin.h MPRIS control: do not accumulate interface objects 2018-03-16 23:53:40 +01:00
mprisdbusinterface.xml Maybe fix build with old version of Qt (or Dbus, not sure) 2017-01-05 00:35:01 +01:00
propertiesInterface.xml Maybe fix build with old version of Qt (or Dbus, not sure) 2017-01-05 00:35:01 +01:00
README Move the plugins into a different top-ĺevel directory 2014-06-14 16:34:11 +02:00

This plugin controls the playback of mpris-enabled applications in this device,
commanded by its counterpart in the other device that acts as a remote control.
That means both plugins are not symmetrical.

This plugins receives and sends packages with type kdeconnect.mpris.

It keeps a list of detected players it can control via MPRIS. When it receives
a package that contains the boolean "requestPlayerList" set to true, it will
send back the list of players in an array named "playerList". If a new player is
detected or a known one dissappears, it should also send this list. Note that
players are identified only by its name (its MPRIS Identity), so there can not
be two players with the same display name.

This plugins also reports the current song, extracted from MPRIS Metadata. It
should send it when it changes or when receiving a package containing a boolean
"requestNowPlaying" set to true.

The remote devices can send packages with commands to one of the players. Those
packages will contain a string "player" with the name of the player they want to
command and a string "action" with the name of an MPRIS call (like "Play",
"Next"...).

This plugin can also control the system volume. The peer device can send a
package with "requestVolume" set to true to ask for the current volume, or send
a package with "setVolume" set to an integer in the range [0,100] to change it.