mirror of
https://github.com/mpv-player/mpv
synced 2025-01-11 17:39:38 +00:00
vo_opengl: apply vo-cmdline command incrementally
Instead of implicitly resetting the options to defaults and then applying the options, they're always applied on top of the current options (in the same way adding new options to the CLI command line will). This does not apply to vo_opengl_cb, because that has an even worse mess which I refuse to deal with.
This commit is contained in:
parent
ee337b47be
commit
c1cb04b6a3
@ -46,6 +46,11 @@ API changes
|
||||
- reading a choice property as MPV_FORMAT_NODE will now return a
|
||||
MPV_FORMAT_FLAG value if the choice is "yes" (true) or "no" (false)
|
||||
This implicitly affects Lua and JSON IPC interfaces as well.
|
||||
- big changes to vo-cmdline on vo_opengl and vo_opengl_hq (but not
|
||||
vo_opengl_cb): options are now normally not reset, but applied on top
|
||||
of the current options. The special undocumented value "-" still
|
||||
works, but now resets all options to before any vo-cmdline command
|
||||
has been called.
|
||||
--- mpv 0.12.0 ---
|
||||
1.20 - deprecate "GL_MP_D3D_interfaces"/"glMPGetD3DInterface", and introduce
|
||||
"GL_MP_MPGetNativeDisplay"/"glMPGetNativeDisplay" (this is a
|
||||
|
@ -259,12 +259,12 @@ static struct vo *vo_create(bool probing, struct mpv_global *global,
|
||||
mp_input_set_mouse_transform(vo->input_ctx, NULL, NULL);
|
||||
if (vo->driver->encode != !!vo->encode_lavc_ctx)
|
||||
goto error;
|
||||
struct m_config *config = m_config_from_obj_desc(vo, vo->log, &desc);
|
||||
if (m_config_apply_defaults(config, name, vo->opts->vo_defs) < 0)
|
||||
vo->config = m_config_from_obj_desc(vo, vo->log, &desc);
|
||||
if (m_config_apply_defaults(vo->config, name, vo->opts->vo_defs) < 0)
|
||||
goto error;
|
||||
if (m_config_set_obj_params(config, args) < 0)
|
||||
if (m_config_set_obj_params(vo->config, args) < 0)
|
||||
goto error;
|
||||
vo->priv = config->optstruct;
|
||||
vo->priv = vo->config->optstruct;
|
||||
|
||||
if (pthread_create(&vo->in->thread, NULL, vo_thread, vo))
|
||||
goto error;
|
||||
|
@ -303,6 +303,7 @@ struct vo {
|
||||
struct vo_internal *in;
|
||||
struct mp_vo_opts *opts;
|
||||
struct vo_extra extra;
|
||||
struct m_config *config;
|
||||
|
||||
// --- The following fields are generally only changed during initialization.
|
||||
|
||||
|
@ -60,6 +60,8 @@ struct gl_priv {
|
||||
|
||||
int events;
|
||||
|
||||
void *original_opts;
|
||||
|
||||
// Options
|
||||
struct gl_video_opts *renderer_opts;
|
||||
int use_glFinish;
|
||||
@ -245,37 +247,31 @@ static void get_and_update_ambient_lighting(struct gl_priv *p)
|
||||
}
|
||||
}
|
||||
|
||||
static bool reparse_cmdline(struct gl_priv *p, char *args)
|
||||
static const struct m_option options[];
|
||||
|
||||
static const struct m_sub_options opengl_conf = {
|
||||
.opts = options,
|
||||
.size = sizeof(struct gl_priv),
|
||||
};
|
||||
|
||||
static bool reparse_cmdline(struct vo *vo, char *args)
|
||||
{
|
||||
struct m_config *cfg = NULL;
|
||||
struct gl_priv *opts = NULL;
|
||||
struct gl_priv *p = vo->priv;
|
||||
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
|
||||
struct gl_priv *opts = p;
|
||||
|
||||
if (strcmp(args, "-") == 0) {
|
||||
opts = p;
|
||||
opts = p->original_opts;
|
||||
} 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);
|
||||
r = m_config_parse_suboptions(vo->config, "opengl", args);
|
||||
}
|
||||
|
||||
if (r >= 0) {
|
||||
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;
|
||||
}
|
||||
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;
|
||||
|
||||
talloc_free(cfg);
|
||||
return r >= 0;
|
||||
}
|
||||
|
||||
@ -322,7 +318,7 @@ static int control(struct vo *vo, uint32_t request, void *data)
|
||||
return true;
|
||||
case VOCTRL_SET_COMMAND_LINE: {
|
||||
char *arg = data;
|
||||
return reparse_cmdline(p, arg);
|
||||
return reparse_cmdline(vo, arg);
|
||||
}
|
||||
case VOCTRL_RESET:
|
||||
gl_video_reset(p->renderer);
|
||||
@ -426,6 +422,8 @@ static int preinit(struct vo *vo)
|
||||
gl_video_set_hwdec(p->renderer, p->hwdec);
|
||||
}
|
||||
|
||||
p->original_opts = m_sub_options_copy(p, &opengl_conf, p);
|
||||
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
|
Loading…
Reference in New Issue
Block a user