summaryrefslogtreecommitdiffstats
path: root/stream/stream.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-05-10 16:44:35 +0200
committerwm4 <wm4@nowhere>2020-05-10 16:44:35 +0200
commitad9f3bfe961b3f3bf3e047316419a60de8be49e7 (patch)
treefcfea7879990f74da7881a0c737f603c1bb795f5 /stream/stream.h
parenta600d152d21ef398eb72b008ee3fe266696eb638 (diff)
downloadmpv-ad9f3bfe961b3f3bf3e047316419a60de8be49e7.tar.bz2
mpv-ad9f3bfe961b3f3bf3e047316419a60de8be49e7.tar.xz
stream: make stream_read_file() more robust
Change it to strictly accept local paths only. No more http://, no more $HOME expansion with "~/" or mpv config path expansion with "~~/". This should behave as if passing a path directly to open(). Reduce annoying log noise to further facilitate it using as open() replacement.
Diffstat (limited to 'stream/stream.h')
-rw-r--r--stream/stream.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/stream/stream.h b/stream/stream.h
index 2c78a35959..c127860ceb 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -48,6 +48,9 @@
#define STREAM_ORIGIN_MASK (7 << 2) // for extracting origin value from flags
+#define STREAM_LOCAL_FS_ONLY (1 << 5) // stream_file only, no URLs
+#define STREAM_LESS_NOISE (1 << 6) // try to log errors only
+
// end flags for stream_open_ext (the naming convention sucks)
#define STREAM_UNSAFE -3
@@ -109,6 +112,7 @@ typedef struct stream_info_st {
int (*open2)(struct stream *st, struct stream_open_args *args);
const char *const *protocols;
bool can_write; // correctly checks for READ/WRITE modes
+ bool local_fs; // supports STREAM_LOCAL_FS_ONLY
int stream_origin; // 0 or set of STREAM_ORIGIN_*; if 0, the same origin
// is set, or the stream's open() function handles it
} stream_info_t;
@@ -218,6 +222,7 @@ 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);