summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
diff options
context:
space:
mode:
Diffstat (limited to 'options/m_option.c')
-rw-r--r--options/m_option.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/options/m_option.c b/options/m_option.c
index f52a81a0b9..77e610f08c 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -1344,6 +1344,42 @@ const m_option_type_t m_option_type_string_list = {
.set = str_list_set,
};
+static void str_list_append(void *dst, bstr s)
+{
+ if (!dst)
+ return;
+ char **list= VAL(dst);
+ int len = 0;
+ while (list && list[len])
+ len++;
+ MP_TARRAY_APPEND(NULL, list, len, bstrto0(NULL, s));
+ MP_TARRAY_APPEND(NULL, list, len, NULL);
+ VAL(dst) = list;
+}
+
+static int parse_str_append_list(struct mp_log *log, const m_option_t *opt,
+ struct bstr name, struct bstr param, void *dst)
+{
+ if (param.len == 0)
+ return M_OPT_MISSING_PARAM;
+
+ str_list_append(dst, param);
+
+ return 1;
+}
+
+const m_option_type_t m_option_type_string_append_list = {
+ .name = "String list",
+ .size = sizeof(char **),
+ .flags = M_OPT_TYPE_DYNAMIC,
+ .parse = parse_str_append_list,
+ .print = print_str_list,
+ .copy = copy_str_list,
+ .free = free_str_list,
+ .get = str_list_get,
+ .set = str_list_set,
+};
+
static int read_subparam(struct mp_log *log, bstr optname,
bstr *str, bstr *out_subparam);