Difference between revisions of "DBus-spec"
(→amarok) |
|||
Line 4: | Line 4: | ||
<span style="color: red; font-weight: bold">VLC DOES NOT USE THAT AT THIS MOMENT ALTHOUGH IT IS PLANNED</span> | <span style="color: red; font-weight: bold">VLC DOES NOT USE THAT AT THIS MOMENT ALTHOUGH IT IS PLANNED</span> | ||
− | |||
− | |||
What follows has been largely stolen from http://bmpx.beep-media-player.org/site/MPRIS_Interfacing_Specification | What follows has been largely stolen from http://bmpx.beep-media-player.org/site/MPRIS_Interfacing_Specification | ||
Line 14: | Line 12: | ||
= Other players = | = Other players = | ||
+ | |||
+ | How other "Media Players" interact with D-Bus | ||
== bmpx == | == bmpx == | ||
Line 34: | Line 34: | ||
http://amarok.kde.org/wiki/DCOP_Functions | http://amarok.kde.org/wiki/DCOP_Functions | ||
− | ( | + | (D-Bus will replace dcop in kde4 ?) |
= Definitions = | = Definitions = | ||
Line 40: | Line 40: | ||
== "Media Player" == | == "Media Player" == | ||
− | An application, either with GUI or GUI-less (or which allows for both modes of operation) which is capable of playing back audio streams. The means by which it does accomplish that (e.g. which audio backend to use, and which output method) is | + | An application, either with GUI or GUI-less (or which allows for both modes of operation) which is capable of playing back audio/video streams. The means by which it does accomplish that (e.g. which audio backend to use, and which output method) is out of the scope of this document. |
<br/><br/> | <br/><br/> | ||
The "Media Player" '''must''': | The "Media Player" '''must''': | ||
* Be able to play back at least local storage file streams. | * Be able to play back at least local storage file streams. | ||
− | * Be able to play back at least one stream at a time | + | * Be able to play back at least one stream at a time. |
The "Media Player" '''can''', but does not '''need''' to: | The "Media Player" '''can''', but does not '''need''' to: | ||
Line 53: | Line 53: | ||
The Client is an unspecified application that will interact with the "Media Player" using D-Bus protocol. | The Client is an unspecified application that will interact with the "Media Player" using D-Bus protocol. | ||
− | For example | + | For example: |
− | + | ||
+ | * A softphone, that pauses, or step the volume down, when a call is being received. | ||
+ | * An applet that nicely integrates in your desktop environment, to control your "Media Player". | ||
+ | * An instant messaging client which informs your buddies of what you're listening to. | ||
+ | * A monitor that stores in a database what you are listening to, for statistics purpose. | ||
+ | * A video editing software that calls an external "Media Player" to preview your work. | ||
== "Tracklist" == | == "Tracklist" == | ||
Line 74: | Line 79: | ||
1) Technical metadata: ( to be implemented with a struct ) | 1) Technical metadata: ( to be implemented with a struct ) | ||
− | * Length | + | * URI (string) |
− | * ( | + | * Length |
− | * codec | + | * video codec (fourcc, 4 characters) |
+ | * audio codec (fourcc, 4 characters) | ||
* bitrate | * bitrate | ||
* samplerate | * samplerate | ||
− | |||
− | |||
− | |||
− | 2) Informational metadata ( to be implemented as an array of dict entries ) | + | 2) Informational metadata ( to be implemented as an array of dict entries (string, string) ) |
− | * Name | + | * "Name" |
− | * Artist | + | * "Artist" |
− | * | + | * "Album" |
− | * Unique Identifier as on http://musicbrainz.org | + | * "UID" : Unique Identifier as on http://musicbrainz.org |
− | * Genre | + | * "Genre" |
− | * | + | * (This is extensible) |
= D-Bus = | = D-Bus = | ||
Line 118: | Line 121: | ||
* /TrackList | * /TrackList | ||
− | + | GetMetadata : Gives all meta data available for element at given position in the "TrackList" | |
− | + | <method name="GetMetadata"> | |
− | + | <arg type="i" direction="in" /> | |
− | + | <arg type="a{sv}" direction="out" /> | |
− | + | </method> | |
− | + | GetCurrentTrack : Position of Current URI in the "TrackList" | |
− | <method name=" | + | <method name="GetCurrentTrack"> |
− | <arg type=" | + | <arg type="i" direction="out" /> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</method> | </method> | ||
− | + | GetLength : Number of elements in the "TrackList" | |
− | <method name=" | + | <method name="GetLength"> |
<arg type="i" direction="out" /> | <arg type="i" direction="out" /> | ||
</method> | </method> | ||
Line 145: | Line 142: | ||
* /Player | * /Player | ||
− | + | Next : Goes to the next element (what if we're at the end?) | |
− | <method name=" | + | <method name="Next"> |
</method> | </method> | ||
− | + | Prev : Goes to the previous element (what if we're at the beginning?) | |
− | <method name=" | + | <method name="Prev"> |
</method> | </method> | ||
− | + | Pause : If playing : pause. If paused : unpause. If stopped : start playing | |
− | <method name=" | + | <method name="Pause"> |
</method> | </method> | ||
− | + | Stop : Stop playing. | |
− | <method name=" | + | <method name="Stop"> |
</method> | </method> | ||
− | + | Play : If playing : rewind to the beginning of current track, else : start playing. | |
− | <method name=" | + | <method name="Play"> |
</method> | </method> | ||
− | + | GetStatus : Return the status of "Media Player": 0 = Playing, 1 = Paused, 2 = Stopped. | |
− | <method name=" | + | <method name="GetStatus"> |
+ | <arg type="i" direction="out"/> | ||
</method> | </method> | ||
Line 184: | Line 182: | ||
<method name="VolumeGet"> | <method name="VolumeGet"> | ||
+ | <arg type="i" direction="out"/> | ||
+ | </method> | ||
+ | |||
+ | PositionSet : Sets the playing position (argument must be in [0;100]) | ||
+ | |||
+ | <method name="PositionSet"> | ||
+ | <arg type="i"/> | ||
+ | </method> | ||
+ | |||
+ | PositionGet : Returns the playing position (must be in [0;100]) | ||
+ | |||
+ | <method name="PositionGet"> | ||
<arg type="i" direction="out"/> | <arg type="i" direction="out"/> | ||
</method> | </method> | ||
Line 194: | Line 204: | ||
== The signals == | == The signals == | ||
− | + | TrackChange : Signal is emitted when the "Media Player" plays another "Track" | |
<signal name="TrackChange"> | <signal name="TrackChange"> | ||
</signal> | </signal> | ||
− | + | StatusChange : Signal is emitted when status change. See GetStatus. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | <signal name=" | + | <signal name="StatusChange"> |
<arg type="i"/> | <arg type="i"/> | ||
</signal> | </signal> |
Revision as of 13:52, 5 December 2006
Specification for a Common, Desktop neutral, Media Player D-Bus interface
THIS IS A DRAFT
VLC DOES NOT USE THAT AT THIS MOMENT ALTHOUGH IT IS PLANNED
What follows has been largely stolen from http://bmpx.beep-media-player.org/site/MPRIS_Interfacing_Specification
This is an attempt to create a specification for media players to use, for YOUR applications to be able to interact with ANY Media Player YOU want to use on ANY desktop YOU want to use.
This is in the spirit of http://www.freedesktop.org and uses code and ideas from this project, most notably D-Bus : http://dbus.freedesktop.org and uses ideas from http://www.musicbrainz.org
Contents
Other players
How other "Media Players" interact with D-Bus
bmpx
http://bmpx.beep-media-player.org/site/MPRIS_Interfacing_Specification
banshee
http://cvs.gnome.org/viewcvs/*checkout*/banshee/src/Banshee.Base/DBusPlayer.cs
rhythmbox
http://cvs.gnome.org/viewcvs/rhythmbox/remote/dbus/rb-client.c?view=markup
muine
http://cvs.gnome.org/viewcvs/muine/DBusLib/Player.cs?view=markup
amarok
http://amarok.kde.org/wiki/DCOP_Functions (D-Bus will replace dcop in kde4 ?)
Definitions
"Media Player"
An application, either with GUI or GUI-less (or which allows for both modes of operation) which is capable of playing back audio/video streams. The means by which it does accomplish that (e.g. which audio backend to use, and which output method) is out of the scope of this document.
The "Media Player" must:
- Be able to play back at least local storage file streams.
- Be able to play back at least one stream at a time.
The "Media Player" can, but does not need to:
- Be capable of holding one or more "Tracklists" at a time.
"Client"
The Client is an unspecified application that will interact with the "Media Player" using D-Bus protocol. For example:
- A softphone, that pauses, or step the volume down, when a call is being received.
- An applet that nicely integrates in your desktop environment, to control your "Media Player".
- An instant messaging client which informs your buddies of what you're listening to.
- A monitor that stores in a database what you are listening to, for statistics purpose.
- A video editing software that calls an external "Media Player" to preview your work.
"Tracklist"
A list of media files which resides within the "Media Player", and whose implementation is opaque to the remote interface.
The "Tracklist" must:
- Hold an ordered list of locations of the media files as URIs (e.g. file:// or http://). The implementation of this can be opaque, which means, it does not neccesarily need to store URIs, but upon remote request, it must be able to return an URI for a given media file.
- Keep the list in an ordered fashion. The order can be changed at any time trough e.g. sorting algorithms, in which case the "Media Player" must send information about the reordering trough it's remote interface
The "Tracklist" can, but does not need to:
- Hold "Metadata" about media files
"Metadata"
"Metadata" is data that the files carry within themselves as a means of self-identification (commonly known as "tags"), or data that has been retrieved about the files trough other means, e.g. an internet service that provides additional data about particular media files.
Furthermore, "Metadata" can be split into two categories:
1) Technical metadata: ( to be implemented with a struct )
- URI (string)
- Length
- video codec (fourcc, 4 characters)
- audio codec (fourcc, 4 characters)
- bitrate
- samplerate
2) Informational metadata ( to be implemented as an array of dict entries (string, string) )
- "Name"
- "Artist"
- "Album"
- "UID" : Unique Identifier as on http://musicbrainz.org
- "Genre"
- (This is extensible)
D-Bus
The Service
org.freedesktop.MediaPlayer
The Object Hierarchy
- / : Media Player identification
- /Player : Playback control
- /TrackList : TrackList management
The Methods
- /
Identity : Identify the "Media Player" as in "VLC 0.9.0", "bmpx 0.34.9", "Totem 2.16.2" ...
<method name="Identity"> <arg type="s" direction="out"/> </method>
- /TrackList
GetMetadata : Gives all meta data available for element at given position in the "TrackList"
<method name="GetMetadata"> <arg type="i" direction="in" /> <arg type="a{sv}" direction="out" /> </method>
GetCurrentTrack : Position of Current URI in the "TrackList"
<method name="GetCurrentTrack"> <arg type="i" direction="out" /> </method>
GetLength : Number of elements in the "TrackList"
<method name="GetLength"> <arg type="i" direction="out" /> </method>
- /Player
Next : Goes to the next element (what if we're at the end?)
<method name="Next"> </method>
Prev : Goes to the previous element (what if we're at the beginning?)
<method name="Prev"> </method>
Pause : If playing : pause. If paused : unpause. If stopped : start playing
<method name="Pause"> </method>
Stop : Stop playing.
<method name="Stop"> </method>
Play : If playing : rewind to the beginning of current track, else : start playing.
<method name="Play"> </method>
GetStatus : Return the status of "Media Player": 0 = Playing, 1 = Paused, 2 = Stopped.
<method name="GetStatus"> <arg type="i" direction="out"/> </method>
VolumeSet : Sets the volume (argument must be in [0;100])
<method name="VolumeSet"> <arg type="i"/> </method>
VolumeGet : Returns the current volume (must be in [0;100])
<method name="VolumeGet"> <arg type="i" direction="out"/> </method>
PositionSet : Sets the playing position (argument must be in [0;100])
<method name="PositionSet"> <arg type="i"/> </method>
PositionGet : Returns the playing position (must be in [0;100])
<method name="PositionGet"> <arg type="i" direction="out"/> </method>
Quit : Makes the "Media Player" exit.
<method name="Quit"> </method>
The signals
TrackChange : Signal is emitted when the "Media Player" plays another "Track"
<signal name="TrackChange"> </signal>
StatusChange : Signal is emitted when status change. See GetStatus.
<signal name="StatusChange"> <arg type="i"/> </signal>