summaryrefslogtreecommitdiff
path: root/streamer.c
diff options
context:
space:
mode:
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;