summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-02 19:24:12 +0200
committerwm4 <wm4@nowhere>2016-09-02 21:21:47 +0200
commiteb14b18a33973021c30124775513795b689cec27 (patch)
treef4f5bb3c63c962ec0ea6f9c398a97f951b8d4446 /options/m_config.c
parent9770ce6c44cd26e7b9e5b525c3222281d32dcb6f (diff)
downloadmpv-eb14b18a33973021c30124775513795b689cec27.tar.bz2
mpv-eb14b18a33973021c30124775513795b689cec27.tar.xz
config: allow profile forward-references in default profile
This works by first parsing a config file into the default profile, and applying it once parsing the whole file is finished. This won't work across config files (not even if you include other config files via "include=file.conf").
Diffstat (limited to 'options/m_config.c')
-rw-r--r--options/m_config.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/options/m_config.c b/options/m_config.c
index f3bbe7d8c9..a456430ceb 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -928,8 +928,8 @@ struct m_profile *m_config_get_profile0(const struct m_config *config,
struct m_profile *m_config_add_profile(struct m_config *config, char *name)
{
- if (!name || !name[0] || strcmp(name, "default") == 0)
- return NULL; // never a real profile
+ if (!name || !name[0])
+ name = "default";
struct m_profile *p = m_config_get_profile0(config, name);
if (p)
return p;
@@ -986,6 +986,13 @@ int m_config_set_profile(struct m_config *config, char *name, int flags)
return 0;
}
+void m_config_finish_default_profile(struct m_config *config, int flags)
+{
+ struct m_profile *p = m_config_add_profile(config, NULL);
+ m_config_set_profile(config, p->name, flags);
+ p->num_opts = 0;
+}
+
struct mpv_node m_config_get_profiles(struct m_config *config)
{
struct mpv_node root;