From 4d6b9550fe1e0354461716f560d71d78196d5da5 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Fri, 27 Mar 2015 13:27:40 +0100 Subject: vo_opengl: add support for custom shaders --- stream/stream.c | 14 ++++++++++++++ stream/stream.h | 2 ++ 2 files changed, 16 insertions(+) (limited to 'stream') 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__ diff --git a/stream/stream.h b/stream/stream.h index cda5c7434e..981c90cf5e 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -258,6 +258,8 @@ struct mpv_global; struct bstr stream_read_complete(struct stream *s, void *talloc_ctx, int max_size); +struct bstr stream_read_file(const char *filename, void *talloc_ctx, + struct mpv_global *global, int max_size); int stream_control(stream_t *s, int cmd, void *arg); void free_stream(stream_t *s); struct stream *stream_create(const char *url, int flags, -- cgit v1.2.3