From patchwork Sat Mar 20 15:32:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 1160386205@qq.com X-Patchwork-Id: 26502 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 8873844999F for ; Sat, 20 Mar 2021 17:34:26 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 643D468A76C; Sat, 20 Mar 2021 17:34:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from qq.com (out203-205-221-221.mail.qq.com [203.205.221.221]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 50F59680A68 for ; Sat, 20 Mar 2021 17:34:18 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1616254454; bh=86KpjiqwU2h0N2CcYszTyp2G32coC37HgZg7WbIXqbQ=; h=From:To:Cc:Subject:Date; b=qjvOWkRvFuNzPrh3EjkR8yKatGtJr4EVhOzXVJG4UEWVYgnRR19xl1h2qSyuRJMgy DeJAjK27AKnVGUNXUAU/0qYIrAT5IrhxwjMgpVzoSlf2bCmfCVyBilMv0of0vFJDOV meBvPERvXZmj4Z3IqDqzgZY/vnSnwB30hs5Vo4Lk= Received: from localhost.localdomain ([61.241.193.126]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id 84E83811; Sat, 20 Mar 2021 23:33:14 +0800 X-QQ-mid: xmsmtpt1616254394txlpj7y12 Message-ID: X-QQ-XMAILINFO: NN9UNVzD7YXOtRIEjGYdl3SUT4ekTCYAp9XmDywPVZ1BBuMjMZYTiJEf2JNXwN bzEtLlRdUCSm8UqcQMYxD6Qs4uqBDFsGNYsYOZX2+9vCM1MGfQEE3F/fGbgGmVifm105NObD7iGt wW0Bao6hvWk41ct3+pJnuI79S0O/AMcIHglFfobpPw0K2YjrumJKbu3wTjhv1TwAcmLjiYMTMwcX BG6BMIcSBbOG5mH4DTXrt+vA2Y5PYlR34mLVh3n8mEaXzgd0lwf1uN6eROCbY3B7/EoX0t+n+4gV 5+BTwqwRntKRx+4cv/d0xlK0L/t/dWOW9NBPzslA6WcDR1JQoaiXiSyFQyn353NugEPeiGzju7cK y0KDnlopGCVgZBomS+nFgUX48kchPv+cb+lV49UNhCzHV5zsGI/Xn5bxacRrFVc0D6EOzT/kDxTW sMel7efJlSYcUmkPIgm52cwI5R/+0b0JEiN7hYM82+25XytCUpMPjQhNXYpGNAShDP7FbrcEeOAI Z/GTu0Z0hQSnmPVmiVQcc72suYYLssr8eplIv/uaM8u2YQH2Y+RHaThFDjwzhc8/nQwfF+f2t+oq QR+DACsh+o7zJX6iJ0y/wDaupFph7hrvGdrGGIXws9RRjn1+W519ygutuZUGHjdQy1R/yJpRD+I8 nxIY4l0NnwRIyrGdII9ciyBp9J7fsHMWChaDgS9pkZb+tpVRO1kaWWAZpoXvhBd7+XRGDzXBwG0F OoL1c7UGsoGW8XBRCv+fgAopkY0FXALKgHEkvXSsSfj0Vbh5TW5i9hJVIoAYPA+Hu9Ikfgi4BNqZ rBuOAs5K4bUPkgR1mnok/b2INcN4fXCE/8Fw+ygCF/gy0Iq6NYCkis From: 1160386205@qq.com To: ffmpeg-devel@ffmpeg.org Date: Sat, 20 Mar 2021 23:32:15 +0800 X-OQ-MSGID: <20210320153215.19-1-1160386205@qq.com> X-Mailer: git-send-email 2.30.0.windows.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libavdevice/gdigrab: fix capture window title contain non-ASCII chars 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: He Yang <1160386205@qq.com> Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" From: He Yang <1160386205@qq.com> Signed-off-by: He Yang <1160386205@qq.com> --- libavdevice/gdigrab.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libavdevice/gdigrab.c b/libavdevice/gdigrab.c index 9b2c55fe90..c2842975ec 100644 --- a/libavdevice/gdigrab.c +++ b/libavdevice/gdigrab.c @@ -246,7 +246,17 @@ gdigrab_read_header(AVFormatContext *s1) if (!strncmp(filename, "title=", 6)) { name = filename + 6; - hwnd = FindWindow(NULL, name); + const wchar_t *name_w = NULL; + if(utf8towchar(name, &name_w)) { + ret = AVERROR(ENOMEM); + goto error; + } + if(!name_w) { + ret = AVERROR(EINVAL); + goto error; + } + hwnd = FindWindowW(NULL, name_w); + av_freep(&name_w); if (!hwnd) { av_log(s1, AV_LOG_ERROR, "Can't find window '%s', aborting.\n", name);