From cf55fa64710bdd5999b437f0cccdb036324ae11e Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 10 Apr 2015 20:40:50 +0200 Subject: player: use config parser for setting up pseudo-gui profile --- player/main.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'player/main.c') diff --git a/player/main.c b/player/main.c index 2f64c3b67e..c517e871f6 100644 --- a/player/main.c +++ b/player/main.c @@ -99,6 +99,12 @@ const char mp_help_text[] = " --list-options list all mpv options\n" "\n"; +static const char def_config[] = + "[pseudo-gui]\n" + "terminal=no\n" + "force-window=yes\n" + "idle=once\n"; + static pthread_mutex_t terminal_owner_lock = PTHREAD_MUTEX_INITIALIZER; static struct MPContext *terminal_owner; @@ -313,14 +319,6 @@ static int cfg_include(void *ctx, char *filename, int flags) return r; } -static void add_default_profiles(struct m_config *cfg) -{ - struct m_profile *ui = m_config_add_profile(cfg, "pseudo-gui"); - m_config_set_profile_option(cfg, ui, bstr0("terminal"), bstr0("no")); - m_config_set_profile_option(cfg, ui, bstr0("force-window"), bstr0("yes")); - m_config_set_profile_option(cfg, ui, bstr0("idle"), bstr0("once")); -} - struct MPContext *mp_create(void) { mp_time_init(); @@ -354,7 +352,7 @@ struct MPContext *mp_create(void) mpctx->mconfig->includefunc_ctx = mpctx; mpctx->mconfig->use_profiles = true; mpctx->mconfig->is_toplevel = true; - add_default_profiles(mpctx->mconfig); + m_config_parse(mpctx->mconfig, "", bstr0(def_config), NULL, 0); mpctx->global->opts = mpctx->opts; -- cgit v1.2.3