summaryrefslogtreecommitdiffstats
path: root/stream/stream_cb.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/stream_cb.c')
-rw-r--r--stream/stream_cb.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/stream/stream_cb.c b/stream/stream_cb.c
index 5a946a6369..c6f33263a3 100644
--- a/stream/stream_cb.c
+++ b/stream/stream_cb.c
@@ -36,22 +36,17 @@ static int seek(stream_t *s, int64_t newpos)
return p->info.seek_fn(p->info.cookie, newpos) >= 0;
}
-static int control(stream_t *s, int cmd, void *arg)
+static int64_t get_size(stream_t *s)
{
struct priv *p = s->priv;
- switch (cmd) {
- case STREAM_CTRL_GET_SIZE: {
- if (!p->info.size_fn)
- break;
+
+ if (p->info.size_fn) {
int64_t size = p->info.size_fn(p->info.cookie);
- if (size >= 0) {
- *(int64_t *)arg = size;
- return 1;
- }
- break;
- }
+ if (size >= 0)
+ return size;
}
- return STREAM_UNSUPPORTED;
+
+ return -1;
}
static void s_close(stream_t *s)
@@ -96,7 +91,7 @@ static int open_cb(stream_t *stream)
}
stream->fast_skip = true;
stream->fill_buffer = fill_buffer;
- stream->control = control;
+ stream->get_size = get_size;
stream->read_chunk = 64 * 1024;
stream->close = s_close;