summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-24 21:18:53 +0100
committerwm4 <wm4@nowhere>2014-02-24 22:50:24 +0100
commit4d1575173b64b7a95f7cf9626956aebafdbc103f (patch)
tree9e8260eae1b5796c92392eb1d4a0b52f4417130b /options/m_config.c
parent38a36fd7ea4a4d9bd4f8ea659f846b7d8784e27b (diff)
downloadmpv-4d1575173b64b7a95f7cf9626956aebafdbc103f.tar.bz2
mpv-4d1575173b64b7a95f7cf9626956aebafdbc103f.tar.xz
command: make options property return the list of all options
Diffstat (limited to 'options/m_config.c')
-rw-r--r--options/m_config.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/options/m_config.c b/options/m_config.c
index d2b75389fe..f2cb8ce98f 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -708,6 +708,26 @@ void m_config_print_option_list(const struct m_config *config)
MP_INFO(config, "\nTotal: %d options\n", count);
}
+char **m_config_list_options(void *ta_parent, const struct m_config *config)
+{
+ char **list = talloc_new(ta_parent);
+ int count = 0;
+ for (int i = 0; i < config->num_opts; i++) {
+ struct m_config_option *co = &config->opts[i];
+ const struct m_option *opt = co->opt;
+ if (opt->type->flags & M_OPT_TYPE_HAS_CHILD)
+ continue;
+ if (co->is_generated)
+ continue;
+ // For use with CONF_TYPE_STRING_LIST, it's important not to set list
+ // as allocation parent.
+ char *s = talloc_strdup(ta_parent, co->name);
+ MP_TARRAY_APPEND(ta_parent, list, count, s);
+ }
+ MP_TARRAY_APPEND(ta_parent, list, count, NULL);
+ return list;
+}
+
struct m_profile *m_config_get_profile(const struct m_config *config, bstr name)
{
for (struct m_profile *p = config->profiles; p; p = p->next) {