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

Sean Robinson git at videolan.org
Sun Aug 26 19:06:39 CEST 2012


vlc/vlc-2.0 | branch: master | Sean Robinson <seankrobinson at gmail.com> | Sun Apr 15 18:32:08 2012 -0700| [d0eb8e52b9370de165935e65df4b62d99ea9fa7e] | committer: Jean-Baptiste Kempf

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>
(cherry picked from commit 7531cecfd40941a7d21b4566cc3b0ee964290090)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/control/dbus/dbus_player.c b/modules/control/dbus/dbus_player.c
index 5cf3503..d12907e 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