Permalink
Browse files

Merge branch 'next' of git://git.musicpd.org/jn/libmpdclient

  • Loading branch information...
2 parents 247cebb + e325c0a commit 940b1d018c2d16359d1ecb0ba39b4f8859a3a032 @MaxKellermann MaxKellermann committed Jan 4, 2012
Showing with 49 additions and 1 deletion.
  1. +1 −0 NEWS
  2. +4 −0 doc/doxygen.conf.in
  3. +18 −1 include/mpd/status.h
  4. +2 −0 libmpdclient.ld
  5. +24 −0 src/status.c
View
1 NEWS
@@ -1,4 +1,5 @@
libmpdclient 2.7 (2011/??/??)
+* status: add nextsong/nextsongid support
libmpdclient 2.6 (2011/10/23)
View
@@ -42,6 +42,10 @@ FILE_PATTERNS = *.h
SOURCE_BROWSER = YES
+# setting this to NO prevents doxygen from sorting functions alphabetically,
+# which would destroy their "natural" order
+SORT_MEMBER_DOCS = NO
+
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
View
@@ -217,13 +217,30 @@ int
mpd_status_get_song_pos(const struct mpd_status *status);
/**
- * Returns the id of the currently song. If there is no current song,
+ * Returns the id of the current song. If there is no current song,
* -1 is returned.
*/
+mpd_pure
int
mpd_status_get_song_id(const struct mpd_status *status);
/**
+ * The same as mpd_status_get_next_song_pos, but for the next song to be
+ * played.
+ */
+mpd_pure
+int
+mpd_status_get_next_song_pos(const struct mpd_status *status);
+
+/**
+ * Returns the id of the next song to be played. If it is not known, -1 is
+ * returned.
+ */
+mpd_pure
+int
+mpd_status_get_next_song_id(const struct mpd_status *status);
+
+/**
* Returns time in seconds that have elapsed in the currently playing/paused
* song
*/
View
@@ -319,6 +319,8 @@ global:
mpd_status_get_mixrampdelay;
mpd_status_get_song_pos;
mpd_status_get_song_id;
+ mpd_status_get_next_song_pos;
+ mpd_status_get_next_song_id;
mpd_status_get_elapsed_time;
mpd_status_get_elapsed_ms;
mpd_status_get_total_time;
View
@@ -87,6 +87,12 @@ struct mpd_status {
/** Song ID of the currently selected song */
int song_id;
+ /** The same as song_pos, but for the next song to be played */
+ int next_song_pos;
+
+ /** Song ID of the next song to be played */
+ int next_song_id;
+
/**
* Time in seconds that have elapsed in the currently
* playing/paused song.
@@ -132,6 +138,8 @@ mpd_status_begin(void)
status->state = MPD_STATE_UNKNOWN;
status->song_pos = -1;
status->song_id = -1;
+ status->next_song_pos = -1;
+ status->next_song_id = -1;
status->elapsed_time = 0;
status->elapsed_ms = 0;
status->total_time = 0;
@@ -226,6 +234,10 @@ mpd_status_feed(struct mpd_status *status, const struct mpd_pair *pair)
status->song_pos = atoi(pair->value);
else if (strcmp(pair->name, "songid") == 0)
status->song_id = atoi(pair->value);
+ else if (strcmp(pair->name, "nextsong") == 0)
+ status->next_song_pos = atoi(pair->value);
+ else if (strcmp(pair->name, "nextsongid") == 0)
+ status->next_song_id = atoi(pair->value);
else if (strcmp(pair->name, "time") == 0) {
char *endptr;
@@ -343,6 +355,18 @@ mpd_status_get_song_id(const struct mpd_status *status)
return status->song_id;
}
+int
+mpd_status_get_next_song_pos(const struct mpd_status *status)
+{
+ return status->next_song_pos;
+}
+
+int
+mpd_status_get_next_song_id(const struct mpd_status *status)
+{
+ return status->next_song_id;
+}
+
unsigned
mpd_status_get_elapsed_time(const struct mpd_status *status)
{

0 comments on commit 940b1d0

Please sign in to comment.