[vlc-commits] dbus: Return an int64 in the Position property getter

Sean Robinson git at videolan.org
Tue Apr 17 16:32:42 CEST 2012


vlc | branch: master | Sean Robinson <seankrobinson at gmail.com> | Sun Apr 15 18:32:08 2012 -0700| [7531cecfd40941a7d21b4566cc3b0ee964290090] | committer: Mirsal Ennaime

dbus: Return an int64 in the Position property getter

According to the MPRIS specification, the Position property of the
Player object must be an int64.

dbus microsecond position overflows the unsigned 32-bit integer at
about 35:48 into a track's playback.  A 64-bit integer still means
an overflow, but after more than 292000 years into a track's playback.

Signed-off-by: Mirsal Ennaime <mirsal at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7531cecfd40941a7d21b4566cc3b0ee964290090
---

 modules/control/dbus/dbus_player.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 248b3c8..0bd238f 100644
--- a/modules/control/dbus/dbus_player.c
+++ b/modules/control/dbus/dbus_player.c
@@ -45,9 +45,9 @@ DBUS_METHOD( Position )
     REPLY_INIT;
     OUT_ARGUMENTS;
     DBusMessageIter v;
-    dbus_int32_t i_pos;
+    dbus_int64_t i_pos;
 
-    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_VARIANT, "i", &v ) )
+    if( !dbus_message_iter_open_container( &args, DBUS_TYPE_VARIANT, "x", &v ) )
         return DBUS_HANDLER_RESULT_NEED_MEMORY;
 
     input_thread_t *p_input = playlist_CurrentInput( PL );
@@ -61,7 +61,7 @@ DBUS_METHOD( Position )
         vlc_object_release( p_input );
     }
 
-    if( !dbus_message_iter_append_basic( &v, DBUS_TYPE_INT32, &i_pos ) )
+    if( !dbus_message_iter_append_basic( &v, DBUS_TYPE_INT64, &i_pos ) )
         return DBUS_HANDLER_RESULT_NEED_MEMORY;
 
     if( !dbus_message_iter_close_container( &args, &v ) )
@@ -74,7 +74,7 @@ DBUS_METHOD( SetPosition )
 { /* set position in microseconds */
 
     REPLY_INIT;
-    dbus_int32_t i_pos;
+    dbus_int64_t i_pos;
     vlc_value_t position;
     char *psz_trackid, *psz_dbus_trackid;
     input_item_t *p_item;



More information about the vlc-commits mailing list