No way to advertise an interface?

Anders Feder anders.feder.83 at gmail.com
Wed Sep 29 07:57:58 UTC 2021


No, that is the rub. In the example with two applications both deciding to
take the bus name “org.mpris.MediaPlayer2.musicplayer”, you do in fact need
both to available on the bus at the same time. Because otherwise one of
them precludes the other from being controlled by clients.

It is currently possible to have for instance VLC and Spotify both running
and both controllable via MPRIS at the same time. But this is only possible
because they happen to have different names and their programmers therefore
have chosen to take different bus names.

If they had chosen to take same bus name because they were not aware of
each other, then one would either replace the other on the other bus or
have to wait in queue as you say, thus preventing one of them from being
controlled this way.

The way MPRIS is designed, the programmer must choose a bus name and can
then only pray that no other media player will try to use the same name. In
my view, this is not a good design. I would be interested to understand if
a better design could be made or if D-Bus could be extended to support this
scenario or if not why not.

Regards,
Anders Feder

ons. 29. sep. 2021 09.27 skrev Lawrence D'Oliveiro <ldo at geek-central.gen.nz
>:

> On Wed, 29 Sep 2021 08:03:20 +0200, Anders Feder wrote:
>
> > If a person A creates an application named "Music Player" and have it
> > take the bus name "org.mpris.MediaPlayer2.musicplayer", there is no
> > procedure preventing a person B without knowledge of person A's
> > application from creating another application named "Music Player"
> > also taking the bus name "org.mpris.MediaPlayer2.musicplayer".
>
> It is true that D-Bus has no concept of “group” or “multicast” names;
> each name can belong to only one bus peer. But remember that, if you do
> not specify DBUS_NAME_FLAG_DO_NOT_QUEUE when trying to register a name
> and it is already taken, then you will be placed in a queue to get it
> when the existing owner relinquishes it.
>
> That way, anybody looking for “org.mpris.MediaPlayer2.musicplayer” only
> sees one. Quit that one, and the other should appear. After all, you
> only need one at a time, don’t you?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20210929/2fd203f7/attachment.htm>


More information about the dbus mailing list