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; }
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; }
static void uninit(struct vo *vo) { struct vo_priv *p = vo->priv; pthread_mutex_lock(&p->ctx->lock); mp_image_unrefp(&p->ctx->next_frame); mp_image_unrefp(&p->ctx->waiting_frame); p->ctx->img_params = (struct mp_image_params){0}; p->ctx->reconfigured = true; p->ctx->active = NULL; pthread_mutex_unlock(&p->ctx->lock); } static int preinit(struct vo *vo) { struct vo_priv *p = vo->priv; p->vo = vo; p->ctx = vo->extra.opengl_cb_context; if (!p->ctx) { MP_FATAL(vo, "No context set.\n"); return -1; } pthread_mutex_lock(&p->ctx->lock); if (!p->ctx->initialized) { MP_FATAL(vo, "OpenGL context not initialized.\n"); pthread_mutex_unlock(&p->ctx->lock); return -1; } p->ctx->active = vo; p->ctx->reconfigured = true; assert(vo->osd == p->ctx->osd); copy_vo_opts(vo); pthread_mutex_unlock(&p->ctx->lock); return 0; } #define OPT_BASE_STRUCT struct vo_priv static const struct m_option options[] = { OPT_FLAG("debug", use_gl_debug, 0), OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0), {0}, }; const struct vo_driver video_out_opengl_cb = { .description = "OpenGL Callbacks for libmpv", .name = "opengl-cb", .caps = VO_CAP_ROTATE90, .preinit = preinit, .query_format = query_format, .reconfig = reconfig, .control = control, .draw_image = draw_image, .flip_page = flip_page, .uninit = uninit, .priv_size = sizeof(struct vo_priv), .options = options, };
#if HAVE_TV static const m_option_t tvscan_conf[]={ {"autostart", &stream_tv_defaults.scan, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"threshold", &stream_tv_defaults.scan_threshold, CONF_TYPE_INT, CONF_RANGE, 1, 100, NULL}, {"period", &stream_tv_defaults.scan_period, CONF_TYPE_FLOAT, CONF_RANGE, 0.1, 2.0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; #endif #define OPT_BASE_STRUCT struct MPOpts extern const struct m_sub_options image_writer_conf; static const m_option_t screenshot_conf[] = { OPT_SUBSTRUCT("", screenshot_image_opts, image_writer_conf, 0), OPT_STRING("template", screenshot_template, 0), {0}, }; extern const m_option_t lavc_decode_opts_conf[]; extern const m_option_t ad_lavc_decode_opts_conf[]; extern const m_option_t mp_input_opts[]; const m_option_t mp_opts[] = { // handled in command line pre-parser (parse_commandline.c) {"v", NULL, CONF_TYPE_STORE, CONF_GLOBAL | CONF_NOCFG, 0, 0, NULL}, {"playlist", NULL, CONF_TYPE_STRING, CONF_NOCFG | M_OPT_MIN | M_OPT_FIXED, 1, 0, NULL}, {"{", NULL, CONF_TYPE_STORE, CONF_NOCFG | M_OPT_FIXED, 0, 0, NULL},
struct bstr param) { char s[20]; snprintf(s, sizeof(s), "%.*s", BSTR_P(param)); return mpgl_find_backend(s) >= -1 ? 1 : M_OPT_INVALID; } #define OPT_BASE_STRUCT struct gl_priv const struct m_option options[] = { OPT_FLAG("glfinish", use_glFinish, 0), OPT_INT("swapinterval", swap_interval, 0, OPTDEF_INT(1)), OPT_FLAG("debug", use_gl_debug, 0), OPT_STRING_VALIDATE("backend", backend, 0, validate_backend_opt), OPT_FLAG("sw", allow_sw, 0), OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0), OPT_SUBSTRUCT("", icc_opts, mp_icc_conf, 0), {0}, }; static const char help_text[]; const struct vo_driver video_out_opengl = { .info = &(const vo_info_t) { "Extended OpenGL Renderer", "opengl", "Based on vo_gl.c by Reimar Doeffinger", "" }, .preinit = preinit, .query_format = query_format,
static int vf_open(vf_instance_t *vf) { if (vf->priv->out_fmt == STEREO_AUTO) { MP_FATAL(vf, "No autodetection for stereo output.\n"); return 0; } if (vf->priv->in_fmt == STEREO_AUTO) vf->priv->auto_in = 1; lavfi_init(vf); return 1; } #define OPT_BASE_STRUCT struct vf_priv_s static const m_option_t vf_opts_fields[] = { OPT_CHOICE_C("in", in_fmt, 0, stereo_code_names), OPT_CHOICE_C("out", out_fmt, 0, stereo_code_names), OPT_SUBSTRUCT("", lw_opts, vf_lw_conf, 0), {0} }; const vf_info_t vf_info_stereo3d = { .description = "stereoscopic 3d view", .name = "stereo3d", .open = vf_open, .priv_size = sizeof(struct vf_priv_s), .priv_defaults = &vf_priv_default, .options = vf_opts_fields, };
struct vo_priv *p = vo->priv; pthread_mutex_lock(&p->ctx->lock); forget_frames(p->ctx, true); p->ctx->img_params = *params; p->ctx->reconfigured = true; pthread_mutex_unlock(&p->ctx->lock); return 0; } // list of options which can be changed at runtime #define OPT_BASE_STRUCT struct vo_priv static const struct m_option change_opts[] = { OPT_FLAG("debug", use_gl_debug, 0), OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0), {0} }; #undef OPT_BASE_STRUCT 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);