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/player_control.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/player_control.c')
-rw-r--r-- | src/player_control.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/player_control.c b/src/player_control.c index bef19917f..e27052a4d 100644 --- a/src/player_control.c +++ b/src/player_control.c @@ -129,19 +129,17 @@ void playerSetPause(int pause_flag) } } -int getPlayerElapsedTime(void) -{ - return (int)(pc.elapsed_time + 0.5); -} - -unsigned long getPlayerBitRate(void) +void +pc_get_status(struct player_status *status) { - return pc.bit_rate; -} + status->state = pc.state; -int getPlayerTotalTime(void) -{ - return (int)(pc.total_time + 0.5); + if (pc.state != PLAYER_STATE_STOP) { + status->bit_rate = pc.bit_rate; + status->audio_format = pc.audio_format; + status->total_time = pc.total_time; + status->elapsed_time = pc.elapsed_time; + } } enum player_state getPlayerState(void) |