summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/cfg-mplayer.h1
-rw-r--r--core/m_config.c16
-rw-r--r--core/m_config.h2
-rw-r--r--core/mplayer.c11
-rw-r--r--core/options.h2
5 files changed, 32 insertions, 0 deletions
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h
index dd99e6c4bd..8e0563e380 100644
--- a/core/cfg-mplayer.h
+++ b/core/cfg-mplayer.h
@@ -297,6 +297,7 @@ const m_option_t common_opts[] = {
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
#endif
OPT_FLAG("config", load_config, CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE),
+ OPT_STRINGLIST("reset-on-next-file", reset_options, CONF_GLOBAL),
// ------------------------- stream options --------------------
diff --git a/core/m_config.c b/core/m_config.c
index b6c15d3d9a..65d60bdab9 100644
--- a/core/m_config.c
+++ b/core/m_config.c
@@ -258,6 +258,22 @@ void m_config_leave_file_local(struct m_config *config)
}
}
+void m_config_mark_file_local(struct m_config *config, const char *opt)
+{
+ struct m_config_option *co = m_config_get_co(config, bstr0(opt));
+ if (co) {
+ ensure_backup(config, co);
+ } else {
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "Option %s not found.\n", opt);
+ }
+}
+
+void m_config_mark_all_file_local(struct m_config *config)
+{
+ for (struct m_config_option *co = config->opts; co; co = co->next)
+ ensure_backup(config, co);
+}
+
// Given an option --opt, add --no-opt (if applicable).
static void add_negation_option(struct m_config *config,
struct m_config_option *parent,
diff --git a/core/m_config.h b/core/m_config.h
index 345141a72a..98b21c9bf9 100644
--- a/core/m_config.h
+++ b/core/m_config.h
@@ -97,6 +97,8 @@ void m_config_free(struct m_config *config);
void m_config_enter_file_local(struct m_config *config);
void m_config_leave_file_local(struct m_config *config);
+void m_config_mark_file_local(struct m_config *config, const char *opt);
+void m_config_mark_all_file_local(struct m_config *config);
/* Register some options to be used.
* \param config The config object.
diff --git a/core/mplayer.c b/core/mplayer.c
index 0a108cb514..7dbd4f59bb 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -3877,6 +3877,17 @@ static void play_current_file(struct MPContext *mpctx)
load_per_file_options(mpctx->mconfig, mpctx->playlist->current->params,
mpctx->playlist->current->num_params);
+ if (opts->reset_options) {
+ for (int n = 0; opts->reset_options[n]; n++) {
+ const char *opt = opts->reset_options[n];
+ if (strcmp(opt, "all") == 0) {
+ m_config_mark_all_file_local(mpctx->mconfig);
+ } else {
+ m_config_mark_file_local(mpctx->mconfig, opt);
+ }
+ }
+ }
+
// We must enable getch2 here to be able to interrupt network connection
// or cache filling
if (opts->consolecontrols && !opts->slave_mode) {
diff --git a/core/options.h b/core/options.h
index 080ca021d7..0f57381f30 100644
--- a/core/options.h
+++ b/core/options.h
@@ -43,6 +43,8 @@ typedef struct mp_vo_opts {
} mp_vo_opts;
typedef struct MPOpts {
+ char **reset_options;
+
char **audio_driver_list;
int fixed_vo;
char *mixer_device;