player_control: renamed playerSeek(), return bool

Renamed playerSeek() to pc_seek() to get rid of CamelCase.  Convert
the return value to bool.
This commit is contained in:
Max Kellermann 2009-05-06 18:35:22 +02:00
parent 0935d85c69
commit 3083df5a5f
3 changed files with 15 additions and 9 deletions

View File

@ -220,13 +220,13 @@ queueSong(struct song *song)
player_command(PLAYER_COMMAND_QUEUE); player_command(PLAYER_COMMAND_QUEUE);
} }
int bool
playerSeek(struct song *song, float seek_time) pc_seek(struct song *song, float seek_time)
{ {
assert(song != NULL); assert(song != NULL);
if (pc.state == PLAYER_STATE_STOP) if (pc.state == PLAYER_STATE_STOP)
return -1; return false;
pc.next_song = song; pc.next_song = song;
@ -237,7 +237,7 @@ playerSeek(struct song *song, float seek_time)
idle_add(IDLE_PLAYER); idle_add(IDLE_PLAYER);
} }
return 0; return true;
} }
float getPlayerCrossFade(void) float getPlayerCrossFade(void)

View File

@ -132,8 +132,14 @@ void playerWait(void);
void void
queueSong(struct song *song); 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); void setPlayerCrossFade(float crossFadeInSeconds);

View File

@ -218,7 +218,7 @@ seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time)
{ {
const struct song *queued; const struct song *queued;
unsigned i; unsigned i;
int ret; bool success;
if (!queue_valid_position(&playlist->queue, song)) if (!queue_valid_position(&playlist->queue, song))
return PLAYLIST_RESULT_BAD_RANGE; return PLAYLIST_RESULT_BAD_RANGE;
@ -242,8 +242,8 @@ seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time)
queued = NULL; queued = NULL;
} }
ret = playerSeek(queue_get_order(&playlist->queue, i), seek_time); success = pc_seek(queue_get_order(&playlist->queue, i), seek_time);
if (ret < 0) { if (!success) {
playlist_update_queued_song(playlist, queued); playlist_update_queued_song(playlist, queued);
return PLAYLIST_RESULT_NOT_PLAYING; return PLAYLIST_RESULT_NOT_PLAYING;