diff options
author | Max Kellermann <max@duempel.org> | 2009-10-08 20:48:07 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-10-08 20:48:07 +0200 |
commit | 76953a9748e367442fe7c961845ee36b9a0e1596 (patch) | |
tree | 9aad3078411e170a56e11e31158a66f26734298a /src/command.c | |
parent | 128a5fa4a599b72e6cb9c9f3954aec62dd3b3181 (diff) | |
download | mpd-76953a9748e367442fe7c961845ee36b9a0e1596.tar.gz mpd-76953a9748e367442fe7c961845ee36b9a0e1596.tar.xz mpd-76953a9748e367442fe7c961845ee36b9a0e1596.zip |
player_control: bundle "get" functions in pc_get_status()
The new player_status struct replaces a bunch of playerGetX()
functions. When we add proper locking to the player_control struct,
we will only need to lock once for the "status" command.
Diffstat (limited to 'src/command.c')
-rw-r--r-- | src/command.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/command.c b/src/command.c index c48ea845d..9cd6d0e38 100644 --- a/src/command.c +++ b/src/command.c @@ -453,11 +453,14 @@ handle_status(struct client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { const char *state = NULL; + struct player_status player_status; int updateJobId; char *error; int song; - switch (getPlayerState()) { + pc_get_status(&player_status); + + switch (player_status.state) { case PLAYER_STATE_STOP: state = "stop"; break; @@ -497,17 +500,19 @@ handle_status(struct client *client, song, playlist_get_song_id(&g_playlist, song)); } - if (getPlayerState() != PLAYER_STATE_STOP) { - const struct audio_format *af = player_get_audio_format(); + if (player_status.state != PLAYER_STATE_STOP) { client_printf(client, COMMAND_STATUS_TIME ": %i:%i\n" "elapsed: %1.3f\n" - COMMAND_STATUS_BITRATE ": %li\n" + COMMAND_STATUS_BITRATE ": %u\n" COMMAND_STATUS_AUDIO ": %u:%u:%u\n", - getPlayerElapsedTime(), getPlayerTotalTime(), - pc.elapsed_time, - getPlayerBitRate(), - af->sample_rate, af->bits, af->channels); + (int)(player_status.elapsed_time + 0.5), + (int)(player_status.total_time + 0.5), + player_status.elapsed_time, + player_status.bit_rate, + player_status.audio_format.sample_rate, + player_status.audio_format.bits, + player_status.audio_format.channels); } if ((updateJobId = isUpdatingDB())) { |