From patchwork Sat Dec 28 00:35:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17013 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 174AE44839E for ; Sat, 28 Dec 2019 02:36:36 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EF92868AB32; Sat, 28 Dec 2019 02:36:35 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 71F0768A77A for ; Sat, 28 Dec 2019 02:36:29 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 52D1FE3E63; Sat, 28 Dec 2019 01:36:29 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PbVDuULPwv9o; Sat, 28 Dec 2019 01:36:27 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7F876E392A; Sat, 28 Dec 2019 01:36:27 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 28 Dec 2019 01:35:53 +0100 Message-Id: <20191228003553.27350-2-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191228003553.27350-1-cus@passwd.hu> References: <20191228003553.27350-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 2/2] avdevice/xcbgrab: capture the full desktop if video_size is not specified X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- doc/indevs.texi | 2 +- libavdevice/xcbgrab.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/indevs.texi b/doc/indevs.texi index 92bc65be41..e2a3540203 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -1532,7 +1532,7 @@ ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_siz @end example @item video_size -Set the video frame size. Default value is @code{vga}. +Set the video frame size. Default is the full desktop. @item grab_x @item grab_y 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,