summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-21 16:19:56 +0200
committerwm4 <wm4@nowhere>2016-09-21 17:35:00 +0200
commit7783f0b7d7037e2420deece510b8315cfe3b8e91 (patch)
tree5d6aab943915187e36a6fb8488b4798feb9ace3c /options
parent75d12c174f0b5bb03c71872241f965ac674221d7 (diff)
downloadmpv-7783f0b7d7037e2420deece510b8315cfe3b8e91.tar.bz2
mpv-7783f0b7d7037e2420deece510b8315cfe3b8e91.tar.xz
client API: more or less deprecate mpv_set_option()
With the merging of options and properties, the mpv_set_option() function is close to being useless, and mpv_set_property() can be used for everything instead. There are certain conflicts remaining, which are explained in depth in the docs. For now, none of this should affect existing code using the client API. Make mpv_set_property() redirect to mpv_set_option() before initialization. Remove some options marked as M_OPT_FIXED. The "pause" and "speed" options cannot be written anymore without the playloop being notified by it, so the M_OPT_FIXED does nothing. For "vo-mmcss-profile", the problem was lack of synchronization, which has been added. I'm not sure what the problem was with "frames" - I think it was only marked as M_OPT_FIXED because changing it during playback will have no effect. Except for pause/speed, these changes are needed to make them writable as properties after mpv_initialize(). Also replace all remaining uses of CONF_GLOBAL with M_OPT_FIXED.
Diffstat (limited to 'options')
-rw-r--r--options/m_config.c4
-rw-r--r--options/m_option.h1
-rw-r--r--options/options.c24
3 files changed, 14 insertions, 15 deletions
diff --git a/options/m_config.c b/options/m_config.c
index 4659c9aa21..08465df97f 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -997,9 +997,11 @@ void m_config_print_option_list(const struct m_config *config, const char *name)
talloc_free(def);
}
if (opt->flags & M_OPT_NOCFG)
- MP_INFO(config, " [nocfg]");
+ MP_INFO(config, " [not in config files]");
if (opt->flags & M_OPT_FILE)
MP_INFO(config, " [file]");
+ if (opt->flags & M_OPT_FIXED)
+ MP_INFO(config, " [no runtime changes]");
MP_INFO(config, "\n");
count++;
}
diff --git a/options/m_option.h b/options/m_option.h
index 1744023663..92d0575db8 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -399,7 +399,6 @@ struct m_option {
#define CONF_MAX M_OPT_MAX
#define CONF_RANGE M_OPT_RANGE
#define CONF_NOCFG M_OPT_NOCFG
-#define CONF_GLOBAL M_OPT_FIXED
#define CONF_PRE_PARSE M_OPT_PRE_PARSE
// These flags are used to describe special parser capabilities or behavior.
diff --git a/options/options.c b/options/options.c
index 3512ee15e8..8d45c21b8d 100644
--- a/options/options.c
+++ b/options/options.c
@@ -187,7 +187,7 @@ static const m_option_t mp_vo_opt_list[] = {
({"no", 0}, {"yes", 1}, {"fs-only", 2}, {"never", 3})),
#endif
#if HAVE_WIN32
- OPT_STRING("vo-mmcss-profile", mmcss_profile, M_OPT_FIXED),
+ OPT_STRING("vo-mmcss-profile", mmcss_profile, 0),
#endif
{0}
@@ -236,7 +236,7 @@ const struct m_sub_options dvd_conf = {
const m_option_t mp_opts[] = {
// handled in command line pre-parser (parse_commandline.c)
- {"v", CONF_TYPE_STORE, CONF_GLOBAL | CONF_NOCFG, .offset = -1},
+ {"v", CONF_TYPE_STORE, M_OPT_FIXED | CONF_NOCFG, .offset = -1},
{"playlist", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_MIN | M_OPT_FIXED | M_OPT_FILE,
.min = 1, .offset = -1},
{"{", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED, .offset = -1},
@@ -255,7 +255,7 @@ const m_option_t mp_opts[] = {
// ------------------------- common options --------------------
OPT_FLAG("quiet", quiet, 0),
OPT_FLAG_STORE("really-quiet", verbose,
- CONF_GLOBAL | CONF_PRE_PARSE | M_OPT_NOPROP, -10),
+ M_OPT_FIXED | CONF_PRE_PARSE | M_OPT_NOPROP, -10),
OPT_FLAG("terminal", use_terminal, CONF_PRE_PARSE | UPDATE_TERM),
OPT_GENERAL(char**, "msg-level", msg_levels, CONF_PRE_PARSE | UPDATE_TERM,
.type = &m_option_type_msglevels),
@@ -265,7 +265,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("msg-module", msg_module, UPDATE_TERM),
OPT_FLAG("msg-time", msg_time, UPDATE_TERM),
#ifdef _WIN32
- OPT_CHOICE("priority", w32_priority, CONF_GLOBAL,
+ OPT_CHOICE("priority", w32_priority, M_OPT_FIXED,
({"no", 0},
{"realtime", REALTIME_PRIORITY_CLASS},
{"high", HIGH_PRIORITY_CLASS},
@@ -274,19 +274,19 @@ const m_option_t mp_opts[] = {
{"belownormal", BELOW_NORMAL_PRIORITY_CLASS},
{"idle", IDLE_PRIORITY_CLASS})),
#endif
- OPT_FLAG("config", load_config, CONF_GLOBAL | CONF_PRE_PARSE),
+ OPT_FLAG("config", load_config, M_OPT_FIXED | CONF_PRE_PARSE),
OPT_STRING("config-dir", force_configdir,
- CONF_GLOBAL | CONF_NOCFG | CONF_PRE_PARSE),
+ M_OPT_FIXED | CONF_NOCFG | CONF_PRE_PARSE),
OPT_STRINGLIST("reset-on-next-file", reset_options, 0),
#if HAVE_LUA
- OPT_STRINGLIST("script", script_files, CONF_GLOBAL | M_OPT_FILE),
+ OPT_STRINGLIST("script", script_files, M_OPT_FIXED | M_OPT_FILE),
OPT_KEYVALUELIST("script-opts", script_opts, 0),
OPT_FLAG("osc", lua_load_osc, UPDATE_BUILTIN_SCRIPTS),
OPT_FLAG("ytdl", lua_load_ytdl, UPDATE_BUILTIN_SCRIPTS),
OPT_STRING("ytdl-format", lua_ytdl_format, 0),
OPT_KEYVALUELIST("ytdl-raw-options", lua_ytdl_raw_options, 0),
- OPT_FLAG("load-scripts", auto_load_scripts, CONF_GLOBAL),
+ OPT_FLAG("load-scripts", auto_load_scripts, M_OPT_FIXED),
#endif
// ------------------------- stream options --------------------
@@ -306,8 +306,7 @@ const m_option_t mp_opts[] = {
// ------------------------- demuxer options --------------------
- OPT_CHOICE_OR_INT("frames", play_frames, M_OPT_FIXED, 0, INT_MAX,
- ({"all", -1})),
+ OPT_CHOICE_OR_INT("frames", play_frames, 0, 0, INT_MAX, ({"all", -1})),
OPT_REL_TIME("start", play_start, 0),
OPT_REL_TIME("end", play_end, 0),
@@ -321,7 +320,7 @@ const m_option_t mp_opts[] = {
OPT_CHOICE_OR_INT("playlist-start", playlist_pos, 0, 0, INT_MAX,
({"auto", -1}, {"no", -1})),
- OPT_FLAG("pause", pause, M_OPT_FIXED),
+ OPT_FLAG("pause", pause, 0),
OPT_CHOICE("keep-open", keep_open, 0,
({"no", 0},
{"yes", 1},
@@ -389,8 +388,7 @@ const m_option_t mp_opts[] = {
OPT_CHANNELS("audio-channels", audio_output_channels, 0),
OPT_AUDIOFORMAT("audio-format", audio_output_format, 0),
OPT_FLAG("audio-normalize-downmix", audio_normalize, 0),
- OPT_DOUBLE("speed", playback_speed, M_OPT_RANGE | M_OPT_FIXED,
- .min = 0.01, .max = 100.0),
+ OPT_DOUBLE("speed", playback_speed, M_OPT_RANGE, .min = 0.01, .max = 100.0),
OPT_FLAG("audio-pitch-correction", pitch_correction, 0),