1
mirror of https://github.com/mpv-player/mpv synced 2024-11-07 01:47:00 +01:00

player: use config parser for setting up pseudo-gui profile

This commit is contained in:
wm4 2015-04-10 20:40:50 +02:00
parent 1e692cb043
commit cf55fa6471
3 changed files with 12 additions and 11 deletions

View File

@ -42,8 +42,8 @@ static bool skip_ws(bstr *s)
return s->len;
}
static int m_config_parse(m_config_t *config, const char *location, bstr data,
char *initial_section, int flags)
int m_config_parse(m_config_t *config, const char *location, bstr data,
char *initial_section, int flags)
{
m_profile_t *profile = m_config_add_profile(config, initial_section);
void *tmp = talloc_new(NULL);

View File

@ -24,4 +24,7 @@
int m_config_parse_config_file(m_config_t* config, const char *conffile,
char *initial_section, int flags);
int m_config_parse(m_config_t *config, const char *location, bstr data,
char *initial_section, int flags);
#endif /* MPLAYER_PARSER_CFG_H */

View File

@ -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;