summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/m_config.c12
-rw-r--r--options/m_config.h5
-rw-r--r--options/m_option.h3
-rw-r--r--options/m_property.c4
-rw-r--r--options/m_property.h3
-rw-r--r--options/options.c27
-rw-r--r--options/options.h1
7 files changed, 39 insertions, 16 deletions
diff --git a/options/m_config.c b/options/m_config.c
index 352965ea47..d4c19808b0 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -447,6 +447,16 @@ struct m_config_option *m_config_get_co(const struct m_config *config,
return NULL;
}
+int m_config_get_co_count(struct m_config *config)
+{
+ return config->num_opts;
+}
+
+struct m_config_option *m_config_get_co_index(struct m_config *config, int index)
+{
+ return &config->opts[index];
+}
+
const char *m_config_get_positional_option(const struct m_config *config, int p)
{
int pos = 0;
@@ -509,7 +519,7 @@ static void handle_on_set(struct m_config *config, struct m_config_option *co,
mp_msg_update_msglevels(config->global);
}
-// The type data points to is as in: m_config_get_co(config, name)->opt
+// The type data points to is as in: co->opt
int m_config_set_option_raw(struct m_config *config, struct m_config_option *co,
void *data, int flags)
{
diff --git a/options/m_config.h b/options/m_config.h
index e6d093582f..4ac673859f 100644
--- a/options/m_config.h
+++ b/options/m_config.h
@@ -136,7 +136,7 @@ enum {
};
// Flags for safe option setting during runtime.
-#define M_SETOPT_RUNTIME (M_SETOPT_NO_FIXED | M_SETOPT_NO_PRE_PARSE)
+#define M_SETOPT_RUNTIME M_SETOPT_NO_FIXED
// Set the named option to the given string.
// flags: combination of M_SETOPT_* flags (0 for normal operation)
@@ -176,6 +176,9 @@ int m_config_parse_suboptions(struct m_config *config, char *name,
struct m_config_option *m_config_get_co(const struct m_config *config,
struct bstr name);
+int m_config_get_co_count(struct m_config *config);
+struct m_config_option *m_config_get_co_index(struct m_config *config, int index);
+
// Return the n-th option by position. n==0 is the first option. If there are
// less than (n + 1) options, return NULL.
const char *m_config_get_positional_option(const struct m_config *config, int n);
diff --git a/options/m_option.h b/options/m_option.h
index 2901cb6288..548db319a1 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -371,6 +371,9 @@ struct m_option {
// 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)
+
// These are kept for compatibility with older code.
#define CONF_MIN M_OPT_MIN
#define CONF_MAX M_OPT_MAX
diff --git a/options/m_property.c b/options/m_property.c
index 4ed4f5f586..13d3844671 100644
--- a/options/m_property.c
+++ b/options/m_property.c
@@ -36,8 +36,8 @@
#include "common/msg.h"
#include "common/common.h"
-static struct m_property *m_property_list_find(const struct m_property *list,
- const char *name)
+struct m_property *m_property_list_find(const struct m_property *list,
+ const char *name)
{
for (int n = 0; list && list[n].name; n++) {
if (strcmp(list[n].name, name) == 0)
diff --git a/options/m_property.h b/options/m_property.h
index 42fe1c7ecf..0f8230608b 100644
--- a/options/m_property.h
+++ b/options/m_property.h
@@ -128,6 +128,9 @@ struct m_property {
void *priv;
};
+struct m_property *m_property_list_find(const struct m_property *list,
+ const char *name);
+
// Access a property.
// action: one of m_property_action
// ctx: opaque value passed through to property implementation
diff --git a/options/options.c b/options/options.c
index 7b0f3c43e1..2aff813a25 100644
--- a/options/options.c
+++ b/options/options.c
@@ -187,22 +187,25 @@ const m_option_t mp_opts[] = {
{ "profile", CONF_TYPE_STRING_LIST, M_OPT_FIXED, .offset = -1},
{ "show-profile", CONF_TYPE_STRING, CONF_NOCFG | M_OPT_FIXED, .offset = -1},
{ "list-options", CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED, .offset = -1},
+ OPT_FLAG("list-properties", property_print_help,
+ CONF_NOCFG | M_OPT_FIXED | M_OPT_NOPROP),
OPT_FLAG("shuffle", shuffle, 0),
// ------------------------- common options --------------------
- OPT_FLAG("quiet", quiet, CONF_GLOBAL),
- OPT_FLAG_STORE("really-quiet", verbose, CONF_GLOBAL | CONF_PRE_PARSE, -10),
+ OPT_FLAG("quiet", quiet, CONF_GLOBAL | M_OPT_NOPROP),
+ OPT_FLAG_STORE("really-quiet", verbose,
+ CONF_GLOBAL | CONF_PRE_PARSE | M_OPT_NOPROP, -10),
OPT_FLAG("terminal", use_terminal, CONF_GLOBAL | CONF_PRE_PARSE | M_OPT_TERM),
- OPT_GENERAL(char**, "msg-level", msg_levels, CONF_GLOBAL|CONF_PRE_PARSE |
- M_OPT_TERM, .type = &m_option_type_msglevels),
+ OPT_GENERAL(char**, "msg-level", msg_levels, CONF_PRE_PARSE | M_OPT_TERM,
+ .type = &m_option_type_msglevels),
OPT_STRING("dump-stats", dump_stats, CONF_GLOBAL | CONF_PRE_PARSE),
- OPT_FLAG("msg-color", msg_color, CONF_GLOBAL | CONF_PRE_PARSE | M_OPT_TERM),
- OPT_STRING("log-file", log_file, CONF_GLOBAL | CONF_PRE_PARSE | M_OPT_FILE),
- OPT_FLAG("msg-module", msg_module, CONF_GLOBAL | M_OPT_TERM),
- OPT_FLAG("msg-time", msg_time, CONF_GLOBAL | M_OPT_TERM),
+ OPT_FLAG("msg-color", msg_color, CONF_PRE_PARSE | M_OPT_TERM),
+ OPT_STRING("log-file", log_file, CONF_PRE_PARSE | M_OPT_FILE),
+ OPT_FLAG("msg-module", msg_module, M_OPT_TERM),
+ OPT_FLAG("msg-time", msg_time, M_OPT_TERM),
#ifdef _WIN32
- OPT_CHOICE("priority", w32_priority, 0,
+ OPT_CHOICE("priority", w32_priority, CONF_GLOBAL,
({"no", 0},
{"realtime", REALTIME_PRIORITY_CLASS},
{"high", HIGH_PRIORITY_CLASS},
@@ -479,7 +482,8 @@ const m_option_t mp_opts[] = {
OPT_CHOICE("softvol", softvol, 0,
({"no", SOFTVOL_NO},
{"yes", SOFTVOL_YES},
- {"auto", SOFTVOL_AUTO})),
+ {"auto", SOFTVOL_AUTO}),
+ .deprecation_message = "no replacement"),
OPT_FLOATRANGE("volume-max", softvol_max, 0, 100, 1000),
// values <0 for volume and mute are legacy and ignored
OPT_FLOATRANGE("volume", softvol_volume, 0, -1, 1000),
@@ -621,7 +625,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("input-terminal", consolecontrols, CONF_GLOBAL),
OPT_STRING("input-file", input_file, M_OPT_FILE | M_OPT_GLOBAL),
- OPT_STRING("input-ipc-server", ipc_path, M_OPT_FILE),
+ OPT_STRING("input-ipc-server", ipc_path, M_OPT_FILE | M_OPT_FIXED),
OPT_SUBSTRUCT("screenshot", screenshot_image_opts, image_writer_conf, 0),
OPT_STRING("screenshot-template", screenshot_template, 0),
@@ -629,7 +633,6 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("input", input_opts, input_config, 0),
- OPT_PRINT("list-properties", property_print_help),
OPT_PRINT("list-protocols", stream_print_proto_list),
OPT_PRINT("help", print_help),
OPT_PRINT("h", print_help),
diff --git a/options/options.h b/options/options.h
index 130ab4c1cf..1a2bfa68c8 100644
--- a/options/options.h
+++ b/options/options.h
@@ -64,6 +64,7 @@ struct mp_cache_opts {
};
typedef struct MPOpts {
+ int property_print_help;
int use_terminal;
char *dump_stats;
int verbose;