summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-21 18:52:41 +0100
committerwm4 <wm4@nowhere>2012-11-21 19:56:59 +0100
commit4757f9d0ceefb7bcae5ba9affc40777e09caffcf (patch)
treede5ab416edba708eb688865423cc0a596030c15d /video
parentea4332daf49c373c03612b7ed683f05383f843d6 (diff)
downloadmpv-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')
-rw-r--r--video/out/vo_x11.c16
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;
}