Difference between revisions of "DBus"

From VideoLAN Wiki
Jump to navigation Jump to search
m (syntaxhighlight)
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{See also|DBus-spec|DBus-usage}}
 +
 
== TODO for DBus integration ==
 
== TODO for DBus integration ==
  
=== List all signals, methods with their arguments and return value ===
+
VLC implements [[DBus-spec]], a desktop-neutral document, that aims to be suitable for every Media Players.
  
=== Decide service bahaviour ===
+
=== Decide service behaviour ===
  
 
Could vlc be a on-demand startable service, would it be useful ?
 
Could vlc be a on-demand startable service, would it be useful ?
  
We just have to create a /usr/share/dbus-1/org.videolan.vlc.service:
+
We just have to create a /usr/share/dbus-1/org.freedesktop.MediaPlayer.service:
----
+
 
 +
<syntaxhighlight lang="ini">
 
[D-BUS Service]
 
[D-BUS Service]
  
Name=org.videolan.vlc
+
Name=org.freedesktop.MediaPlayer
  
 
Exec=/usr/bin/vlc -I dummy --control dbus
 
Exec=/usr/bin/vlc -I dummy --control dbus
----
+
</syntaxhighlight>
 
 
 
 
=== Clarify one instance mode ===
 
 
 
Now if vlc is built with D-Bus >= 1.0.0 it will automatically register org.videolan.vlc, and no other instances of vlc will be allowed to replace the service.
 
 
 
When vlc starts it registers the org.videolan.vlc service on the session bus
 
* if it succeeds, it register '/' object on it
 
* if it fails:
 
** if "one-instance" is false, just warn that it didn't register the service
 
** if "one-instance" is true, the mrls given on the command line are passed to the owner of org.videolan.vlc through D-Bus interface and then exit
 
 
 
 
 
When D-Bus control interface starts, it does:
 
# unregister '/'
 
# register '/org/videolan/vlc'
 
 
 
 
 
 
 
The problem is that it does require dbus control to be loaded.
 
 
 
Possible ways to do that:
 
* check if /org/videolan/vlc is present before exit, and then ignore one-instance setting if dbus control isn't activated
 
* use service activation, but that mean we would have 1 GUI without dbus control, and 1 with dbus control
 
 
 
=== Missing features ===
 
 
 
volume control => VolumeGet and VolumeSet
 
 
 
playlist => hard.... could we use xspf ?
 
 
 
timing of the input element (position, jump)
 
 
 
preferences ?
 
 
 
 
 
== List of signals and methods ==
 
 
 
 
 
 
 
=== Signals ===
 
 
 
''''Signal' (signature) : description'''
 
 
 
'ItemChange' (s) : Emitted when a new input element is played, the string contains the filename, or the input name if it has some metadata.
 
 
 
'NewInstance' (i) : Emitted when vlc control interface is started, with vlc pid
 
 
 
=== Methods ===
 
 
 
''''Method' (input signature) = (output signature) : description'''
 
 
 
'GetPlayStatus' () = (s) : return "play" "pause" "stopped" or "unknown"
 
 
 
'GetPlayingItem' () = (s) : return the filename of the current item being played, or it's name if it has some metadata. Same data provided by "ItemChange"
 
 
 
'ToglePause' () = (b) : toggle the play/pause status, and start playing if it was stopped, return true if playing, false if paused
 
 
 
'AddMRL' (sb) = () : add string to the playlist, and play it if bool is true
 
 
 
'Nothing' () = () : do nothing, just here for tests, and code example
 
 
 
'Quit' () = () : exits vlc
 
 
 
'Stop' () = () : stop playlist
 
 
 
'Prev' () = () : plays previous playlist item
 
  
'Next' () = () : plays next playlist item
+
[[Category:Development]]

Latest revision as of 03:54, 19 March 2019

See also: DBus-spec and DBus-usage

TODO for DBus integration

VLC implements DBus-spec, a desktop-neutral document, that aims to be suitable for every Media Players.

Decide service behaviour

Could vlc be a on-demand startable service, would it be useful ?

We just have to create a /usr/share/dbus-1/org.freedesktop.MediaPlayer.service:

[D-BUS Service]

Name=org.freedesktop.MediaPlayer

Exec=/usr/bin/vlc -I dummy --control dbus