diff options
Diffstat (limited to 'stream/stream.c')
-rw-r--r-- | stream/stream.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/stream/stream.c b/stream/stream.c index d6521586b5..35d09ad023 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -929,6 +929,20 @@ struct bstr stream_read_complete(struct stream *s, void *talloc_ctx, return (struct bstr){buf, total_read}; } +struct bstr stream_read_file(const char *filename, void *talloc_ctx, + struct mpv_global *global, int max_size) +{ + struct bstr res = {0}; + char *fname = mp_get_user_path(NULL, global, filename); + stream_t *s = stream_open(fname, global); + if (s) { + res = stream_read_complete(s, talloc_ctx, max_size); + free_stream(s); + } + talloc_free(fname); + return res; +} + struct mp_cancel { atomic_bool triggered; #ifdef __MINGW32__ |