summaryrefslogtreecommitdiffstats
path: root/stream/stream_rar.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_rar.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_rar.c')
-rw-r--r--stream/stream_rar.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/stream/stream_rar.c b/stream/stream_rar.c
index 733ea3f36c..58e6232092 100644
--- a/stream/stream_rar.c
+++ b/stream/stream_rar.c
@@ -82,6 +82,9 @@ static int rar_entry_control(stream_t *s, int cmd, void *arg)
case STREAM_CTRL_GET_BASE_FILENAME:
*(char **)arg = talloc_strdup(NULL, rar_file->s->url);
return STREAM_OK;
+ case STREAM_CTRL_GET_SIZE:
+ *(int64_t *)arg = rar_file->size;
+ return STREAM_OK;
}
return STREAM_UNSUPPORTED;
}
@@ -131,7 +134,6 @@ static int rar_entry_open(stream_t *stream)
RarSeek(file, 0);
stream->priv = file;
- stream->end_pos = file->size;
stream->fill_buffer = rar_entry_fill_buffer;
stream->seek = rar_entry_seek;
stream->seekable = true;
@@ -159,6 +161,12 @@ static void rar_filter_close(stream_t *s)
free_stream(m);
}
+static int rar_filter_control(stream_t *s, int cmd, void *arg)
+{
+ struct stream *m = s->priv;
+ return stream_control(m, cmd, arg);
+}
+
static int rar_filter_open(stream_t *stream)
{
struct stream *rar = stream->source;
@@ -186,11 +194,11 @@ static int rar_filter_open(stream_t *stream)
struct stream *m = open_memory_stream(pl, strlen(pl));
stream->priv = m;
- stream->end_pos = m->end_pos;
stream->fill_buffer = rar_filter_fill_buffer;
stream->seek = rar_filter_seek;
stream->seekable = true;
stream->close = rar_filter_close;
+ stream->control = rar_filter_control;
stream->safe_origin = true;
talloc_free(tmp);