summaryrefslogtreecommitdiffstats
path: root/stream/stream_memory.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-07 15:54:34 +0100
committerwm4 <wm4@nowhere>2019-11-07 22:53:13 +0100
commite5a9b792ecf08ddbcf3b674de3a00f7a919d1858 (patch)
treeead751b12d006d13f138867324b62dda62b8e77b /stream/stream_memory.c
parentca75fedaf4dea19986159f1caa5ab9ebc202f9d4 (diff)
downloadmpv-e5a9b792ecf08ddbcf3b674de3a00f7a919d1858.tar.bz2
mpv-e5a9b792ecf08ddbcf3b674de3a00f7a919d1858.tar.xz
stream: replace STREAM_CTRL_GET_SIZE with a proper entrypoint
This is overlay convoluted as a stream control, and important enough to warrant "first class" functionality.
Diffstat (limited to 'stream/stream_memory.c')
-rw-r--r--stream/stream_memory.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/stream/stream_memory.c b/stream/stream_memory.c
index f329da4850..5acd05dfea 100644
--- a/stream/stream_memory.c
+++ b/stream/stream_memory.c
@@ -38,14 +38,10 @@ static int seek(stream_t *s, int64_t newpos)
return 1;
}
-static int control(stream_t *s, int cmd, void *arg)
+static int64_t get_size(stream_t *s)
{
struct priv *p = s->priv;
- if (cmd == STREAM_CTRL_GET_SIZE) {
- *(int64_t *)arg = p->data.len;
- return 1;
- }
- return STREAM_UNSUPPORTED;
+ return p->data.len;
}
static int open2(stream_t *stream, struct stream_open_args *args)
@@ -53,7 +49,7 @@ static int open2(stream_t *stream, struct stream_open_args *args)
stream->fill_buffer = fill_buffer;
stream->seek = seek;
stream->seekable = true;
- stream->control = control;
+ stream->get_size = get_size;
stream->read_chunk = 1024 * 1024;
struct priv *p = talloc_zero(stream, struct priv);