aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder_control.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-08-15 17:49:23 +0200
committerMax Kellermann <max@duempel.org>2012-08-15 17:58:15 +0200
commitb5fde6dfa55676560ee8805e8e00bc188a5ad928 (patch)
tree264ab852df3a45a5b03a3fff9b7e99fd364816ec /src/decoder_control.c
parent784d666a8e0c4afae45f18b68cdac7734962520c (diff)
downloadmpd-b5fde6dfa55676560ee8805e8e00bc188a5ad928.tar.gz
mpd-b5fde6dfa55676560ee8805e8e00bc188a5ad928.tar.xz
mpd-b5fde6dfa55676560ee8805e8e00bc188a5ad928.zip
decoder_control: add function _is_current_song()
Replaces _current_song().
Diffstat (limited to 'src/decoder_control.c')
-rw-r--r--src/decoder_control.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/decoder_control.c b/src/decoder_control.c
index caa3705f5..2a2d8ac66 100644
--- a/src/decoder_control.c
+++ b/src/decoder_control.c
@@ -97,6 +97,27 @@ dc_command_async(struct decoder_control *dc, enum decoder_command cmd)
decoder_unlock(dc);
}
+bool
+decoder_is_current_song(const struct decoder_control *dc,
+ const struct song *song)
+{
+ assert(dc != NULL);
+ assert(song != NULL);
+
+ switch (dc->state) {
+ case DECODE_STATE_STOP:
+ case DECODE_STATE_ERROR:
+ return false;
+
+ case DECODE_STATE_START:
+ case DECODE_STATE_DECODE:
+ return dc->song == song;
+ }
+
+ assert(false);
+ return false;
+}
+
void
dc_start(struct decoder_control *dc, struct song *song,
unsigned start_ms, unsigned end_ms,