summaryrefslogtreecommitdiffstats
path: root/stream/stream.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-02-06 21:32:44 +0100
committerwm4 <wm4@nowhere>2015-02-06 21:43:52 +0100
commit5de29b860b25bb4ba8b1e02d9b3aee7a81009be0 (patch)
tree48e2b98f35ceb2aecef8a0706e921e3219b6994d /stream/stream.c
parent347cf972310c0de5565015190c1cd6e7d3d3d30c (diff)
downloadmpv-5de29b860b25bb4ba8b1e02d9b3aee7a81009be0.tar.bz2
mpv-5de29b860b25bb4ba8b1e02d9b3aee7a81009be0.tar.xz
stream: get rid of remaining uses of the end_pos field
Most things stopped using this field for better support of growing files. Go through the trouble to repalce the remaining uses, so it can be removed. Also move the "streaming" field; saves 4 bytes (wow!).
Diffstat (limited to 'stream/stream.c')
-rw-r--r--stream/stream.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/stream/stream.c b/stream/stream.c
index d4f0fbc320..fd545da7e7 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -676,7 +676,7 @@ bool stream_seek(stream_t *s, int64_t pos)
}
if (s->mode == STREAM_WRITE)
- return s->seekable && s->seek(s, pos));
+ return s->seekable && s->seek(s, pos);
int64_t newpos = pos;
if (s->sector_size)
@@ -717,21 +717,7 @@ bool stream_skip(stream_t *s, int64_t len)
int stream_control(stream_t *s, int cmd, void *arg)
{
- if (!s->control)
- return STREAM_UNSUPPORTED;
- int r = s->control(s, cmd, arg);
- if (r == STREAM_UNSUPPORTED) {
- // Fallbacks
- switch (cmd) {
- case STREAM_CTRL_GET_SIZE:
- if (s->end_pos > 0) {
- *(int64_t *)arg = s->end_pos;
- return STREAM_OK;
- }
- break;
- }
- }
- return r;
+ return s->control ? s->control(s, cmd, arg) : STREAM_UNSUPPORTED;
}
void free_stream(stream_t *s)