Beispiel #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;
}
Beispiel #2
0
static bool reparse_cmdline(struct vo_priv *p, char *args)
{
    struct m_config *cfg = NULL;
    struct vo_priv *opts = NULL;
    int r = 0;

    pthread_mutex_lock(&p->ctx->lock);

    // list of options which can be changed at runtime
#define OPT_BASE_STRUCT struct vo_priv
    static const struct m_option change_otps[] = {
        OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0),
        {0}
    };
#undef OPT_BASE_STRUCT

    const struct vo_priv *vodef = p->vo->driver->priv_defaults;
    cfg = m_config_new(NULL, p->vo->log, sizeof(*opts), vodef, change_otps);
    opts = cfg->optstruct;
    r = m_config_parse_suboptions(cfg, "opengl-cb", args);

    if (r >= 0) {
        talloc_free(p->ctx->new_opts_cfg);
        p->ctx->new_opts = opts;
        p->ctx->new_opts_cfg = cfg;
        p->ctx->update_new_opts = true;
        cfg = NULL;
        update(p);
    }

    talloc_free(cfg);
    pthread_mutex_unlock(&p->ctx->lock);
    return r >= 0;
}
Beispiel #3
0
static bool reparse_cmdline(struct vo_priv *p, char *args)
{
    struct m_config *cfg = NULL;
    struct vo_priv *opts = NULL;
    int r = 0;

    pthread_mutex_lock(&p->ctx->lock);
    const struct vo_priv *vodef = p->vo->driver->priv_defaults;
    cfg = m_config_new(NULL, p->vo->log, sizeof(*opts), vodef, change_opts);
    opts = cfg->optstruct;
    r = m_config_parse_suboptions(cfg, "opengl-cb", args);

    if (r >= 0) {
        talloc_free(p->ctx->new_opts_cfg);
        p->ctx->new_opts = opts;
        p->ctx->new_opts_cfg = cfg;
        p->ctx->update_new_opts = true;
        cfg = NULL;
        update(p);
    }

    talloc_free(cfg);
    pthread_mutex_unlock(&p->ctx->lock);
    return r >= 0;
}
Beispiel #4
0
static bool reparse_cmdline(struct gl_priv *p, char *args)
{
    struct m_config *cfg = NULL;
    struct gl_priv *opts = NULL;
    int r = 0;

    // list of options which can be changed at runtime
#define OPT_BASE_STRUCT struct gl_priv
    static const struct m_option change_otps[] = {
        OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0),
        {0}
    };
#undef OPT_BASE_STRUCT

    if (strcmp(args, "-") == 0) {
        opts = p;
    } else {
        const struct gl_priv *vodef = p->vo->driver->priv_defaults;
        cfg = m_config_new(NULL, p->vo->log, sizeof(*opts), vodef, change_otps);
        opts = cfg->optstruct;
        r = m_config_parse_suboptions(cfg, "opengl", args);
    }

    if (r >= 0) {
        gl_video_set_options(p->renderer, opts->renderer_opts);
        gl_video_configure_queue(p->renderer, p->vo);
        p->vo->want_redraw = true;
    }

    talloc_free(cfg);
    return r >= 0;
}
Beispiel #5
0
static int vo_preinit(struct vo *vo, char *arg)
{
    if (vo->driver->privsize)
        vo->priv = talloc_zero_size(vo, vo->driver->privsize);
    if (vo->driver->options) {
        struct m_config *cfg = m_config_simple(vo->driver->options);
        m_config_initialize(cfg, vo->priv);
        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, vo->priv, n, arg);
        talloc_free(cfg);
        if (r < 0)
            return r;
    }
    return vo->driver->preinit(vo, arg);
}
Beispiel #6
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);
}
Beispiel #7
0
static bool reparse_cmdline(struct vo *vo, char *args)
{
    struct gl_priv *p = vo->priv;
    int r = 0;

    struct gl_priv *opts = p;

    if (strcmp(args, "-") == 0) {
        opts = p->original_opts;
    } else {
        r = m_config_parse_suboptions(vo->config, "opengl", args);
    }

    gl_video_set_options(p->renderer, opts->renderer_opts);
    get_and_update_icc_profile(p);
    gl_video_configure_queue(p->renderer, p->vo);
    p->vo->want_redraw = true;

    return r >= 0;
}