summaryrefslogtreecommitdiffstats
path: root/libavdevice
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2014-07-15 15:37:00 +0200
committerNicolas George <george@nsup.org>2014-07-17 18:11:55 +0200
commita65c0a3fe822386be30fd3371af9f0d008b02874 (patch)
tree24a3463c90ec3cd89652ce4157cbe6dce0c2930d /libavdevice
parentdca22ab055bd19a49c173c49fc0a8db7be442044 (diff)
downloadffmpeg-streaming-a65c0a3fe822386be30fd3371af9f0d008b02874.zip
ffmpeg-streaming-a65c0a3fe822386be30fd3371af9f0d008b02874.tar.gz
lavd/x11grab: disable drawing mouse without XFixes.
Fix a segfault if the XFixes extension is not available on the X11 server. Can be reproduced using the VNC server.
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/x11grab.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index d38c55d..eb75e62 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -346,8 +346,9 @@ out:
* coordinates
*/
static void
-paint_mouse_pointer(XImage *image, struct x11grab *s)
+paint_mouse_pointer(XImage *image, AVFormatContext *s1)
{
+ struct x11grab *s = s1->priv_data;
int x_off = s->x_off;
int y_off = s->y_off;
int width = s->width;
@@ -377,6 +378,12 @@ paint_mouse_pointer(XImage *image, struct x11grab *s)
XChangeWindowAttributes(dpy, w, CWCursor, &attr);
xcim = XFixesGetCursorImage(dpy);
+ if (!xcim) {
+ av_log(s1, AV_LOG_WARNING,
+ "XFixes extension not available, impossible to draw cursor\n");
+ s->draw_mouse = 0;
+ return;
+ }
x = xcim->x - xcim->xhot;
y = xcim->y - xcim->yhot;
@@ -573,7 +580,7 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
if (s->draw_mouse) {
- paint_mouse_pointer(image, s);
+ paint_mouse_pointer(image, s1);
}
return s->frame_size;
OpenPOWER on IntegriCloud