aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2014-09-11 14:15:08 +0200
committerLuca Barbato <lu_zero@gentoo.org>2014-10-04 23:46:46 +0200
commit89fa2b5616274194d90bde0aeebf6adbd1245193 (patch)
tree2d1d60aac13823c0b476d747da5879d869394d3b
parent68211c70afcfd4d675029cc85fba7dee8de53bdf (diff)
downloadffmpeg-89fa2b5616274194d90bde0aeebf6adbd1245193.tar.gz
x11grab: Check for XFixes availability at runtime
-rw-r--r--libavdevice/x11grab.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 03fd567db8..ebc893bc8a 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -168,6 +168,19 @@ static int setup_shm(AVFormatContext *s, Display *dpy, XImage **image)
return 0;
}
+static int setup_mouse(Display *dpy, int screen)
+{
+ int ev_ret, ev_err;
+
+ if (XFixesQueryExtension(dpy, &ev_ret, &ev_err)) {
+ Window root = RootWindow(dpy, screen);
+ XFixesSelectCursorInput(dpy, root, XFixesDisplayCursorNotifyMask);
+ return 0;
+ }
+
+ return AVERROR(ENOSYS);
+}
+
static int pixfmt_from_image(AVFormatContext *s, XImage *image, int *pix_fmt)
{
av_log(s, AV_LOG_DEBUG,
@@ -318,6 +331,12 @@ static int x11grab_read_header(AVFormatContext *s1)
AllPlanes, ZPixmap);
}
+ if (x11grab->draw_mouse && setup_mouse(dpy, screen) < 0) {
+ av_log(s1, AV_LOG_WARNING,
+ "XFixes not available, cannot draw the mouse cursor\n");
+ x11grab->draw_mouse = 0;
+ }
+
x11grab->frame_size = x11grab->width * x11grab->height * image->bits_per_pixel / 8;
x11grab->dpy = dpy;
x11grab->time_base = (AVRational) { framerate.den, framerate.num };