summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-06 20:39:58 +0200
committerwm4 <wm4@nowhere>2013-06-16 22:05:09 +0200
commit1c35794efd7d025457e527b61f7c23fe375c2f5a (patch)
treef9c38b117b3b3e05ee8db67310762b42c4de17ab /stream
parent7fefad7a8f2e45fcab60b400a63c43097ad6c681 (diff)
downloadmpv-1c35794efd7d025457e527b61f7c23fe375c2f5a.tar.bz2
mpv-1c35794efd7d025457e527b61f7c23fe375c2f5a.tar.xz
stream: remove stream_reset()
This function was called in various places. Most time, it was used before a seek. In other cases, the purpose was apparently resetting the EOF flag. As far as I can see, this makes no sense anymore. At least the stream_reset() calls paired with stream_seek() are completely pointless. A seek will either seek inside the buffer (and reset the EOF flag), or do an actual seek and reset all state.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c14
-rw-r--r--stream/stream.h1
2 files changed, 3 insertions, 12 deletions
diff --git a/stream/stream.c b/stream/stream.c
index d77ecfae6e..d27b3f5f3f 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -304,7 +304,8 @@ static int stream_reconnect(stream_t *s)
return 0;
s->eof = 1;
- stream_reset(s);
+ s->pos = 0;
+ s->buf_pos = s->buf_len = 0;
// Some streams (internal http.c) don't support STREAM_CTRL_RECONNECT,
// but do it when trying to seek.
@@ -523,6 +524,7 @@ static int stream_seek_unbuffered(stream_t *s, int64_t newpos)
}
}
}
+ s->eof = 0; // EOF reset when seek succeeds.
return -1;
}
@@ -561,7 +563,6 @@ static int stream_seek_long(stream_t *s, int64_t pos)
break; // EOF
}
- s->eof = 0; // EOF reset when seek succeeds.
while (stream_fill_buffer(s) > 0) {
if (pos <= s->buf_len) {
s->buf_pos = pos; // byte position in sector
@@ -623,15 +624,6 @@ int stream_skip(stream_t *s, int64_t len)
return 1;
}
-void stream_reset(stream_t *s)
-{
- if (s->eof) {
- s->pos = 0;
- s->buf_pos = s->buf_len = 0;
- s->eof = 0;
- }
-}
-
int stream_control(stream_t *s, int cmd, void *arg)
{
if (!s->control)
diff --git a/stream/stream.h b/stream/stream.h
index 73cfd6e87d..db58a2fba0 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -307,7 +307,6 @@ struct MPOpts;
*/
struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
int max_size, int padding_bytes);
-void stream_reset(stream_t *s);
int stream_control(stream_t *s, int cmd, void *arg);
void stream_update_size(stream_t *s);
void free_stream(stream_t *s);