[MPlayer-dev-eng] communicating to mplayer via the dbus mediaplayer2 interface

Alexander Strasser eclipse7 at gmx.net
Mon Dec 18 23:53:01 EET 2017


Hi Enrico,

sorry for this late'ish reply.


On 2017-12-06 09:58 +0100, Enrico Guiraud wrote:
>
> I use mplayer daily as audio player -- thank you for your work!

  I am glad hearing MPlayer works for you and that you use it nearly
every day.


> I also use other applications that would like to communicate to my audio
> player

  Like you have fired up your MPlayer instance playing audio
and you want it to be visible to and controllable by those
mentioned other applications?


> via dbus, specifically using the MediaPlayer2
> <https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html>
> interface specification.
> So I'm about to set off to write a small python wrapper for mplayer that
> makes it compatible with this interface.

  The specification seems to be developed and/or used since some time.
I did quickly have a glance at VLC's implementation, which seemed not
that simple with about 3k lines of C code. And that is within VLC
which I assume has a clean and versatile library interface to its
player core. So most of that code should be implementation of logic
demanded by the mpris spec itself and the necessary interfacing via DBUS
plus some locking.

  Also AFAICT VLC implementation covers most of the Root, Player and
TrackList objects, but the Playlist object seems not to be covered.


> My question is whether this is something that has already been done by
> someone somewhere or whether there are intrinsic limitations or fundamental
> reasons why I should not do this.

  I don't know of any attempts. Also I don't know if it can be done
with MPlayer as of today.

  If you are attempting to implement this on top of MPlayer, I would
advise you to first figure out the minimum subset, that still satisfies
the mpris spec. Then find out if that minimal implementation would be
useful to you in a sense that it would enable you to do things you
currently can't (via the applications you mentioned above). E.g. look
at those application's docs or probably better sources, and what parts
of the mpris interface they absolutely require to provide interesting
features to you.

  If that seems not worth it, it might be best to either not try it
at all or to try harder and deep dive into the matter trying to get
more insight about the feasibility. Though of course you could always
try, if you don't mind that the time might be wasted in some ways :)

  Using slave mode should be the best bet for you to interface with
a running MPlayer instance. For details start reading DOCS/tech/slave.txt
in MPlayer's source tree.

> Thanks in advance for any feedback you might provide!

  If you really try to do it, feel free to post some feedback here
on how far you have come and how pleased you are with the results.


  Alexander


More information about the MPlayer-dev-eng mailing list