summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-31 20:53:58 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-31 20:53:58 +0200
commit092e8bed8b4c1ba931df108e5edc9393916ebae1 (patch)
tree51a6794a99d005f8f06980576c25f05198f412e9
parent7193181e65e83b9add38f3aaa37b3d6793a41186 (diff)
more responsive stop handler
-rw-r--r--handler.c2
-rw-r--r--handler.h3
-rw-r--r--streamer.c4
3 files changed, 8 insertions, 1 deletions
diff --git a/handler.c b/handler.c
index 830bda2c..13dfec49 100644
--- a/handler.c
+++ b/handler.c
@@ -50,7 +50,7 @@ typedef struct handler_s {
message_t pool[1];
} handler_t;
-static void
+void
handler_reset (handler_t *h) {
h->mqueue = NULL;
h->mfree = NULL;
diff --git a/handler.h b/handler.h
index be8b0a80..92dcb777 100644
--- a/handler.h
+++ b/handler.h
@@ -33,6 +33,9 @@ struct handler_s *
handler_alloc (int queue_size);
void
+handler_reset (struct handler_s *h);
+
+void
handler_free (struct handler_s *h);
int
diff --git a/streamer.c b/streamer.c
index 3642386f..ad67ab07 100644
--- a/streamer.c
+++ b/streamer.c
@@ -1359,6 +1359,10 @@ void
streamer_set_nextsong (int song, int pstate) {
// pthread_t tid = pthread_self ();
// assert (tid != streamer_tid);
+ if (pstate == 0) {
+ // this is a stop query -- clear the queue
+ handler_reset (handler);
+ }
streamer_abort_files ();
handler_push (handler, STR_EV_PLAY_TRACK_IDX, 0, song, pstate);
}