]> git.sesse.net Git - vlc/commitdiff
D-Bus Patch by Mirsal ENNAIME
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 1 Feb 2007 19:12:45 +0000 (19:12 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Thu, 1 Feb 2007 19:12:45 +0000 (19:12 +0000)
THANKS
modules/control/dbus.c

diff --git a/THANKS b/THANKS
index 5cb6d3fb7781acbdb4bbe68044c0170a9595a2ce..e8dd1e2d981b98a47ea1dba1121fda5697ff73d2 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -117,7 +117,7 @@ Mateus Krepsky Ludwich <mateus @t csp dot com d.t br> - rc interface mosaic-orde
 Mathias C. Berens | welcome-soft <berens at welcome-soft.de> - German translation
 Mathias Kretschmer <mathias at research.att.com> - IP Multicast support
 Mats Rojestal <mats.rojestal at bredband dot net> - compilation fixes for Solaris 9
-Matthieu Lochegnies <lochegm1 at cti.ecp.fr> - MPEG audio emphasis fix
+Matthieu Lochegnies <prof at tocard dot org> - MPEG audio emphasis fix
 Max Rudberg <max_08 at mac.com> - Mac OS X controller art (v0.7.0)
 Michael Mondragon <mammon at lokmail.net> - ncurses compilation fix
 Mickael Hoerdt <hoerdt at clarinet.u-strasbg.fr> - IPv6 SSM multicast patch
@@ -125,6 +125,7 @@ Mike Schrag <mschrag at pobox dot com> - directx device selection
 Mikko Hirvonen <masse at astro dot helsinki dot fi> - Firefox-1.5.x development configure patch
 Michel Lanners <mlan at cpu.lu> - fixed typos and AltiVec detection
 Miroslav Oujeský <oujesky at mail dot muni dot cz> - Czech translation
+Mirsal Ennaime <mirsal at  gmail dot com> - D-Bus amelioration
 Moritz Bunkus <moritz at bunkus dot org> - Matroska patches
 Morten Brix Pedersen <morten at wtf.dk> - Danish translation
 Nilmoni Deb <ndeb at ece.cmu.edu> - autoconf and Makefile fixes
index cb9bbce2d83319d9548108a06acb8efa19dde6d1..ab3bdbd3f5292c05917e9d992945955f8bf12676 100644 (file)
@@ -58,6 +58,7 @@
 #include <vlc_input.h>
 #include <vlc_playlist.h>
 
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -371,11 +372,25 @@ DBUS_METHOD( AddTrack )
 }
 
 DBUS_METHOD( GetCurrentTrack )
-{ //TODO
+{
     REPLY_INIT;
     OUT_ARGUMENTS;
     dbus_int32_t i_position = 0;
-    //TODO get position of playing element
+    playlist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this );
+    playlist_item_t* p_tested_item = p_playlist->p_root_onelevel;
+    
+    while ( p_tested_item->i_id != p_playlist->status.p_item->i_id )
+    {
+        i_position++;
+        p_tested_item = playlist_GetNextLeaf( p_playlist, 
+                        p_playlist->p_root_onelevel, 
+                        p_tested_item,
+                        VLC_FALSE,
+                        VLC_FALSE );
+    }
+
+    pl_Release( p_playlist );
+
     ADD_INT32( &i_position );
     REPLY_SEND;
 }
@@ -407,23 +422,42 @@ DBUS_METHOD( GetMetadata )
 }
 
 DBUS_METHOD( GetLength )
-{ //TODO
+{ 
     REPLY_INIT;
     OUT_ARGUMENTS;
+
     dbus_int32_t i_elements = 0;
-    //TODO: return number of elements in playlist
+    playlist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this );
+    playlist_item_t* p_tested_item = p_playlist->p_root_onelevel;
+    playlist_item_t* p_last_item = playlist_GetLastLeaf( p_playlist, p_playlist->p_root_onelevel ); 
+
+    while ( p_tested_item->i_id != p_last_item->i_id )
+    {
+        i_elements++;
+        p_tested_item = playlist_GetNextLeaf( p_playlist, 
+                        p_playlist->p_root_onelevel, 
+                        p_tested_item,
+                        VLC_FALSE,
+                        VLC_FALSE );
+    }
+
+    pl_Release( p_playlist );
+    
     ADD_INT32( &i_elements );
     REPLY_SEND;
 }
 
 DBUS_METHOD( DelTrack )
-{ //TODO
+{
+  /*FIXME: Doesn't work.*/
     REPLY_INIT;
 
     DBusError error;
     dbus_error_init( &error );
 
-    dbus_int32_t i_position;
+    dbus_int32_t i_position, i_count = 0;
+    playlist_t *p_playlist = pl_Yield( (vlc_object_t*) p_this );
+    playlist_item_t* p_tested_item = p_playlist->p_root_onelevel;
 
     dbus_message_get_args( p_from, &error,
             DBUS_TYPE_INT32, &i_position,
@@ -436,8 +470,21 @@ DBUS_METHOD( DelTrack )
         dbus_error_free( &error );
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
     }
+    
+    while ( i_count < i_position ) 
+    {
+        i_count++;
+        p_tested_item = playlist_GetNextLeaf( p_playlist, 
+                        p_playlist->p_root_onelevel, 
+                        p_tested_item,
+                        VLC_FALSE,
+                        VLC_FALSE );
+    }
 
-    //TODO delete the element
+    playlist_NodeRemoveItem( p_playlist, 
+                   p_tested_item, 
+                   p_playlist->p_root_onelevel );
+    pl_Release( p_playlist );
 
     REPLY_SEND;
 }