summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-21 21:15:28 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2014-07-21 21:15:28 +0200
commit64e58f02324fb84ca2f6013fbfe48c4877a41ee1 (patch)
treeb4133170f5a8e53de083a7901adb8ea61f32ecac
parent802974f85427a78bb6d97e5e414308a23c439935 (diff)
added workaround to display future playpos immediately after seek, without resetting seekbar to the real playpos
-rw-r--r--streamer.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/streamer.c b/streamer.c
index 2749bd4f..c84a4097 100644
--- a/streamer.c
+++ b/streamer.c
@@ -116,7 +116,7 @@ static int nextsong = -1;
static int nextsong_pstate = -1;
static int badsong = -1;
-static float seekpos = -1;
+static float last_seekpos = -1;
static float playpos = 0; // play position of current song
static int avg_bitrate = -1; // avg bitrate of current song
@@ -1307,7 +1307,7 @@ error:
float
streamer_get_playpos (void) {
- float seek = seekpos;
+ float seek = last_seekpos;
if (seek >= 0) {
return seek;
}
@@ -1355,7 +1355,7 @@ streamer_set_nextsong_real (int song, int pstate) {
// no sense to wait until end of previous song, reset buffer
bytes_until_next_song = 0;
playpos = 0;
- seekpos = -1;
+ last_seekpos = -1;
}
streamer_unlock ();
}
@@ -1372,6 +1372,7 @@ streamer_set_generic_output_format (void) {
void
streamer_set_seek (float pos) {
+ last_seekpos = pos;
handler_push (handler, STR_EV_SEEK, 0, *((uint32_t *)&pos), 0);
}
@@ -1525,6 +1526,8 @@ streamer_thread (void *ctx) {
#endif
while (!streaming_terminate) {
+ float seekpos = -1;
+
struct timeval tm1;
DB_output_t *output = plug_get_output ();
gettimeofday (&tm1, NULL);
@@ -1634,6 +1637,7 @@ streamer_thread (void *ctx) {
avg_bitrate = -1;
playlist_track = playing_track;
playpos = 0;
+ last_seekpos = -1;
seekpos = -1;
// don't switch if unchanged
@@ -1648,7 +1652,6 @@ streamer_thread (void *ctx) {
}
float seek = seekpos;
- seekpos = -1;
if (seek >= 0 && pl_get_item_duration (playing_track) > 0) {
playpos = seek;
trace ("seeking to %f\n", seek);
@@ -1747,6 +1750,7 @@ streamer_thread (void *ctx) {
ev->playpos = playpos;
messagepump_push_event ((ddb_event_t*)ev, 0, 0);
}
+ last_seekpos = -1;
// read ahead at 2x speed of output samplerate, in 4k blocks
int rate = output->fmt.samplerate;