summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-01-04 19:45:50 +0100
committerwm4 <wm4@nowhere>2020-01-04 19:45:50 +0100
commit8150b8552b4ed1b4c33089bdb1f9159b181660ab (patch)
tree5c0cd949d2e915172e6bcad525b923e0f9301e7d /options/m_config.c
parent4419d29bb07ada6b8c7c6a0b281feca7e06aff09 (diff)
downloadmpv-8150b8552b4ed1b4c33089bdb1f9159b181660ab.tar.bz2
mpv-8150b8552b4ed1b4c33089bdb1f9159b181660ab.tar.xz
options: add mechanism to add sub-options from component lists
There are a lot of ad-hoc component lists in mpv: for example the stream and demuxer lists. It doesn't seem to make sense to add any abstractions around it since they are completely trivial and have very specific probing mechanisms and so on, so they will remain ad-hoc. This commits add a way to let these add arbitrary per-component options, without giving up the ad-hoc way, and without having to dump them into options.c with lots of ifdeffery (like it was done until now). Also see next commit.
Diffstat (limited to 'options/m_config.c')
-rw-r--r--options/m_config.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/options/m_config.c b/options/m_config.c
index 68250c7e66..968999cb71 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -708,6 +708,16 @@ static void add_sub_group(struct m_config_shadow *shadow, const char *name_prefi
}
}
+ if (subopts->get_sub_options) {
+ for (int i = 0; ; i++) {
+ const struct m_sub_options *sub = NULL;
+ if (!subopts->get_sub_options(i, &sub))
+ break;
+ if (sub)
+ add_sub_group(shadow, NULL, group_index, -1, sub);
+ }
+ }
+
shadow->groups[group_index].group_count = shadow->num_groups - group_index;
}