mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
stream: add stream_read_file2
This is stream_read_file with the ability to specify flags.
This commit is contained in:
@@ -848,9 +848,15 @@ struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
|
||||
struct bstr stream_read_file(const char *filename, void *talloc_ctx,
|
||||
struct mpv_global *global, int max_size)
|
||||
{
|
||||
struct bstr res = {0};
|
||||
int flags = STREAM_ORIGIN_DIRECT | STREAM_READ | STREAM_LOCAL_FS_ONLY |
|
||||
STREAM_LESS_NOISE;
|
||||
return stream_read_file2(filename, talloc_ctx, flags, global, max_size);
|
||||
}
|
||||
|
||||
struct bstr stream_read_file2(const char *filename, void *talloc_ctx,
|
||||
int flags, struct mpv_global *global, int max_size)
|
||||
{
|
||||
struct bstr res = {0};
|
||||
stream_t *s = stream_create(filename, flags, NULL, global);
|
||||
if (s) {
|
||||
if (s->is_directory)
|
||||
|
||||
@@ -228,6 +228,9 @@ 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);
|
||||
// Like stream_read_file(), but allows specifying flags like with stream_create().
|
||||
struct bstr stream_read_file2(const char *filename, void *talloc_ctx,
|
||||
int flags, struct mpv_global *global, int max_size);
|
||||
|
||||
int stream_control(stream_t *s, int cmd, void *arg);
|
||||
void free_stream(stream_t *s);
|
||||
|
||||
Reference in New Issue
Block a user