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. --- stream/stream.c | 6 ++++++ stream/stream.h | 1 + stream/stream_bluray.c | 3 +++ stream/stream_dvd.c | 3 +++ stream/stream_dvdnav.c | 3 +++ 5 files changed, 16 insertions(+) (limited to 'stream') diff --git a/stream/stream.c b/stream/stream.c index c936c5c77e..4c7aa04844 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -230,6 +230,12 @@ static int open_internal(const stream_info_t *sinfo, const char *url, int flags, s->is_network = sinfo->is_network; s->mode = flags & (STREAM_READ | STREAM_WRITE); + if (global->config) { + int opt; + mp_read_option_raw(global, "access-references", &m_option_type_flag, &opt); + s->access_references = opt; + } + MP_VERBOSE(s, "Opening %s\n", url); if ((s->mode & STREAM_WRITE) && !sinfo->can_write) { diff --git a/stream/stream.h b/stream/stream.h index 4444da8ed3..7d44e30eae 100644 --- a/stream/stream.h +++ b/stream/stream.h @@ -197,6 +197,7 @@ typedef struct stream { bool fast_skip : 1; // consider stream fast enough to fw-seek by skipping bool is_network : 1; // original stream_info_t.is_network flag bool allow_caching : 1; // stream cache makes sense + bool access_references : 1; // open other streams struct mp_log *log; struct mpv_global *global; diff --git a/stream/stream_bluray.c b/stream/stream_bluray.c index 26a78e5f21..5f083954c2 100644 --- a/stream/stream_bluray.c +++ b/stream/stream_bluray.c @@ -569,6 +569,9 @@ static int bdmv_dir_stream_open(stream_t *stream) .cfg_title = BLURAY_DEFAULT_TITLE, }; + if (!stream->access_references) + goto unsupported; + char *path = mp_file_get_path(priv, bstr0(stream->url)); if (!path) goto unsupported; diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index 4b423de630..338c23633c 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -951,6 +951,9 @@ static int ifo_stream_open(stream_t *stream) dvd_priv_t *priv = talloc_zero(stream, dvd_priv_t); stream->priv = priv; + if (!stream->access_references) + goto unsupported; + char *path = mp_file_get_path(priv, bstr0(stream->url)); if (!path) goto unsupported; diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c index ec15c83b20..1178f50857 100644 --- a/stream/stream_dvdnav.c +++ b/stream/stream_dvdnav.c @@ -562,6 +562,9 @@ static int ifo_dvdnav_stream_open(stream_t *stream) struct priv *priv = talloc_zero(stream, struct priv); stream->priv = priv; + if (!stream->access_references) + goto unsupported; + priv->track = TITLE_LONGEST; char *path = mp_file_get_path(priv, bstr0(stream->url)); -- cgit v1.2.3