mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-25 00:32:31 +00:00
avdevice/xcbgrab: Fix offset support
Found-by: carl Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
0c9f0da0f7
commit
db442c8736
@ -491,7 +491,6 @@ static int create_stream(AVFormatContext *s)
|
||||
{
|
||||
XCBGrabContext *c = s->priv_data;
|
||||
AVStream *st = avformat_new_stream(s, NULL);
|
||||
const char *opts = strchr(s->filename, '+');
|
||||
xcb_get_geometry_cookie_t gc;
|
||||
xcb_get_geometry_reply_t *geo;
|
||||
int ret;
|
||||
@ -507,9 +506,6 @@ static int create_stream(AVFormatContext *s)
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (opts)
|
||||
sscanf(opts, "%d,%d", &c->x, &c->y);
|
||||
|
||||
avpriv_set_pts_info(st, 64, 1, 1000000);
|
||||
|
||||
gc = xcb_get_geometry(c->conn, c->screen->root);
|
||||
@ -598,8 +594,20 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
|
||||
XCBGrabContext *c = s->priv_data;
|
||||
int screen_num, ret;
|
||||
const xcb_setup_t *setup;
|
||||
char *display_name = av_strdup(s->filename);
|
||||
|
||||
c->conn = xcb_connect(s->filename, &screen_num);
|
||||
if (s->filename) {
|
||||
if (!display_name)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
if (!sscanf(s->filename, "%[^+]+%d,%d", display_name, &c->x, &c->y)) {
|
||||
*display_name = 0;
|
||||
sscanf(s->filename, "+%d,%d", &c->x, &c->y);
|
||||
}
|
||||
}
|
||||
|
||||
c->conn = xcb_connect(display_name, &screen_num);
|
||||
av_freep(&display_name);
|
||||
if ((ret = xcb_connection_has_error(c->conn))) {
|
||||
av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
|
||||
s->filename ? s->filename : "default", ret);
|
||||
|
Loading…
Reference in New Issue
Block a user