diff options
author | Max Kellermann <max@duempel.org> | 2010-01-02 21:16:51 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2010-01-02 21:16:51 +0100 |
commit | 915182bcb855f114703ddbf8849047c1a9ca43c1 (patch) | |
tree | 99d56534e65b5184a9f5f103e9bc42140f2bab05 /src/output | |
parent | d3b763a48c09a60a0c0b5ccb6cccd9376875c470 (diff) | |
download | mpd-915182bcb855f114703ddbf8849047c1a9ca43c1.tar.gz mpd-915182bcb855f114703ddbf8849047c1a9ca43c1.tar.xz mpd-915182bcb855f114703ddbf8849047c1a9ca43c1.zip |
output_all: reset elapsed_time at song border
Another quirk fixed: after the last chunk of a song has been played,
the "elapsed_time" variable is set to the chunk's time stamp. When
the client receives the PLAYER idle event and asks MPD for the current
time stamp, MPD will return the last time stamp of the previous song
when it hasn't played the first chunk of the current song yet.
Diffstat (limited to '')
-rw-r--r-- | src/output_all.c | 8 | ||||
-rw-r--r-- | src/output_all.h | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/output_all.c b/src/output_all.c index aee496e81..4b7701144 100644 --- a/src/output_all.c +++ b/src/output_all.c @@ -558,6 +558,14 @@ audio_output_all_close(void) audio_output_all_elapsed_time = -1.0; } +void +audio_output_all_song_border(void) +{ + /* clear the elapsed_time pointer at the beginning of a new + song */ + audio_output_all_elapsed_time = 0.0; +} + float audio_output_all_get_elapsed_time(void) { diff --git a/src/output_all.h b/src/output_all.h index 603cb30a2..8c3f1e80d 100644 --- a/src/output_all.h +++ b/src/output_all.h @@ -142,6 +142,12 @@ void audio_output_all_cancel(void); /** + * Indicate that a new song will begin now. + */ +void +audio_output_all_song_border(void); + +/** * Returns the "elapsed_time" stamp of the most recently finished * chunk. A negative value is returned when no chunk has been * finished yet. |