From 4757f9d0ceefb7bcae5ba9affc40777e09caffcf Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 21 Nov 2012 18:52:41 +0100 Subject: vo_x11: add screenshot support Although vo_x11 shouldn't be used, it's a good thing to have screenshot support in absolutely all interactive VOs. (Except vo_caca, but that is literally a joke.) --- video/out/vo_x11.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'video/out') diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index 97a44337e8..0c309c44b5 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -442,6 +442,17 @@ static void draw_osd(struct vo *vo, struct osd_state *osd) osd_draw_on_image(osd, res, osd->vo_pts, 0, &img); } +static mp_image_t *get_screenshot(struct vo *vo) +{ + struct priv *p = vo->priv; + + struct mp_image img = get_x_buffer(p); + struct mp_image *res = alloc_mpi(img.w, img.h, img.imgfmt); + copy_mpi(res, &img); + + return res; +} + static void flip_page(struct vo *vo) { struct priv *p = vo->priv; @@ -587,6 +598,11 @@ static int control(struct vo *vo, uint32_t request, void *data) case VOCTRL_UPDATE_SCREENINFO: update_xinerama_info(vo); return VO_TRUE; + case VOCTRL_SCREENSHOT: { + struct voctrl_screenshot_args *args = data; + args->out_image = get_screenshot(vo); + return true; + } } return VO_NOTIMPL; } -- cgit v1.2.3