summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-06 17:34:29 +0100
committerwm4 <wm4@nowhere>2015-01-06 17:34:29 +0100
commitb5529707f5dfb8073a13bb376fe64010186b60cf (patch)
treebcacf577b17519c4b3afa4c72a62f44e55c1fafb /video/out/vo_opengl.c
parent941eff85a64f1ac2178fcf5003fc652ee1e76cc2 (diff)
downloadmpv-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/vo_opengl.c')
-rw-r--r--video/out/vo_opengl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index d9067d9567..b4e5ecd660 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -321,15 +321,18 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_GET_EQUALIZER: {
struct voctrl_get_equalizer_args *args = data;
mpgl_lock(p->glctx);
- bool r = gl_video_get_equalizer(p->renderer, args->name,
- args->valueptr);
+ struct mp_csp_equalizer *eq = gl_video_eq_ptr(p->renderer);
+ bool r = mp_csp_equalizer_get(eq, args->name, args->valueptr) >= 0;
mpgl_unlock(p->glctx);
return r ? VO_TRUE : VO_NOTIMPL;
}
case VOCTRL_SET_EQUALIZER: {
struct voctrl_set_equalizer_args *args = data;
mpgl_lock(p->glctx);
- bool r = gl_video_set_equalizer(p->renderer, args->name, args->value);
+ struct mp_csp_equalizer *eq = gl_video_eq_ptr(p->renderer);
+ bool r = mp_csp_equalizer_set(eq, args->name, args->value) >= 0;
+ if (r)
+ gl_video_eq_update(p->renderer);
mpgl_unlock(p->glctx);
if (r)
vo->want_redraw = true;