[vlc-commits] Fix Rate property on org.mpris.MediaPlayer2.Player

Alex Merry git at videolan.org
Tue Jan 29 20:07:38 CET 2013


vlc/vlc-2.0 | branch: master | Alex Merry <dev at randomguy3.me.uk> | Mon Jan 28 11:54:16 2013 +0000| [34cc9763462330cf32832a7bc7ea02e4a2a5386b] | committer: Rémi Denis-Courmont

Fix Rate property on org.mpris.MediaPlayer2.Player

Rate should never be 0.0 (according to the spec), so we pick a sensible
default when we do not have a current track: 1.0.

Also, when the current item changes, the Rate may also change.  So add
it to the PropertiesChanged signal just to be sure.

Signed-off-by: Mirsal Ennaime <mirsal at videolan.org>
(cherry picked from commit 8f754d8715c72abc4ba1b0f26ae136c1db41437b)

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=34cc9763462330cf32832a7bc7ea02e4a2a5386b
---

 modules/control/dbus/dbus.c        |    5 +++++
 modules/control/dbus/dbus_player.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index ef1086e..844161d 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -506,6 +506,11 @@ static void ProcessEvents( intf_thread_t *p_intf,
         {
         case SIGNAL_ITEM_CURRENT:
             TrackChange( p_intf );
+
+            // rate depends on current item
+            if( !vlc_dictionary_has_key( &tracklist_properties, "Rate" ) )
+                vlc_dictionary_insert( &player_properties, "Rate", NULL );
+
             vlc_dictionary_insert( &player_properties, "Metadata", NULL );
             break;
         case SIGNAL_INTF_CHANGE:
diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index e134cbf..25b1059 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -523,7 +523,7 @@ MarshalRate( intf_thread_t *p_intf, DBusMessageIter *container )
         vlc_object_release( (vlc_object_t*) p_input );
     }
     else
-        d_rate = 0.;
+        d_rate = 1.0;
 
     dbus_message_iter_append_basic( container, DBUS_TYPE_DOUBLE, &d_rate );
 }



More information about the vlc-commits mailing list