summaryrefslogtreecommitdiffstats
path: root/options/m_option.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-19 19:51:26 +0200
committerwm4 <wm4@nowhere>2016-09-19 19:51:26 +0200
commitfe7db610355b623305d08135869b3f4ff4487b6d (patch)
tree563523768617c50b6f41639b0fdc8550871da5c0 /options/m_option.h
parent32f235bcef49b268126262f45637b6818767f065 (diff)
downloadmpv-fe7db610355b623305d08135869b3f4ff4487b6d.tar.bz2
mpv-fe7db610355b623305d08135869b3f4ff4487b6d.tar.xz
options: slightly better option update mechanism
Extend the flag-based notification mechanism that was used via M_OPT_TERM. Make the vo_opengl update mechanism use this (which, btw., also fixes compilation with OpenGL renderers forcibly disabled). While this adds a 3rd mechanism and just seems to further the chaos, I'd rather have a very simple mechanism now, than actually furthering the mess by mixing old and new update mechanisms. In particular, we'll be able to remove quite some property implementations, and replace them with much simpler update handling. The new update mechanism can also more easily refactored once we have a final mechanism that handles everything in an uniform way.
Diffstat (limited to 'options/m_option.h')
-rw-r--r--options/m_option.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/options/m_option.h b/options/m_option.h
index 6435584716..a47bbaa7d7 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -191,6 +191,9 @@ struct m_sub_options {
const struct m_option *opts;
size_t size;
const void *defaults;
+ // Change flags passed to mp_option_change_callback() if any option that is
+ // directly or indirectly part of this group is changed.
+ int change_flags;
};
#define CONF_TYPE_FLAG (&m_option_type_flag)
@@ -372,12 +375,20 @@ struct m_option {
// The option expects a file name (or a list of file names)
#define M_OPT_FILE (1 << 11)
-// Logging-related option - used to update log/terminal settings eagerly
-#define M_OPT_TERM (1 << 12)
-
// Do not add as property.
#define M_OPT_NOPROP (1 << 13)
+// The following are also part of the M_OPT_* flags, and are used to update
+// certain groups of options.
+#define UPDATE_OPT_FIRST (1 << 14)
+#define UPDATE_TERM (1 << 14) // terminal options
+#define UPDATE_RENDERER (1 << 15) // mainly vo_opengl options
+#define UPDATE_OPT_LAST (1 << 15)
+
+// All bits between _FIRST and _LAST (inclusive)
+#define UPDATE_OPTS_MASK \
+ (((UPDATE_OPT_LAST << 1) - 1) & ~(unsigned)(UPDATE_OPT_FIRST - 1))
+
// These are kept for compatibility with older code.
#define CONF_MIN M_OPT_MIN
#define CONF_MAX M_OPT_MAX