diff options
author | wm4 <wm4@nowhere> | 2015-01-06 17:34:29 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-01-06 17:34:29 +0100 |
commit | b5529707f5dfb8073a13bb376fe64010186b60cf (patch) | |
tree | bcacf577b17519c4b3afa4c72a62f44e55c1fafb /video/out/gl_video.c | |
parent | 941eff85a64f1ac2178fcf5003fc652ee1e76cc2 (diff) | |
download | mpv-b5529707f5dfb8073a13bb376fe64010186b60cf.tar.bz2 mpv-b5529707f5dfb8073a13bb376fe64010186b60cf.tar.xz |
vo_opengl_cb: implement equalizer controls
This makes vo_opengl_cb respond to controls like "gamma" and
"brightness". The commit includes an awkward refactor for vo_opengl to
make it easier for vo_opengl_cb.
One problem is a logical race condition. The set of supported controls
depends on the pixelformat, which in turn is set by reconfig(). But the
actual reconfig() call (on the renderer) happens asynchronously on the
renderer thread. At the time it happens, the player most likely already
tried to set some controls for command line options (see init_vo() in
video.c). So setting this command line options will fail most of the
time, though it could randomly succeed. This can't be fixed directly,
because the player can't wait on the renderer thread, because the
renderer thread might already wait on the player.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r-- | video/out/gl_video.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 88de5eeffb..12dc4d503a 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -2586,23 +2586,20 @@ void gl_video_get_colorspace(struct gl_video *p, struct mp_image_params *params) *params = p->image_params; // supports everything } -bool gl_video_set_equalizer(struct gl_video *p, const char *name, int val) +struct mp_csp_equalizer *gl_video_eq_ptr(struct gl_video *p) { - if (mp_csp_equalizer_set(&p->video_eq, name, val) >= 0) { - if (!p->opts.gamma && p->video_eq.values[MP_CSP_EQ_GAMMA] != 0) { - MP_VERBOSE(p, "Auto-enabling gamma.\n"); - p->opts.gamma = 1.0f; - compile_shaders(p); - } - update_all_uniforms(p); - return true; - } - return false; + return &p->video_eq; } -bool gl_video_get_equalizer(struct gl_video *p, const char *name, int *val) +// Call when the mp_csp_equalizer returned by gl_video_eq_ptr() was changed. +void gl_video_eq_update(struct gl_video *p) { - return mp_csp_equalizer_get(&p->video_eq, name, val) >= 0; + if (!p->opts.gamma && p->video_eq.values[MP_CSP_EQ_GAMMA] != 0) { + MP_VERBOSE(p, "Auto-enabling gamma.\n"); + p->opts.gamma = 1.0f; + compile_shaders(p); + } + update_all_uniforms(p); } static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt, |