diff options
author | wm4 <wm4@nowhere> | 2012-11-21 18:52:41 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-11-21 19:56:59 +0100 |
commit | 4757f9d0ceefb7bcae5ba9affc40777e09caffcf (patch) | |
tree | de5ab416edba708eb688865423cc0a596030c15d /video/out/vo_x11.c | |
parent | ea4332daf49c373c03612b7ed683f05383f843d6 (diff) | |
download | mpv-4757f9d0ceefb7bcae5ba9affc40777e09caffcf.tar.bz2 mpv-4757f9d0ceefb7bcae5ba9affc40777e09caffcf.tar.xz |
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.)
Diffstat (limited to 'video/out/vo_x11.c')
-rw-r--r-- | video/out/vo_x11.c | 16 |
1 files changed, 16 insertions, 0 deletions
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; } |