Ejemplo n.º 1
0
static bool reparse_cmdline(struct gl_priv *p, char *args)
{
    struct m_config *cfg = NULL;
    struct gl_video_opts opts;
    int r = 0;

    if (strcmp(args, "-") == 0) {
        opts = *p->renderer_opts;
    } else {
        memcpy(&opts, gl_video_conf.defaults, sizeof(opts));
        cfg = m_config_simple(&opts);
        m_config_register_options(cfg, gl_video_conf.opts);
        const char *init = p->vo->driver->init_option_string;
        if (init)
            m_config_parse_suboptions(cfg, "opengl", (char *)init);
        r = m_config_parse_suboptions(cfg, "opengl", args);
    }

    if (r >= 0) {
        mpgl_lock(p->glctx);
        gl_video_set_options(p->renderer, &opts);
        resize(p);
        mpgl_unlock(p->glctx);
    }

    talloc_free(cfg);
    return r >= 0;
}
Ejemplo n.º 2
0
m_config_t*
m_config_new(void) {
  m_config_t* config;
  static int initialized = 0;
  static m_option_type_t profile_opt_type;
  static m_option_t ref_opts[] = {
    { "profile", NULL, &profile_opt_type, CONF_NOSAVE, 0, 0, NULL },
    { "show-profile", show_profile, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL },
    { "list-options", list_options, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL },
    { NULL, NULL, NULL, 0, 0, 0, NULL }
  };
  int i;

  config = calloc(1,sizeof(m_config_t));
  if (!config) return NULL;
  config->lvl = 1; // 0 Is the defaults
  if(!initialized) {
    initialized = 1;
    profile_opt_type = m_option_type_string_list;
    profile_opt_type.parse = parse_profile;
    profile_opt_type.set = set_profile;
  }
  config->self_opts = malloc(sizeof(ref_opts));
  if (!config->self_opts) {
    free(config);
    return NULL;
  }
  memcpy(config->self_opts,ref_opts,sizeof(ref_opts));
  for(i = 0 ; config->self_opts[i].name ; i++)
    config->self_opts[i].priv = config;
  m_config_register_options(config,config->self_opts);

  return config;
}
Ejemplo n.º 3
0
int cfg_read(void)
{
    char *cfg = get_path("gui.conf");

    /* read configuration */
    mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] [cfg] reading config file: %s\n", cfg);
    gui_conf = m_config_new();
    m_config_register_options(gui_conf, gui_opts);
    if (m_config_parse_config_file(gui_conf, cfg) < 0)
        mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_ConfigFileError);
    free(cfg);
    return 0;
}
Ejemplo n.º 4
0
static int vo_preinit(struct vo *vo, char *arg)
{
    if (vo->driver->priv_size) {
        vo->priv = talloc_zero_size(vo, vo->driver->priv_size);
        if (vo->driver->priv_defaults)
            memcpy(vo->priv, vo->driver->priv_defaults, vo->driver->priv_size);
    }
    if (vo->driver->options) {
        struct m_config *cfg = m_config_simple(vo->priv);
        talloc_steal(vo->priv, cfg);
        m_config_register_options(cfg, vo->driver->options);
        char n[50];
        int l = snprintf(n, sizeof(n), "vo/%s", vo->driver->info->short_name);
        assert(l < sizeof(n));
        int r = m_config_parse_suboptions(cfg, n, arg);
        if (r < 0)
            return r;
    }
    return vo->driver->preinit(vo, arg);
}