mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 01:02:33 +00:00
xcbgrab: Do not assume the non shm image data is always available
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
a09c499a2e
commit
82a10225f8
@ -145,13 +145,25 @@ static int xcbgrab_frame(AVFormatContext *s, AVPacket *pkt)
|
|||||||
xcb_get_image_cookie_t iq;
|
xcb_get_image_cookie_t iq;
|
||||||
xcb_get_image_reply_t *img;
|
xcb_get_image_reply_t *img;
|
||||||
xcb_drawable_t drawable = c->screen->root;
|
xcb_drawable_t drawable = c->screen->root;
|
||||||
|
xcb_generic_error_t *e = NULL;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
int length, ret;
|
int length, ret;
|
||||||
|
|
||||||
iq = xcb_get_image(c->conn, XCB_IMAGE_FORMAT_Z_PIXMAP, drawable,
|
iq = xcb_get_image(c->conn, XCB_IMAGE_FORMAT_Z_PIXMAP, drawable,
|
||||||
c->x, c->y, c->width, c->height, ~0);
|
c->x, c->y, c->width, c->height, ~0);
|
||||||
|
|
||||||
img = xcb_get_image_reply(c->conn, iq, NULL);
|
img = xcb_get_image_reply(c->conn, iq, &e);
|
||||||
|
|
||||||
|
if (e) {
|
||||||
|
av_log(s, AV_LOG_ERROR,
|
||||||
|
"Cannot get the image data "
|
||||||
|
"event_error: response_type:%u error_code:%u "
|
||||||
|
"sequence:%u resource_id:%u minor_code:%u major_code:%u.\n",
|
||||||
|
e->response_type, e->error_code,
|
||||||
|
e->sequence, e->resource_id, e->minor_code, e->major_code);
|
||||||
|
return AVERROR(EACCES);
|
||||||
|
}
|
||||||
|
|
||||||
if (!img)
|
if (!img)
|
||||||
return AVERROR(EAGAIN);
|
return AVERROR(EAGAIN);
|
||||||
|
|
||||||
@ -405,7 +417,7 @@ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
ret = xcbgrab_frame(s, pkt);
|
ret = xcbgrab_frame(s, pkt);
|
||||||
|
|
||||||
#if CONFIG_LIBXCB_XFIXES
|
#if CONFIG_LIBXCB_XFIXES
|
||||||
if (c->draw_mouse && p->same_screen)
|
if (ret >= 0 && c->draw_mouse && p->same_screen)
|
||||||
xcbgrab_draw_mouse(s, pkt, p, geo);
|
xcbgrab_draw_mouse(s, pkt, p, geo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user