diff options
author | Marton Balint <cus@passwd.hu> | 2019-12-28 01:15:34 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2019-12-30 23:32:27 +0100 |
commit | f1353ce2227a46174e65112c0f0221c91cd2c035 (patch) | |
tree | 1dc2f09feb6d4040460109e305f513fb4d97a456 /libavdevice | |
parent | f6845269c667422ced17d64f2e8a079437e74fe7 (diff) | |
download | ffmpeg-f1353ce2227a46174e65112c0f0221c91cd2c035.tar.gz |
avdevice/xcbgrab: capture the full desktop if video_size is not specified
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice')
-rw-r--r-- | libavdevice/version.h | 2 | ||||
-rw-r--r-- | libavdevice/xcbgrab.c | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/libavdevice/version.h b/libavdevice/version.h index 68302908cf..ec0ba776be 100644 --- a/libavdevice/version.h +++ b/libavdevice/version.h @@ -29,7 +29,7 @@ #define LIBAVDEVICE_VERSION_MAJOR 58 #define LIBAVDEVICE_VERSION_MINOR 9 -#define LIBAVDEVICE_VERSION_MICRO 101 +#define LIBAVDEVICE_VERSION_MICRO 102 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ LIBAVDEVICE_VERSION_MINOR, \ diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c index 861eef07b5..113cce71a5 100644 --- a/libavdevice/xcbgrab.c +++ b/libavdevice/xcbgrab.c @@ -70,7 +70,6 @@ typedef struct XCBGrabContext { int region_border; int centered; - const char *video_size; const char *framerate; int has_shm; @@ -85,7 +84,7 @@ static const AVOption options[] = { { "y", "Initial y coordinate.", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D }, { "grab_x", "Initial x coordinate.", OFFSET(x), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D }, { "grab_y", "Initial y coordinate.", OFFSET(y), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, D }, - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), AV_OPT_TYPE_STRING, {.str = "vga" }, 0, 0, D }, + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL }, 0, 0, D }, { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "ntsc" }, 0, 0, D }, { "draw_mouse", "Draw the mouse pointer.", OFFSET(draw_mouse), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, D }, { "follow_mouse", "Move the grabbing region when the mouse pointer reaches within specified amount of pixels to the edge of region.", @@ -555,10 +554,6 @@ static int create_stream(AVFormatContext *s) if (!st) return AVERROR(ENOMEM); - ret = av_parse_video_size(&c->width, &c->height, c->video_size); - if (ret < 0) - return ret; - ret = av_parse_video_rate(&st->avg_frame_rate, c->framerate); if (ret < 0) return ret; @@ -570,6 +565,11 @@ static int create_stream(AVFormatContext *s) if (!geo) return AVERROR_EXTERNAL; + if (!c->width || !c->height) { + c->width = geo->width; + c->height = geo->height; + } + if (c->x + c->width > geo->width || c->y + c->height > geo->height) { av_log(s, AV_LOG_ERROR, |