From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id AA2B448765 for ; Sat, 16 Dec 2023 15:32:05 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6E76368D145; Sat, 16 Dec 2023 17:32:02 +0200 (EET) Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8124068CF74 for ; Sat, 16 Dec 2023 17:31:55 +0200 (EET) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-54bf9a54fe3so2017065a12.3 for ; Sat, 16 Dec 2023 07:31:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702740714; x=1703345514; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=i+8lbm+Ljevl8F2kSLu+ufAzPf83GS0s67ML8719gi0=; b=LhmMp6/9iN2yKP9vRNzDOZLaDim4pD9PVJVLQMyE1Ig1yIQR9xzkB1BchMd1zlotVU B47YsEjpzYqzPdbwJQOA9Jk5yx/vCizzesxYhu5GHcL7p++PBq5TJQu4l+Rsjy8SqBZe n/rZwUqHI170Et5nvwXyEtiAJBpCZyssAyRSRMX8ZfaVBobspVzGsOwVwVjJuuOhO/Jw NucQLVUeRwuzoUBnVffyS4nii2NSUaDO03VUPypPWNdebDZeRnYkRndQQk7G+1QvxPel Tv1T2wlDn6/wKXNYwyRulJM28DOu5+64oP0Yismfxch2y0qbEG+l8fVsRGlTE2uO8MXJ 0g+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702740714; x=1703345514; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i+8lbm+Ljevl8F2kSLu+ufAzPf83GS0s67ML8719gi0=; b=e1x8L/siPoX7ZEEOuhmSydteF480vEMCMfsTzBmkWlTL5kp44yjN1r6FCknx8bYEZG aLCBTbgrwWMHyWBsfp5UPqHfTEj+KyQYoGacigHDITDQ+cL6qDs6xpVLzn1rRLTGZeUc /jNy8oJ3Z6tACEewVXDcKs8or3r/xjtfbigSCcdUOl6p7LW5SriMXQVJx28jA3ALCLam z8MT38nrOmDrhyPOCPs181oHZ717EfHGeZ0/XqtmFe4cpzrOzMH5VW1QtBW9TNi19LPI Ji6N4P7mKPghJK4MB2b3JwyhHA1+Lih+iO/uLhSmhdtUVhOBWVk98hlU7hs8i/lhfkSg FN7w== X-Gm-Message-State: AOJu0YxQPtWIoghb4oE5LvdXOcwdgduUBrK/XjYh9yepusowERNIumRa IcH2yV083Rc8QJxsfgzGs5j1SXeWMJc= X-Google-Smtp-Source: AGHT+IF15VcsKnKGpiuSQF+C+zVO8sOqAUGM0J0mb20zE7ooAtMqICVvsxqPDYmtuOu6D1pmOH87Kg== X-Received: by 2002:a17:906:74c8:b0:a23:b67:d1d9 with SMTP id z8-20020a17090674c800b00a230b67d1d9mr2432215ejl.2.1702740714324; Sat, 16 Dec 2023 07:31:54 -0800 (PST) Received: from mariano (dynamic-adsl-84-220-189-10.clienti.tiscali.it. [84.220.189.10]) by smtp.gmail.com with ESMTPSA id vs4-20020a170907a58400b00a22fb8901c4sm5213226ejc.12.2023.12.16.07.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 07:31:53 -0800 (PST) Received: by mariano (Postfix, from userid 1000) id B9314BFCDA; Sat, 16 Dec 2023 16:31:52 +0100 (CET) Date: Sat, 16 Dec 2023 16:31:52 +0100 From: Stefano Sabatini To: Lena Message-ID: Mail-Followup-To: Lena , ffmpeg-devel@ffmpeg.org, Remi Denis-Courmont , Nicolas George , Andreas Rheinhardt References: <20231214103241.25089-4-lena@nihil.gay> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231214103241.25089-4-lena@nihil.gay> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH v3] gdigrab: Allow capturing a window by its handle X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Nicolas George , Remi Denis-Courmont , ffmpeg-devel@ffmpeg.org, Andreas Rheinhardt Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On date Thursday 2023-12-14 11:32:44 +0100, Lena wrote: > Updated the wording of the documentation, and added error checking for strtol. > > I looked at how other parts of the codebase check for errors on strtol and implemented it that way (iec61883, filter_units_bsf, etc). > > As for checking if the string value is larger/smaller than a long, i don't think there's a need, as the documentation says it'd just get set to LONG_MIN/LONG_MAX and fail anyway. > > > x11grab can capture windows by their ID, but gdigrab can only capture windows by their names, internally calling FindWindowW to lookup its handle. > > This patch simply allows the user to specify a window handle directly. > Signed-off-by: Lena > --- > doc/indevs.texi | 8 ++++++-- > libavdevice/gdigrab.c | 15 ++++++++++++++- > 2 files changed, 20 insertions(+), 3 deletions(-) > > diff --git a/doc/indevs.texi b/doc/indevs.texi > index 863536a34d..a0c684f545 100644 > --- a/doc/indevs.texi > +++ b/doc/indevs.texi > @@ -722,7 +722,7 @@ Win32 GDI-based screen capture device. > > This device allows you to capture a region of the display on Windows. > > -There are two options for the input filename: > +Amongst options for the imput filenames are such elements as: > @example > desktop > @end example > @@ -730,9 +730,13 @@ or > @example > title=@var{window_title} > @end example > +or > +@example > +hwnd=@var{window_hwnd} > +@end example > > The first option will capture the entire desktop, or a fixed region of the > -desktop. The second option will instead capture the contents of a single > +desktop. The second and third options will instead capture the contents of a single > window, regardless of its position on the screen. > > For example, to grab the entire desktop using @command{ffmpeg}: > diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c > index c069232472..3153b6f711 100644 > --- a/libavdevice/gdigrab.c > +++ b/libavdevice/gdigrab.c > @@ -273,9 +273,22 @@ gdigrab_read_header(AVFormatContext *s1) > } > } else if (!strcmp(filename, "desktop")) { > hwnd = NULL; > + } else if (!strncmp(filename, "hwnd=", 5)) { > + name = filename + 5; > + char *p; > + > + hwnd = strtol(name, &p, 0); > + > + if (p == NULL || p == name || p[0] == '\0') > + { > + av_log(s1, AV_LOG_ERROR, > + "Invalid window handle.\n"); Here you can provide some context: "Invalid window handle '%s', must be an valid integer.", name Looks good otherwise, thanks. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".