summaryrefslogtreecommitdiff
path: root/streamer.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-13 21:41:52 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-13 21:41:52 +0200
commit0ddca57234f28b2d6c093b49c728ca058a44ffb5 (patch)
treec663480b65b10c879b96c1480381878407837279 /streamer.c
parent2e3e4acb20b6af26d1a2f269318824d2e0443ced (diff)
changed seek behaviour
Diffstat (limited to 'streamer.c')
-rw-r--r--streamer.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/streamer.c b/streamer.c
index 3739ee02..16a1075c 100644
--- a/streamer.c
+++ b/streamer.c
@@ -45,12 +45,19 @@ static uintptr_t mutex;
static int nextsong = -1;
static int nextsong_pstate = -1;
+static float seekpos = -1;
+
void
streamer_set_nextsong (int song, int pstate) {
nextsong = song;
nextsong_pstate = pstate;
}
+void
+streamer_set_seek (float pos) {
+ seekpos = pos;
+}
+
static int
streamer_read_async (char *bytes, int size);
@@ -95,6 +102,20 @@ streamer_thread (uintptr_t ctx) {
usleep (3000);
continue;
}
+
+ if (seekpos >= 0) {
+ float pos = seekpos;
+ seekpos = -1;
+ if (playlist_current.codec->seek (pos) >= 0) {
+ streamer_lock ();
+ streambuffer_fill = 0;
+ streamer_unlock ();
+ codec_lock ();
+ codecleft = 0;
+ codec_unlock ();
+ }
+ }
+
streamer_lock ();
if (streambuffer_fill < STREAM_BUFFER_SIZE) {
int sz = STREAM_BUFFER_SIZE - streambuffer_fill;