summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl_old.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-05-15 18:17:18 +0200
committerwm4 <wm4@nowhere>2013-05-26 16:44:18 +0200
commitbf10a4fdfa40cbe519e6ccb7fb895332da2021d1 (patch)
tree8ff3a3b2601c85291c5531e4d0dc88266a6b7ef6 /video/out/vo_opengl_old.c
parentc23bf5311fce3b59e9111e5de646ee57b48be27f (diff)
downloadmpv-bf10a4fdfa40cbe519e6ccb7fb895332da2021d1.tar.bz2
mpv-bf10a4fdfa40cbe519e6ccb7fb895332da2021d1.tar.xz
video/out: introduce vo_control for gl_common based VOs
Instead of having separate callbacks for each backend-handled feature (like MPGLContext.fullscreen, MPGLContext.border, etc.), pass the VOCTRL responsible for this directly to the backend. This allows removing a bunch of callbacks, that currently must be set even for optional/lesser features (like VOCTRL_BORDER). This requires changes to all VOs using gl_common, as well as all backends that support gl_common. Also introduce VOCTRL_CHECK_EVENTS. vo.check_events is now optional. VO backends can use VOCTRL_CHECK_EVENTS instead to implementing check_events. This has the advantage that the event handling code in VOs doesn't have to be duplicated if vo_control() is used.
Diffstat (limited to 'video/out/vo_opengl_old.c')
-rw-r--r--video/out/vo_opengl_old.c52
1 files changed, 9 insertions, 43 deletions
diff --git a/video/out/vo_opengl_old.c b/video/out/vo_opengl_old.c
index cd92acfaa0..508355a405 100644
--- a/video/out/vo_opengl_old.c
+++ b/video/out/vo_opengl_old.c
@@ -1750,17 +1750,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
return 0;
}
-static void check_events(struct vo *vo)
-{
- struct gl_priv *p = vo->priv;
-
- int e = p->glctx->check_events(vo);
- if (e & VO_EVENT_RESIZE)
- resize(vo, vo->dwidth, vo->dheight);
- if (e & VO_EVENT_EXPOSE)
- vo->want_redraw = true;
-}
-
static void do_render(struct vo *vo)
{
struct gl_priv *p = vo->priv;
@@ -2276,21 +2265,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
struct gl_priv *p = vo->priv;
switch (request) {
- case VOCTRL_ONTOP:
- if (!p->glctx->ontop)
- break;
- p->glctx->ontop(vo);
- return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- p->glctx->fullscreen(vo);
- resize(vo, vo->dwidth, vo->dheight);
- return VO_TRUE;
- case VOCTRL_BORDER:
- if (!p->glctx->border)
- break;
- p->glctx->border(vo);
- resize(vo, vo->dwidth, vo->dheight);
- return VO_TRUE;
case VOCTRL_GET_PANSCAN:
return VO_TRUE;
case VOCTRL_SET_PANSCAN:
@@ -2325,24 +2299,9 @@ static int control(struct vo *vo, uint32_t request, void *data)
case VOCTRL_GET_YUV_COLORSPACE:
*(struct mp_csp_details *)data = p->colorspace;
return VO_TRUE;
- case VOCTRL_UPDATE_SCREENINFO:
- if (!p->glctx->update_xinerama_info)
- break;
- p->glctx->update_xinerama_info(vo);
- return VO_TRUE;
case VOCTRL_REDRAW_FRAME:
do_render(vo);
return true;
- case VOCTRL_PAUSE:
- if (!p->glctx->pause)
- break;
- p->glctx->pause(vo);
- return VO_TRUE;
- case VOCTRL_RESUME:
- if (!p->glctx->resume)
- break;
- p->glctx->resume(vo);
- return VO_TRUE;
case VOCTRL_SCREENSHOT: {
struct voctrl_screenshot_args *args = data;
if (args->full_window)
@@ -2352,7 +2311,15 @@ static int control(struct vo *vo, uint32_t request, void *data)
return true;
}
}
- return VO_NOTIMPL;
+
+ int events = 0;
+ int r = p->glctx->vo_control(vo, &events, request, data);
+ if (events & VO_EVENT_RESIZE)
+ resize(vo, vo->dwidth, vo->dheight);
+ if (events & VO_EVENT_EXPOSE)
+ vo->want_redraw = true;
+
+ return r;
}
const struct vo_driver video_out_opengl_old = {
@@ -2369,6 +2336,5 @@ const struct vo_driver video_out_opengl_old = {
.draw_image = draw_image,
.draw_osd = draw_osd,
.flip_page = flip_page,
- .check_events = check_events,
.uninit = uninit,
};