summaryrefslogtreecommitdiffstats
path: root/core/parser-mpcmd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-08-02 17:59:43 +0200
committerwm4 <wm4@nowhere>2013-08-02 18:00:38 +0200
commitd1c563c0a9f24e8ed661c29a8718f7fde162a4ff (patch)
treed8ca65b9ee32ffe5d354a6952193403640b9fa4c /core/parser-mpcmd.c
parent878a94d000093d253206cc50e10632d64f8728cb (diff)
downloadmpv-d1c563c0a9f24e8ed661c29a8718f7fde162a4ff.tar.bz2
mpv-d1c563c0a9f24e8ed661c29a8718f7fde162a4ff.tar.xz
options: don't make options set during playback file local (e.g. --vf)
Refactor file local options handling: instead of making all options implicitly file local between loading a file and terminating playback, explicitly make options file local which are required to be file local. Or in other words, introduce a M_SETOPT_BACKUP flag, which forces file local-ness when setting an option, and use this for file local command line options, per-file config files, and per-protocol/extension/vo/ao profiles. In particular, this changes the "vf" input command such that video filters stay permanent even when going to the next file in the playlist. The underlying reason for this is that the "vf" command uses the option setting command. This influences the "af" command as well.
Diffstat (limited to 'core/parser-mpcmd.c')
-rw-r--r--core/parser-mpcmd.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/parser-mpcmd.c b/core/parser-mpcmd.c
index 3336fce027..d716fc4d28 100644
--- a/core/parser-mpcmd.c
+++ b/core/parser-mpcmd.c
@@ -131,16 +131,15 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
struct playlist_param *local_params = 0;
assert(config != NULL);
- assert(!config->file_local_mode);
mode = GLOBAL;
struct parse_state p = {config, argc, argv};
while (split_opt(&p)) {
if (p.is_opt) {
+ int flags = mode == LOCAL ? M_SETOPT_BACKUP | M_SETOPT_CHECK_ONLY : 0;
int r;
- r = m_config_set_option_ext(config, p.arg, p.param,
- mode == LOCAL ? M_SETOPT_CHECK_ONLY : 0);
+ r = m_config_set_option_ext(config, p.arg, p.param, flags);
if (r <= M_OPT_EXIT) {
ret = r;
goto err_out;
@@ -161,8 +160,6 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
goto err_out;
}
mode = LOCAL;
- // Needed for option checking.
- m_config_enter_file_local(config);
assert(!local_start);
local_start = files->last;
continue;
@@ -191,7 +188,7 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
}
local_params_count = 0;
mode = GLOBAL;
- m_config_leave_file_local(config);
+ m_config_restore_backups(config);
local_start = NULL;
shuffle = false;
continue;
@@ -284,8 +281,7 @@ int m_config_parse_mp_command_line(m_config_t *config, struct playlist *files,
err_out:
talloc_free(local_params);
- if (config->file_local_mode)
- m_config_leave_file_local(config);
+ m_config_restore_backups(config);
return ret;
}