From bf10a4fdfa40cbe519e6ccb7fb895332da2021d1 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 15 May 2013 18:17:18 +0200 Subject: 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. --- video/out/vo_corevideo.m | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) (limited to 'video/out/vo_corevideo.m') diff --git a/video/out/vo_corevideo.m b/video/out/vo_corevideo.m index f9a35b1872..3fabacf6d3 100644 --- a/video/out/vo_corevideo.m +++ b/video/out/vo_corevideo.m @@ -138,14 +138,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, return 0; } -static void check_events(struct vo *vo) -{ - struct priv *p = vo->priv; - int e = p->mpglctx->check_events(vo); - if (e & VO_EVENT_RESIZE) - resize(vo); -} - static void prepare_texture(struct vo *vo) { struct priv *p = vo->priv; @@ -359,31 +351,11 @@ static int control(struct vo *vo, uint32_t request, void *data) { struct priv *p = vo->priv; switch (request) { - case VOCTRL_ONTOP: - p->mpglctx->ontop(vo); - return VO_TRUE; - case VOCTRL_PAUSE: - if (!p->mpglctx->pause) - break; - p->mpglctx->pause(vo); - return VO_TRUE; - case VOCTRL_RESUME: - if (!p->mpglctx->resume) - break; - p->mpglctx->resume(vo); - return VO_TRUE; - case VOCTRL_FULLSCREEN: - p->mpglctx->fullscreen(vo); - resize(vo); - return VO_TRUE; case VOCTRL_GET_PANSCAN: return VO_TRUE; case VOCTRL_SET_PANSCAN: resize(vo); return VO_TRUE; - case VOCTRL_UPDATE_SCREENINFO: - p->mpglctx->update_xinerama_info(vo); - return VO_TRUE; case VOCTRL_REDRAW_FRAME: do_render(vo); return VO_TRUE; @@ -403,7 +375,13 @@ static int control(struct vo *vo, uint32_t request, void *data) return VO_TRUE; } } - return VO_NOTIMPL; + + int events = 0; + int r = p->mpglctx->vo_control(vo, &events, request, data); + if (events & VO_EVENT_RESIZE) + resize(vo); + + return r; } const struct vo_driver video_out_corevideo = { @@ -420,7 +398,6 @@ const struct vo_driver video_out_corevideo = { .draw_image = draw_image, .draw_osd = draw_osd, .flip_page = flip_page, - .check_events = check_events, .uninit = uninit, .priv_size = sizeof(struct priv), }; -- cgit v1.2.3