From ceb2e1026d4295d3831d080dc18f8ca5db56bc5c Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 4 Dec 2016 23:15:31 +0100 Subject: demux, stream: add option to prevent opening referenced files Quite irresponsibly hacked together. Sue me. --- demux/demux.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'demux/demux.c') diff --git a/demux/demux.c b/demux/demux.c index 8aa9989de3..18c9b3b5c1 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -89,6 +89,7 @@ struct demux_opts { double min_secs; int force_seekable; double min_secs_cache; + int access_references; }; #define OPT_BASE_STRUCT struct demux_opts @@ -100,6 +101,7 @@ const struct m_sub_options demux_conf = { OPT_INTRANGE("demuxer-max-bytes", max_bytes, 0, 0, INT_MAX), OPT_FLAG("force-seekable", force_seekable, 0), OPT_DOUBLE("cache-secs", min_secs_cache, M_OPT_MIN, .min = 0), + OPT_FLAG("access-references", access_references, 0), {0} }, .size = sizeof(struct demux_opts), @@ -108,6 +110,7 @@ const struct m_sub_options demux_conf = { .max_bytes = 400 * 1024 * 1024, .min_secs = 1.0, .min_secs_cache = 10.0, + .access_references = 1, }, }; @@ -1213,6 +1216,7 @@ static struct demuxer *open_given_type(struct mpv_global *global, return NULL; struct demuxer *demuxer = talloc_ptrtype(NULL, demuxer); + struct demux_opts *opts = mp_get_config_group(demuxer, global, &demux_conf); *demuxer = (struct demuxer) { .desc = desc, .stream = stream, @@ -1223,6 +1227,7 @@ static struct demuxer *open_given_type(struct mpv_global *global, .glog = log, .filename = talloc_strdup(demuxer, stream->url), .is_network = stream->is_network, + .access_references = opts->access_references, .events = DEMUX_EVENT_ALL, }; demuxer->seekable = stream->seekable; @@ -1230,8 +1235,6 @@ static struct demuxer *open_given_type(struct mpv_global *global, !demuxer->stream->uncached_stream->seekable) demuxer->seekable = false; - struct demux_opts *opts = mp_get_config_group(demuxer, global, &demux_conf); - struct demux_internal *in = demuxer->in = talloc_ptrtype(demuxer, in); *in = (struct demux_internal){ .log = demuxer->log, -- cgit v1.2.3