aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-05-06 18:35:22 +0200
committerMax Kellermann <max@duempel.org>2009-05-06 18:35:22 +0200
commit3083df5a5f0dc423d4b283917737b99e308081e9 (patch)
treed26d6701646726c83f3aeaf5288cef123bf70159 /src
parent0935d85c69eaa11d5f8daa8056fdf0f845871cc1 (diff)
downloadmpd-3083df5a5f0dc423d4b283917737b99e308081e9.tar.gz
mpd-3083df5a5f0dc423d4b283917737b99e308081e9.tar.xz
mpd-3083df5a5f0dc423d4b283917737b99e308081e9.zip
player_control: renamed playerSeek(), return bool
Renamed playerSeek() to pc_seek() to get rid of CamelCase. Convert the return value to bool.
Diffstat (limited to '')
-rw-r--r--src/player_control.c8
-rw-r--r--src/player_control.h10
-rw-r--r--src/playlist_control.c6
3 files changed, 15 insertions, 9 deletions
diff --git a/src/player_control.c b/src/player_control.c
index df4f4bf61..2754c3432 100644
--- a/src/player_control.c
+++ b/src/player_control.c
@@ -220,13 +220,13 @@ queueSong(struct song *song)
player_command(PLAYER_COMMAND_QUEUE);
}
-int
-playerSeek(struct song *song, float seek_time)
+bool
+pc_seek(struct song *song, float seek_time)
{
assert(song != NULL);
if (pc.state == PLAYER_STATE_STOP)
- return -1;
+ return false;
pc.next_song = song;
@@ -237,7 +237,7 @@ playerSeek(struct song *song, float seek_time)
idle_add(IDLE_PLAYER);
}
- return 0;
+ return true;
}
float getPlayerCrossFade(void)
diff --git a/src/player_control.h b/src/player_control.h
index c8bcf2462..b1f7481cd 100644
--- a/src/player_control.h
+++ b/src/player_control.h
@@ -132,8 +132,14 @@ void playerWait(void);
void
queueSong(struct song *song);
-int
-playerSeek(struct song *song, float seek_time);
+/**
+ * Makes the player thread seek the specified song to a position.
+ *
+ * @return true on success, false on failure (e.g. if MPD isn't
+ * playing currently)
+ */
+bool
+pc_seek(struct song *song, float seek_time);
void setPlayerCrossFade(float crossFadeInSeconds);
diff --git a/src/playlist_control.c b/src/playlist_control.c
index f1702149a..f96db7f0e 100644
--- a/src/playlist_control.c
+++ b/src/playlist_control.c
@@ -218,7 +218,7 @@ seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time)
{
const struct song *queued;
unsigned i;
- int ret;
+ bool success;
if (!queue_valid_position(&playlist->queue, song))
return PLAYLIST_RESULT_BAD_RANGE;
@@ -242,8 +242,8 @@ seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time)
queued = NULL;
}
- ret = playerSeek(queue_get_order(&playlist->queue, i), seek_time);
- if (ret < 0) {
+ success = pc_seek(queue_get_order(&playlist->queue, i), seek_time);
+ if (!success) {
playlist_update_queued_song(playlist, queued);
return PLAYLIST_RESULT_NOT_PLAYING;