changeset 2766:ea20b1e92411 trunk

[svn] Added CMD_GET_INFO and CMD_PLAYLIST_GET_TUPLE_DATA replacements; Changed some formatting and used unsigned numbers where appropriate.
author magma
date Sun, 13 May 2007 02:31:11 -0700
parents 313ac85816bb
children 55dc022c405a
files ChangeLog src/audacious/build_stamp.c src/audacious/dbus-service.h src/audacious/dbus.c src/audacious/objects.xml
diffstat 5 files changed, 181 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun May 13 01:29:56 2007 -0700
+++ b/ChangeLog	Sun May 13 02:31:11 2007 -0700
@@ -1,3 +1,11 @@
+2007-05-13 08:29:56 +0000  Ben Tucker <bnt@interchange.ubc.ca>
+  revision [4556]
+  Fixed link error caused by libaudclient being in LDADD for audacious.
+  
+  trunk/src/audacious/Makefile |    1 -
+  1 file changed, 1 deletion(-)
+
+
 2007-05-13 02:45:21 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [4554]
   - handle UTF-8 filenames
--- a/src/audacious/build_stamp.c	Sun May 13 01:29:56 2007 -0700
+++ b/src/audacious/build_stamp.c	Sun May 13 02:31:11 2007 -0700
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070513-4554";
+const gchar *svn_stamp = "20070513-4556";
--- a/src/audacious/dbus-service.h	Sun May 13 01:29:56 2007 -0700
+++ b/src/audacious/dbus-service.h	Sun May 13 02:31:11 2007 -0700
@@ -40,67 +40,72 @@
 
 // Audacious General Information
 gboolean audacious_rc_version(RemoteObject *obj, gchar **version,
-                                  GError **error);
+                              GError **error);
 gboolean audacious_rc_quit(RemoteObject *obj, GError **error);
 gboolean audacious_rc_eject(RemoteObject *obj, GError **error);
 gboolean audacious_rc_main_win_visible(RemoteObject *obj,
-                                  gboolean *is_main_win, GError **error);
+                                       gboolean *is_main_win, GError **error);
 gboolean audacious_rc_show_main_win(RemoteObject *obj, gboolean show,
+                                    GError **error);
+gboolean audacious_rc_equalizer_visible(RemoteObject *obj, gboolean *is_eq_win,
                                         GError **error);
-gboolean audacious_rc_equalizer_visible(RemoteObject *obj,
-                                  gboolean *is_eq_win, GError **error);
 gboolean audacious_rc_show_equalizer(RemoteObject *obj, gboolean show,
-                                         GError **error);
+                                     GError **error);
 gboolean audacious_rc_playlist_visible(RemoteObject *obj,
-                                           gboolean *is_pl_win,
-                                           GError **error);
+                                       gboolean *is_pl_win,
+                                       GError **error);
 gboolean audacious_rc_show_playlist(RemoteObject *obj, gboolean show,
-                                        GError **error);
+                                    GError **error);
 
 // Playback Information/Manipulation
 gboolean audacious_rc_play(RemoteObject *obj, GError **error);
 gboolean audacious_rc_pause(RemoteObject *obj, GError **error);
 gboolean audacious_rc_stop(RemoteObject *obj, GError **error);
 gboolean audacious_rc_playing(RemoteObject *obj, gboolean *is_playing,
-                                  GError **error);
+                              GError **error);
 gboolean audacious_rc_paused(RemoteObject *obj, gboolean *is_paused,
-                                 GError **error);
+                             GError **error);
 gboolean audacious_rc_stopped(RemoteObject *obj, gboolean *is_stopped,
-                                  GError **error);
+                              GError **error);
 gboolean audacious_rc_status(RemoteObject *obj, gchar **status,
-                                 GError **error);
+                             GError **error);
+gboolean audacious_rc_info(RemoteObject *obj, gint *rate, gint *freq,
+                           gint *nch, GError **error);
 gboolean audacious_rc_time(RemoteObject *obj, gint *time, GError **error);
 gboolean audacious_rc_seek(RemoteObject *obj, guint pos, GError **error);
 gboolean audacious_rc_volume(RemoteObject *obj, gint *vl, gint *vr,
-                                 GError **error);
+                             GError **error);
 gboolean audacious_rc_set_volume(RemoteObject *obj, gint vl, gint vr,
-                                     GError **error);
+                                 GError **error);
 gboolean audacious_rc_balance(RemoteObject *obj, gint *balance,
-                                  GError **error);
+                              GError **error);
 
 // Playlist Information/Manipulation
 gboolean audacious_rc_position(RemoteObject *obj, int *pos, GError **error);
 gboolean audacious_rc_advance(RemoteObject *obj, GError **error);
 gboolean audacious_rc_reverse(RemoteObject *obj, GError **error);
 gboolean audacious_rc_length(RemoteObject *obj, int *length,
-                                 GError **error);
-gboolean audacious_rc_song_title(RemoteObject *obj, int pos,
-                                     gchar **title, GError **error);
-gboolean audacious_rc_song_filename(RemoteObject *obj, int pos,
-                                        gchar **filename, GError **error);
-gboolean audacious_rc_song_length(RemoteObject *obj, int pos, int *length,
-                                      GError **error);
-gboolean audacious_rc_song_frames(RemoteObject *obj, int pos, int *length,
-                                      GError **error);
-gboolean audacious_rc_jump(RemoteObject *obj, int pos, GError **error);
+                             GError **error);
+gboolean audacious_rc_song_title(RemoteObject *obj, guint pos,
+                                 gchar **title, GError **error);
+gboolean audacious_rc_song_filename(RemoteObject *obj, guint pos,
+                                    gchar **filename, GError **error);
+gboolean audacious_rc_song_length(RemoteObject *obj, guint pos, int *length,
+                                  GError **error);
+gboolean audacious_rc_song_frames(RemoteObject *obj, guint pos, int *length,
+                                  GError **error);
+gboolean audacious_rc_song_tuple(RemoteObject *obj, guint pos, gchar *tuple,
+                                 GValue *value, GError **error);
+gboolean audacious_rc_jump(RemoteObject *obj, guint pos, GError **error);
+gboolean audacious_rc_add(RemoteObject *obj, gchar *file, GError **error);
 gboolean audacious_rc_add_url(RemoteObject *obj, gchar *url,
-                                  GError **error);
-gboolean audacious_rc_delete(RemoteObject *obj, int pos, GError **error);
+                              GError **error);
+gboolean audacious_rc_delete(RemoteObject *obj, guint pos, GError **error);
 gboolean audacious_rc_clear(RemoteObject *obj, GError **error);
 gboolean audacious_rc_repeating(RemoteObject *obj, gboolean *is_repeating,
-                                    GError **error);
+                                GError **error);
 gboolean audacious_rc_repeat(RemoteObject *obj, GError **error);
 gboolean audacious_rc_shuffling(RemoteObject *obj, gboolean *is_shuffling,
-                                    GError **error);
+                                GError **error);
 gboolean audacious_rc_shuffle(RemoteObject *obj, GError **error);
 #endif // !_DBUS_SERVICE_H
--- a/src/audacious/dbus.c	Sun May 13 01:29:56 2007 -0700
+++ b/src/audacious/dbus.c	Sun May 13 02:31:11 2007 -0700
@@ -86,7 +86,7 @@
 
 // Audacious General Information
 gboolean audacious_rc_version(RemoteObject *obj, gchar **version,
-                                  GError **error) {
+                              GError **error) {
     *version = g_strdup(VERSION);
     return TRUE;
 }
@@ -103,14 +103,14 @@
 }
 
 gboolean audacious_rc_main_win_visible(RemoteObject *obj,
-                                  gboolean *is_main_win, GError **error) {
+                                       gboolean *is_main_win, GError **error) {
     *is_main_win = cfg.player_visible;
     g_message("main win %s\n", (cfg.player_visible? "visible" : "hidden"));
     return TRUE;
 }
 
 gboolean audacious_rc_show_main_win(RemoteObject *obj, gboolean show,
-                                        GError **error) {
+                                    GError **error) {
     g_message("%s main win\n", (show? "showing": "hiding"));
     if (has_x11_connection)
         mainwin_show(show);
@@ -118,27 +118,26 @@
 }
 
 gboolean audacious_rc_equalizer_visible(RemoteObject *obj,
-                                  gboolean *is_eq_win, GError **error) {
+                                        gboolean *is_eq_win, GError **error) {
     *is_eq_win = cfg.equalizer_visible;
     return TRUE;
 }
 
 gboolean audacious_rc_show_equalizer(RemoteObject *obj, gboolean show,
-                                         GError **error) {
+                                     GError **error) {
     if (has_x11_connection)
         equalizerwin_show(show);
     return TRUE;
 }
 
-gboolean audacious_rc_playlist_visible(RemoteObject *obj,
-                                           gboolean *is_pl_win,
-                                           GError **error) {
+gboolean audacious_rc_playlist_visible(RemoteObject *obj, gboolean *is_pl_win,
+                                       GError **error) {
     *is_pl_win = cfg.playlist_visible;
     return TRUE;
 }
 
 gboolean audacious_rc_show_playlist(RemoteObject *obj, gboolean show,
-                                        GError **error) {
+                                    GError **error) {
     if (has_x11_connection) {
         if (show)
             playlistwin_show();
@@ -173,25 +172,25 @@
 }
 
 gboolean audacious_rc_playing(RemoteObject *obj, gboolean *is_playing,
-                                  GError **error) {
+                              GError **error) {
     *is_playing = playback_get_playing();
     return TRUE;
 }
 
 gboolean audacious_rc_paused(RemoteObject *obj, gboolean *is_paused,
-                                 GError **error) {
+                             GError **error) {
     *is_paused = playback_get_paused();
     return TRUE;
 }
 
 gboolean audacious_rc_stopped(RemoteObject *obj, gboolean *is_stopped,
-                                  GError **error) {
+                              GError **error) {
     *is_stopped = !playback_get_playing();
     return TRUE;
 }
 
 gboolean audacious_rc_status(RemoteObject *obj, gchar **status,
-                                 GError **error) {
+                             GError **error) {
     if (playback_get_paused())
         *status = g_strdup("paused");
     else if (playback_get_playing())
@@ -201,6 +200,12 @@
     return TRUE;
 }
 
+gboolean audacious_rc_info(RemoteObject *obj, gint *rate, gint *freq,
+                           gint *nch, GError **error) {
+    playback_get_sample_params(rate, freq, nch);
+    return TRUE;
+}
+
 gboolean audacious_rc_time(RemoteObject *obj, gint *time, GError **error) {
     if (playback_get_playing())
         *time = playback_get_time();
@@ -218,13 +223,13 @@
 }
 
 gboolean audacious_rc_volume(RemoteObject *obj, gint *vl, gint *vr,
-                                 GError **error) {
+                             GError **error) {
     input_get_volume(vl, vr);
     return TRUE;
 }
 
 gboolean audacious_rc_set_volume(RemoteObject *obj, gint vl, gint vr,
-                                     GError **error) {
+                                 GError **error) {
     if (vl > 100)
         vl = 100;
     if (vr > 100)
@@ -234,7 +239,7 @@
 }
 
 gboolean audacious_rc_balance(RemoteObject *obj, gint *balance,
-                                  GError **error) {
+                              GError **error) {
     gint vl, vr;
     input_get_volume(&vl, &vr);
     if (vl < 0 || vr < 0)
@@ -249,8 +254,7 @@
 }
 
 // Playlist Information/Manipulation
-gboolean audacious_rc_position(RemoteObject *obj, int *pos, GError **error)
-{
+gboolean audacious_rc_position(RemoteObject *obj, int *pos, GError **error) {
     *pos = playlist_get_position(playlist_get_active());
     return TRUE;
 }
@@ -266,48 +270,111 @@
 }
 
 gboolean audacious_rc_length(RemoteObject *obj, int *length,
-                                 GError **error) {
+                             GError **error) {
     *length = playlist_get_length(playlist_get_active());
     return TRUE;
 }
 
-gboolean audacious_rc_song_title(RemoteObject *obj, int pos,
-                                     gchar **title, GError **error) {
+gboolean audacious_rc_song_title(RemoteObject *obj, guint pos,
+                                 gchar **title, GError **error) {
     *title = playlist_get_songtitle(playlist_get_active(), pos);
     return TRUE;
 }
 
-gboolean audacious_rc_song_filename(RemoteObject *obj, int pos,
-                                        gchar **filename, GError **error) {
+gboolean audacious_rc_song_filename(RemoteObject *obj, guint pos,
+                                    gchar **filename, GError **error) {
     *filename = playlist_get_filename(playlist_get_active(), pos);
     return TRUE;
 }
 
-gboolean audacious_rc_song_length(RemoteObject *obj, int pos, int *length,
-                                      GError **error) {
+gboolean audacious_rc_song_length(RemoteObject *obj, guint pos, int *length,
+                                  GError **error) {
     *length = playlist_get_songtime(playlist_get_active(), pos) / 1000;
     return TRUE;
 }
 
-gboolean audacious_rc_song_frames(RemoteObject *obj, int pos, int *length,
-                                      GError **error) {
+gboolean audacious_rc_song_frames(RemoteObject *obj, guint pos, int *length,
+                                  GError **error) {
     *length = playlist_get_songtime(playlist_get_active(), pos);
     return TRUE;
 }
 
-gboolean audacious_rc_jump(RemoteObject *obj, int pos, GError **error) {
+gboolean audacious_rc_song_tuple(RemoteObject *obj, guint pos, gchar *field,
+                                 GValue *value, GError **error) {
+    TitleInput *tuple;
+    tuple = playlist_get_tuple(playlist_get_active(), pos);
+    if (!tuple) {
+        return FALSE;
+    } else {
+        if (!strcasecmp(field, "performer")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->performer);
+        } else if (!strcasecmp(field, "album_name")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->album_name);
+        } else if (!strcasecmp(field, "track_name")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->track_name);
+        } else if (!strcasecmp(field, "track_number")) {
+            g_value_init(value, G_TYPE_INT);
+            g_value_set_int(value, tuple->track_number);
+        } else if (!strcasecmp(field, "year")) {
+            g_value_init(value, G_TYPE_INT);
+            g_value_set_int(value, tuple->year);
+        } else if (!strcasecmp(field, "date")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->date);
+        } else if (!strcasecmp(field, "genre")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->genre);
+        } else if (!strcasecmp(field, "comment")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->comment);
+        } else if (!strcasecmp(field, "file_name")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->file_name);
+        } else if (!strcasecmp(field, "file_ext")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, g_strdup(tuple->file_ext));
+        } else if (!strcasecmp(field, "file_path")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->file_path);
+        } else if (!strcasecmp(field, "length")) {
+            g_value_init(value, G_TYPE_INT);
+            g_value_set_int(value, tuple->length);
+        } else if (!strcasecmp(field, "album_name")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->album_name);
+        } else if (!strcasecmp(field, "formatter")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->formatter);
+        } else if (!strcasecmp(field, "custom")) {
+            g_value_init(value, G_TYPE_STRING);
+            g_value_set_string(value, tuple->custom);
+        } else if (!strcasecmp(field, "mtime")) {
+            g_value_init(value, G_TYPE_INT);
+            g_value_set_int(value, tuple->mtime);
+        }
+    }
+    return TRUE;
+}
+
+gboolean audacious_rc_jump(RemoteObject *obj, guint pos, GError **error) {
     if (pos < (guint)playlist_get_length(playlist_get_active()))
                 playlist_set_position(playlist_get_active(), pos);
     return TRUE;
 }
 
-gboolean audacious_rc_add_url(RemoteObject *obj, gchar *url,
-                                  GError **error) {
+gboolean audacious_rc_add(RemoteObject *obj, gchar *file, GError **error) {
+    playlist_add_url(playlist_get_active(), file);
+    return TRUE;
+}
+gboolean audacious_rc_add_url(RemoteObject *obj, gchar *url, GError **error) {
     playlist_add_url(playlist_get_active(), url);
     return TRUE;
 }
 
-gboolean audacious_rc_delete(RemoteObject *obj, int pos, GError **error) {
+gboolean audacious_rc_delete(RemoteObject *obj, guint pos, GError **error) {
     playlist_delete_index(playlist_get_active(), pos);
     return TRUE;
 }
@@ -320,7 +387,7 @@
 }
 
 gboolean audacious_rc_repeating(RemoteObject *obj, gboolean *is_repeating,
-                                    GError **error) {
+                                GError **error) {
     *is_repeating = cfg.repeat;
     return TRUE;
 }
@@ -331,7 +398,7 @@
 }
 
 gboolean audacious_rc_shuffling(RemoteObject *obj, gboolean *is_shuffling,
-                                    GError **error) {
+                                GError **error) {
     *is_shuffling = cfg.shuffle;
     return TRUE;
 }
--- a/src/audacious/objects.xml	Sun May 13 01:29:56 2007 -0700
+++ b/src/audacious/objects.xml	Sun May 13 02:31:11 2007 -0700
@@ -54,6 +54,8 @@
     CMD_MAIN_WIN_TOGGLE
     CMD_QUIT
     CMD_EJECT
+    CMD_GET_INFO
+    CMD_PLAYLIST_GET_TUPLE_DATA
 
 
     Remaining:
@@ -87,7 +89,6 @@
     CMD_PLAYQUEUE_GET_POS
     CMD_PLAYQUEUE_GET_QPOS
     CMD_PLAYLIST_ENQUEUE_TO_TEMP
-    CMD_PLAYLIST_GET_TUPLE_DATA
 -->
 
 <node name="/">
@@ -182,20 +183,25 @@
             <arg type="s" direction="out" name="status"/>
         </method>
 
+        <!-- What is the bitrate, frequency, and number of channels of the -->
+        <!-- current audio format? -->
+        <method name="Info">
+            <arg type="i" direction="out" name="rate"/>
+            <arg type="i" direction="out" name="freq"/>
+            <arg type="i" direction="out" name="nch"/>
+        </method>
+
         <!-- What is the current output position? -->
         <method name="Time">
             <!-- Position of song, in ms -->
-            <arg type="i" direction="out" name="time"/>
+            <arg type="u" direction="out" name="time"/>
         </method>
 
         <!-- Seek to some absolute position in the current song -->
         <method name="Seek">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
             <!-- Position of song, in ms, to seek to -->
-            <arg type="i" name="pos"/>
-
-            <!-- Return true on success, or false if position out of range? -->
-            <!-- <arg type="b" direction="out"/> -->
+            <arg type="u" name="pos"/>
         </method>
 
         <!-- What is the playback volume? -->
@@ -225,7 +231,7 @@
         <!-- Playlist position -->
         <method name="Position">
             <!-- Return position of current song in current playlist -->
-            <arg type="i" direction="out" name="pos"/>
+            <arg type="u" direction="out" name="pos"/>
         </method>
 
         <!-- Skip ahead one song in the current playlist -->
@@ -247,7 +253,7 @@
         <!-- Get a song's title -->
         <method name="SongTitle">
             <!-- Song position in the playlist -->
-            <arg type="i" name="pos"/>
+            <arg type="u" name="pos"/>
 
             <!-- Return title of desired song -->
             <arg type="s" direction="out" name="title"/>
@@ -256,7 +262,7 @@
         <!-- Get a song's filename -->
         <method name="SongFilename">
             <!-- Song position in the playlist -->
-            <arg type="i" name="pos"/>
+            <arg type="u" name="pos"/>
 
             <!-- Return filename of desired song -->
             <arg type="s" direction="out" name="filename"/>
@@ -265,7 +271,7 @@
         <!-- Get the length of some song, in seconds -->
         <method name="SongLength">
             <!-- Song position in the playlist -->
-            <arg type="i" name="pos"/>
+            <arg type="u" name="pos"/>
 
             <!-- Return length, in seconds, of desired song -->
             <arg type="i" direction="out" name="length"/>
@@ -274,17 +280,36 @@
         <!-- Get the length of some song, in frames -->
         <method name="SongFrames">
             <!-- Song position in the playlist -->
-            <arg type="i" name="pos"/>
+            <arg type="u" name="pos"/>
 
             <!-- Return length, in frames, of desired song -->
             <arg type="i" direction="out" name="length"/>
         </method>
 
+        <!-- Get the value of a tuple field of some song -->
+        <method name="SongTuple">
+            <!-- Song position in the playlist -->
+            <arg type="u" name="pos"/>
+
+            <!-- Tuple name -->
+            <arg type="s" name="tuple"/>
+
+            <!-- Return tuple value -->
+            <arg type="v" direction="out" name="value"/>
+        </method>
+
         <!-- Jump to some position in the playlist -->
         <method name="Jump">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
             <!-- Song position to jump to -->
-            <arg type="i" name="pos"/>
+            <arg type="u" name="pos"/>
+        </method>
+
+        <!-- Add some file to the current playlist -->
+        <method name="Add">
+            <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
+            <!-- File to add -->
+            <arg type="s" name="file"/>
         </method>
 
         <!-- Add some URL to the current playlist -->
@@ -298,7 +323,7 @@
         <method name="Delete">
             <annotation name="org.freedesktop.DBus.GLib.NoReply" value=""/>
             <!-- Position of song to delete -->
-            <arg type="i" name="pos"/>
+            <arg type="u" name="pos"/>
         </method>
 
         <!-- Clear the playlist -->