diff options
author | wm4 <wm4@nowhere> | 2016-12-04 23:15:31 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-12-04 23:15:31 +0100 |
commit | ceb2e1026d4295d3831d080dc18f8ca5db56bc5c (patch) | |
tree | ff0bc73ad982c1a1740aa8b1fb31b83fabbe7879 /demux/demux_lavf.c | |
parent | 83c5f704e7d483e2db6df90dacd24896d45fe39a (diff) | |
download | mpv-ceb2e1026d4295d3831d080dc18f8ca5db56bc5c.tar.bz2 mpv-ceb2e1026d4295d3831d080dc18f8ca5db56bc5c.tar.xz |
demux, stream: add option to prevent opening referenced files
Quite irresponsibly hacked together. Sue me.
Diffstat (limited to 'demux/demux_lavf.c')
-rw-r--r-- | demux/demux_lavf.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index d5598a942b..94bcd3fff6 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -22,6 +22,7 @@ #include <stdbool.h> #include <string.h> #include <strings.h> +#include <errno.h> #include <assert.h> #include "config.h" @@ -754,6 +755,14 @@ static int interrupt_cb(void *ctx) return mp_cancel_test(priv->stream->cancel); } +static int block_io_open(struct AVFormatContext *s, AVIOContext **pb, + const char *url, int flags, AVDictionary **options) +{ + struct demuxer *demuxer = s->opaque; + MP_ERR(demuxer, "Not opening '%s' due to --access-references=no.\n", url); + return AVERROR(EACCES); +} + static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) { AVFormatContext *avfc; @@ -855,6 +864,12 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) .opaque = demuxer, }; +#if HAVE_AVFORMAT_IOOPEN + avfc->opaque = demuxer; + if (!demuxer->access_references) + avfc->io_open = block_io_open; +#endif + mp_set_avdict(&dopts, lavfdopts->avopts); if (avformat_open_input(&avfc, priv->filename, priv->avif, &dopts) < 0) { |