diff options
Diffstat (limited to 'stream/stream.c')
-rw-r--r-- | stream/stream.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/stream/stream.c b/stream/stream.c index 116dcef4a4..56313502c3 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -19,7 +19,6 @@ #include <stdlib.h> #include <limits.h> -#include <strings.h> #include <assert.h> #include "osdep/io.h" @@ -30,6 +29,7 @@ #include "common/common.h" #include "common/global.h" +#include "demux/demux.h" #include "misc/bstr.h" #include "misc/thread_tools.h" #include "common/msg.h" @@ -92,7 +92,6 @@ static const stream_info_t *const stream_list[] = { &stream_info_slice, &stream_info_fd, &stream_info_cb, - NULL }; // Because of guarantees documented on STREAM_BUFFER_SIZE. @@ -104,7 +103,7 @@ static const stream_info_t *const stream_list[] = { struct stream_opts { int64_t buffer_size; - int load_unsafe_playlists; + bool load_unsafe_playlists; }; #define OPT_BASE_STRUCT struct stream_opts @@ -113,7 +112,7 @@ const struct m_sub_options stream_conf = { .opts = (const struct m_option[]){ {"stream-buffer-size", OPT_BYTE_SIZE(buffer_size), M_RANGE(STREAM_MIN_BUFFER_SIZE, STREAM_MAX_BUFFER_SIZE)}, - {"load-unsafe-playlists", OPT_FLAG(load_unsafe_playlists)}, + {"load-unsafe-playlists", OPT_BOOL(load_unsafe_playlists)}, {0} }, .size = sizeof(struct stream_opts), @@ -354,9 +353,9 @@ static int stream_create_instance(const stream_info_t *sinfo, if (flags & STREAM_LESS_NOISE) mp_msg_set_max_level(s->log, MSGL_WARN); - int opt; - mp_read_option_raw(s->global, "access-references", &m_option_type_flag, &opt); - s->access_references = opt; + struct demux_opts *demux_opts = mp_get_config_group(s, s->global, &demux_conf); + s->access_references = demux_opts->access_references; + talloc_free(demux_opts); MP_VERBOSE(s, "Opening %s\n", url); @@ -423,7 +422,7 @@ int stream_create_with_args(struct stream_open_args *args, struct stream **ret) if (args->sinfo) { r = stream_create_instance(args->sinfo, args, ret); } else { - for (int i = 0; stream_list[i]; i++) { + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { r = stream_create_instance(stream_list[i], args, ret); if (r == STREAM_OK) break; @@ -803,7 +802,7 @@ int stream_skip_bom(struct stream *s) struct bstr stream_read_complete(struct stream *s, void *talloc_ctx, int max_size) { - if (max_size > 1000000000) + if (max_size <= 0 || max_size > STREAM_MAX_READ_SIZE) abort(); int bufsize; @@ -852,7 +851,7 @@ char **stream_get_proto_list(void) { char **list = NULL; int num = 0; - for (int i = 0; stream_list[i]; i++) { + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { const stream_info_t *stream_info = stream_list[i]; if (!stream_info->protocols) @@ -887,7 +886,7 @@ void stream_print_proto_list(struct mp_log *log) bool stream_has_proto(const char *proto) { - for (int i = 0; stream_list[i]; i++) { + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { const stream_info_t *stream_info = stream_list[i]; for (int j = 0; stream_info->protocols && stream_info->protocols[j]; j++) { |