[vlc-devel] [PATCH 7/8] Fix Rate property on org.mpris.MediaPlayer2.Player

Alex Merry dev at randomguy3.me.uk
Mon Jan 28 12:54:16 CET 2013


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.
---
 modules/control/dbus/dbus.c        | 2 ++
 modules/control/dbus/dbus_player.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 6f58bad..e1d2419 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -519,6 +519,8 @@ static void ProcessEvents( intf_thread_t *p_intf,
         {
         case SIGNAL_ITEM_CURRENT:
             TrackChange( p_intf );
+            // rate depends on current item
+            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 2ac46bd..23f1554 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -542,7 +542,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 );
     return VLC_SUCCESS;
-- 
1.8.1.1




More information about the vlc-devel mailing list