From 77a77d886978a87ab2ff8f68da553d4b34b5d48b Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 20 Nov 2012 13:31:56 +0100 Subject: mplayer: disable auto-loading of external codecs.conf Do not load codecs.conf files located in $PREFIX/etc/mpv/ or ~/.mpv/. There really is no use for this, other than possibly breaking things. It's still possible to use --codecs-file explicitly to load an external config file, and this option can be used in ~/.mpv/config. While we're at it, remove the global codecs_file variable, and another unused variable. --- core/cfg-mplayer.h | 5 +---- core/codec-cfg.c | 4 ---- core/mplayer.c | 17 ++++------------- core/options.h | 1 + 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index 499ba3f1e3..a7f9637ebe 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -43,9 +43,6 @@ extern int stop_xscreensaver; extern int mp_msg_color; extern int mp_msg_module; -/* defined in codec-cfg.c */ -extern char *codecs_file; - /* defined in dec_video.c */ extern int field_dominance; @@ -490,7 +487,7 @@ const m_option_t common_opts[] = { {"lavdopts", (void *) lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, {"lavfdopts", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, - {"codecs-file", &codecs_file, CONF_TYPE_STRING, 0, 0, 0, NULL}, + OPT_STRING("codecs-file", codecs_file, 0), // ------------------------- subtitles options -------------------- OPT_STRINGLIST("sub", sub_name, 0), diff --git a/core/codec-cfg.c b/core/codec-cfg.c index c8fc3c74bb..91e56d6e25 100644 --- a/core/codec-cfg.c +++ b/core/codec-cfg.c @@ -59,9 +59,6 @@ static const struct bstr builtin_codecs_conf = { #define TYPE_VIDEO 0 #define TYPE_AUDIO 1 -static int codecs_conf_release; -char * codecs_file = NULL; - static int add_to_fourcc(char *s, char *alias, unsigned int *fourcc, unsigned int *map) { @@ -383,7 +380,6 @@ int parse_codec_cfg(const char *cfgfile) tmp = atoi(token[0]); if (tmp < codec_cfg_min) goto err_out_release_num; - codecs_conf_release = tmp; while ((tmp = get_token(1, 1)) == RET_EOL) /* NOTHING */; if (tmp == RET_EOF) diff --git a/core/mplayer.c b/core/mplayer.c index 6ad6365850..ebe6d8f9db 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -4252,19 +4252,10 @@ static bool handle_help_options(struct MPContext *mpctx) static bool load_codecs_conf(struct MPContext *mpctx) { /* Check codecs.conf. */ - if (!codecs_file || !parse_codec_cfg(codecs_file)) { - char *mem_ptr; - if (!parse_codec_cfg(mem_ptr = get_path("codecs.conf"))) { - if (!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")) { - if (!parse_codec_cfg(NULL)) - return false; - mp_tmsg(MSGT_CPLAYER, MSGL_V, - "Using built-in default codecs.conf.\n"); - } - } - free(mem_ptr); // release the buffer created by get_path() - } - return true; + if (mpctx->opts.codecs_file && parse_codec_cfg(mpctx->opts.codecs_file)) + return true; + mp_tmsg(MSGT_CPLAYER, MSGL_V, "Using built-in default codecs.conf.\n"); + return parse_codec_cfg(NULL); } #ifdef PTW32_STATIC_LIB diff --git a/core/options.h b/core/options.h index 3f916310b6..28bdd70e3c 100644 --- a/core/options.h +++ b/core/options.h @@ -51,6 +51,7 @@ typedef struct MPOpts { int chapter_merge_threshold; int quiet; int noconfig; + char *codecs_file; int stream_cache_size; float stream_cache_min_percent; float stream_cache_seek_min_percent; -- cgit v1.2.3