summaryrefslogtreecommitdiffstats
path: root/stream/stream.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-22 18:23:33 +0200
committerwm4 <wm4@nowhere>2013-08-22 19:14:26 +0200
commitf806e268c6c3a76f65b1282219e16fcdfb80a9b5 (patch)
tree66876fbc7d96308da11a91456d91ef90223bac23 /stream/stream.c
parenta790f2133bb785e0c48a7c6cdc730c8b7e8287fb (diff)
downloadmpv-f806e268c6c3a76f65b1282219e16fcdfb80a9b5.tar.bz2
mpv-f806e268c6c3a76f65b1282219e16fcdfb80a9b5.tar.xz
stream: don't require streams to set s->pos in seek callback
Instead, set s->pos depending on the success of the seek callback.
Diffstat (limited to 'stream/stream.c')
-rw-r--r--stream/stream.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/stream/stream.c b/stream/stream.c
index f735329cdd..3687dc75b0 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -550,6 +550,7 @@ static int stream_seek_unbuffered(stream_t *s, int64_t newpos)
return 0;
}
}
+ s->pos = newpos;
s->eof = 0; // EOF reset when seek succeeds.
return -1;
}
@@ -558,7 +559,6 @@ static int stream_seek_unbuffered(stream_t *s, int64_t newpos)
// Unlike stream_seek_unbuffered(), it still fills the local buffer.
static int stream_seek_long(stream_t *s, int64_t pos)
{
- int64_t oldpos = s->pos;
s->buf_pos = s->buf_len = 0;
s->eof = 0;
@@ -572,14 +572,12 @@ static int stream_seek_long(stream_t *s, int64_t pos)
if (s->sector_size)
newpos = (pos / s->sector_size) * s->sector_size;
- mp_msg(MSGT_STREAM, MSGL_DBG3, "s->pos=%" PRIX64 " newpos=%" PRIX64
- " new_bufpos=%" PRIX64 " buflen=%X \n",
- (int64_t)s->pos, (int64_t)newpos, (int64_t)pos, s->buf_len);
+ mp_msg(MSGT_STREAM, MSGL_DBG3, "Seek from %" PRId64 " to %" PRId64
+ " (with offset %d)\n", s->pos, pos, (int)(pos - newpos));
if (!s->seek && (s->flags & MP_STREAM_FAST_SKIPPING) && pos >= s->pos) {
// skipping is handled by generic code below
} else if (stream_seek_unbuffered(s, newpos) >= 0) {
- s->pos = oldpos;
return 0;
}