1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-16 20:27:23 +00:00

input: cascade-load input.conf

If there are several input.confs in the set of valid config paths, load
them all.
This commit is contained in:
wm4 2014-10-29 22:54:03 +01:00
parent 06bb1e0fc4
commit fb4d26e769

View File

@ -1177,11 +1177,7 @@ static int parse_config_file(struct input_ctx *ictx, char *file, bool warn)
stream_t *s = NULL; stream_t *s = NULL;
file = mp_get_user_path(tmp, ictx->global, file); file = mp_get_user_path(tmp, ictx->global, file);
if (!mp_path_exists(file)) {
MP_MSG(ictx, warn ? MSGL_ERR : MSGL_V,
"Input config file %s not found.\n", file);
goto done;
}
s = stream_open(file, ictx->global); s = stream_open(file, ictx->global);
if (!s) { if (!s) {
MP_ERR(ictx, "Can't open input config file %s.\n", file); MP_ERR(ictx, "Can't open input config file %s.\n", file);
@ -1254,9 +1250,11 @@ void mp_input_load(struct input_ctx *ictx)
config_ok = parse_config_file(ictx, input_conf->config_file, true); config_ok = parse_config_file(ictx, input_conf->config_file, true);
if (!config_ok && ictx->global->opts->load_config) { if (!config_ok && ictx->global->opts->load_config) {
// Try global conf dir // Try global conf dir
char *file = mp_find_config_file(NULL, ictx->global, "input.conf"); void *tmp = talloc_new(NULL);
config_ok = file && parse_config_file(ictx, file, false); char **files = mp_find_all_config_files(tmp, ictx->global, "input.conf");
talloc_free(file); for (int n = 0; files && files[n]; n++)
config_ok = config_ok | parse_config_file(ictx, files[n], false);
talloc_free(tmp);
} }
if (!config_ok) { if (!config_ok) {
MP_VERBOSE(ictx, "Falling back on default (hardcoded) input config\n"); MP_VERBOSE(ictx, "Falling back on default (hardcoded) input config\n");