summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfg-mplayer.h3
-rw-r--r--m_config.c4
-rw-r--r--m_option.h11
3 files changed, 12 insertions, 6 deletions
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 304c60f194..ed3fef7304 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -338,7 +338,8 @@ const m_option_t common_opts[] = {
// ------------------------- stream options --------------------
#ifdef CONFIG_STREAM_CACHE
- OPT_INTRANGE("cache", stream_cache_size, 0, 32, 0x7fffffff, OPTDEF_INT(-1)),
+ OPT_INTRANGE("cache", stream_cache_size, M_OPT_LOCAL, 32, 0x7fffffff,
+ OPTDEF_INT(-1)),
OPT_FLAG_CONSTANTS("no-cache", stream_cache_size, 0, -1, 0),
OPT_FLOATRANGE("cache-min", stream_cache_min_percent, 0, 0, 99),
diff --git a/m_config.c b/m_config.c
index 56886e08eb..ae7f528060 100644
--- a/m_config.c
+++ b/m_config.c
@@ -237,6 +237,10 @@ void m_config_enter_file_local(struct m_config *config)
{
assert(!config->file_local_mode);
config->file_local_mode = true;
+ for (struct m_config_option *co = config->opts; co; co = co->next) {
+ if (co->opt->flags & M_OPT_LOCAL)
+ ensure_backup(config, co);
+ }
}
void m_config_leave_file_local(struct m_config *config)
diff --git a/m_option.h b/m_option.h
index 57fdc33610..bb5f7da304 100644
--- a/m_option.h
+++ b/m_option.h
@@ -282,13 +282,14 @@ struct m_option {
// The option is forbidden on the command line.
#define M_OPT_NOCMD (1 << 3)
-// The option is global in the \ref Config.
-/** It won't be saved on push and the command line parser will set it when
- * it's parsed (i.e. it won't be set later)
- * e.g options : -v, -quiet
- */
+// This option can't be set per-file when used with struct m_config.
#define M_OPT_GLOBAL (1 << 4)
+// This option is always considered per-file when used with struct m_config.
+// When playback of a file ends, the option value will be restored to the value
+// from before playback begin.
+#define M_OPT_LOCAL (1 << 5)
+
// The option should be set during command line pre-parsing
#define M_OPT_PRE_PARSE (1 << 6)