From patchwork Sat Apr 23 20:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nil Admirari X-Patchwork-Id: 35378 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1084775pzh; Sat, 23 Apr 2022 13:04:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2aWJstcO6qe9MYXYmntt4XLg3TYziY02/fC1OJ6z+Wjip5vQDkp2/S6mtefTbh3S41418 X-Received: by 2002:a17:907:c0c:b0:6f3:8667:9be4 with SMTP id ga12-20020a1709070c0c00b006f386679be4mr795796ejc.325.1650744243947; Sat, 23 Apr 2022 13:04:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650744243; cv=none; d=google.com; s=arc-20160816; b=cWI9ltJcue83JcGjNssEJAQ8mna8Wq/3xr5ct1INMr4x1rqAbMH7sA2cs1rP33ZCG6 B50qJVGf1vQmQGUQpPIku/FOvUgLcmJM8o3ybB4tNCIOwx27o4SLYaxkTY3U2TQIfoaC xTvJZrMfwMeS45TbIpKg/Lu7J3TuGCp48GrswZwx1a3wI5fYsbtu5Oe98JDYHH7TDLJu DWZJbtq0nevCJPlk/U4m54qwVlW0Z4BmgLTFQjMjlCyj3PQV6mRzviihIVeY1myYh+hd iwO+Gx/kCxVKkGgQSSeo550SiGB21DrPYZS945kIvZf60F1n6BbFHEMNthhrkIRa+K89 r4uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=38WrD/DSc/Is6ZmKl/QILzQLjJVHLAw4lU/VreNevOE=; b=R3DKekz0t0y37Bz4HacId+JI3Azdt0mDFTriccrJeyernkkP7rQpkSqYcP/BmKXuJs 7qfcTprMSNZ4Iwrdu2B9V83bGyLU2pfHzO0M2+fQ3djX6kBzsrCLXoehkPH7WylfzqFN tRDpJKKbNK3yA4GCTuQ4DKv5EZEWr2ji5jUQJVstWGCAH1l6tVEtNYP0d6a8L4fMezdo /LYbl/i1uIG3sWIDl1THY003BQXGm6sDYxDXaO6KAXBDQ3rXXD1Hrl1TKHL6MoLsCij4 25BW+GSV2W/3X/euT6IYgQen5KV7CPPYuCWifKeUhKWz+PuQ8gbfV6i46A4oWHTVJUlk 77DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=K6TGH0Fs; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t20-20020a170906179400b006e87aadf6casi9751716eje.965.2022.04.23.13.04.03; Sat, 23 Apr 2022 13:04:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=K6TGH0Fs; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ACE0568B320; Sat, 23 Apr 2022 23:04:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-6.mailo.com (ip-16.mailobj.net [213.182.54.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 917DA68A34B for ; Sat, 23 Apr 2022 23:03:54 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650744232; bh=BS2P6o6O+F1nZIx18g+UdZfeBM9dZfgWlZxdhQA1dDA=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; b=K6TGH0FsRf3QePbD1F5xA7SEgKDgxdYmYnxuRzEzYUcLV9BEThdOOlJEpKzUplkCt Z6CFvlMVpRqX61gSnK77zSnTYH7EppU8+i92oREXN2yItwtrEuw4m01jrcpbmavwc4 hsRfpCnU5ogekVqYmvK3t7IaUFhiMYzES2OFoBaQ= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:03:52 +0200 (CEST) X-EA-Auth: KRdrWXXHwe4LHI4VH8cn5KR9TjltDCgkazCEY85TY1c3qiKr8cdE6NK3LEgk7jLb4PytixqHuckRF35hKvyU0AXSlkiA6QXFqyRbhQ/04tM= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:03:35 +0300 Message-Id: <20220423200335.36487-1-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 1/6] libavutil/wchar_filename.h: Add whcartoutf8, wchartoansi and utf8toansi 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: R3Q5ScewQPh/ These functions are going to be used in libavformat/avisynth.c and fftools/cmdutils.c remove MAX_PATH limit. --- libavutil/wchar_filename.h | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/libavutil/wchar_filename.h b/libavutil/wchar_filename.h index 90f08245..5fdd2ff0 100644 --- a/libavutil/wchar_filename.h +++ b/libavutil/wchar_filename.h @@ -1,3 +1,4 @@ + /* * This file is part of FFmpeg. * @@ -40,6 +41,57 @@ static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w) MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, *filename_w, num_chars); return 0; } + +av_warn_unused_result +static inline int wchartocp(unsigned int code_page, const wchar_t *filename_w, + char **filename) +{ + DWORD flags = code_page == CP_UTF8 ? MB_ERR_INVALID_CHARS : 0; + int num_chars = WideCharToMultiByte(code_page, flags, filename_w, -1, + NULL, 0, NULL, NULL); + if (num_chars <= 0) { + *filename = NULL; + return 0; + } + *filename = av_calloc(num_chars, sizeof(char)); + if (!*filename) { + errno = ENOMEM; + return -1; + } + WideCharToMultiByte(code_page, flags, filename_w, -1, + *filename, num_chars, NULL, NULL); + return 0; +} + +av_warn_unused_result +static inline int wchartoutf8(const wchar_t *filename_w, char **filename) +{ + return wchartocp(CP_UTF8, filename_w, filename); +} + +av_warn_unused_result +static inline int wchartoansi(const wchar_t *filename_w, char **filename) +{ + return wchartocp(CP_ACP, filename_w, filename); +} + +av_warn_unused_result +static inline int utf8toansi(const char *filename_utf8, char **filename) +{ + wchar_t *filename_w = NULL; + int ret = -1; + if (utf8towchar(filename_utf8, &filename_w)) + return -1; + + if (!filename_w) { + *filename = NULL; + return 0; + } + + ret = wchartoansi(filename_w, filename); + av_free(filename_w); + return ret; +} #endif #endif /* AVUTIL_WCHAR_FILENAME_H */ From patchwork Sat Apr 23 20:06:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nil Admirari X-Patchwork-Id: 35380 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1086099pzh; Sat, 23 Apr 2022 13:07:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2ab3aEWPc9TZmgAlkAfL33MD1AN9NtDzeCKVznStpC1wrdVrUVeGpLXmdDu7XZu7PEGAx X-Received: by 2002:a05:6402:5ca:b0:423:f330:f574 with SMTP id n10-20020a05640205ca00b00423f330f574mr11646380edx.116.1650744448113; Sat, 23 Apr 2022 13:07:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650744448; cv=none; d=google.com; s=arc-20160816; b=qNRejdgU+Nr2fHrffRsOCyQzLKmD+KsandPfL0+mSeK2izlmGxvXIEAwyYERhY2Kvs 8qu/aiJCLdlnBLZb+/AdtPEsZYvN90gPbWQ6i3ROKWsKAUhGTBXdifdKWLiLkuOgs93q lbKn0l+bwjphGvPXJC56Tj93piK6X83dxGkWPD+qjzOCdE4n7xO+ardQrgillLUO69eU RkrY52G+g6BTzUkEoT/6gxg2Ufnp/xzcx3LcNf5B/4vTvIQNOVd3QzgnRypNIG3dUmwY Qa+066k20vcsXHLtSzmrtB5NyTFs0xF8K2CdiIFuRgErTK+4oqtEPF//d+sSlvgkBIG9 AMaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=Pl0PLxUStBiZGAoVIeSQETXGuoV8tZb9V3Zrnf4nwP4=; b=NvhWUvwtbCndB8DWJ7IVPugzli9v1OiOvoopqWo8rtd9t9Kb3St6mHeKASitPdgU1e bHkZP8Dtt73b1wLQ/rH2YXPgkSKqJ9P3tl6GpX0DBrSSl06hv+3I+NeV6iY140QQaUyg qWlHJF3HBTm6xU6ZVYCRchM2oeGUrFGgrJhG1qcpayM0F2DLa1NKARk5PxaPcxMzzJZP /hsN/RGCBm5N+IPzUVLZN2xya4cR5TUELbHoJMddUs//aAZqvYZd/Js0Mso4fp6sZu/k XnU0xvRTCwNe85oFIdN3clxPLddWk9C1xufys3yracrem7bHRPqbweFIJqCBrbM8SZ0r ygKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=WwOgw9pi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 8-20020a508e08000000b0041d130a5087si9431354edw.427.2022.04.23.13.07.27; Sat, 23 Apr 2022 13:07:28 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=WwOgw9pi; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1053A68B3BB; Sat, 23 Apr 2022 23:07:18 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 514BD68B2D2 for ; Sat, 23 Apr 2022 23:07:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650744427; bh=c6I6DJoJEcHze4lKJk/RqaRg3MXYs7DyvuFduRUa2Fo=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=WwOgw9piR1mHV4ls19z1y2qF6o25XZLmw8ql6LVAsf2MUyZeuhMgKhEdV8khjCdFe K2ZAu6UaHo7y0QPOgtHZ/XsSIqI3iekRqfgx5rqN56kfXZgfTHTWQARaYjZckF/Z2t lOfxx9SV1EcLsgeq5hi7npNSSXXqEafPO+1f4Hig= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:07:02 +0200 (CEST) X-EA-Auth: 9GM9cafbZa9hegcRxr9lWXeVzCFbCfNIk4RLwbMHaqwMbFDaUUvaXEIsZXCi4bNVYb0UqrRi3phKPTGN0LBSO5jfoSbap2Q+ePbdPLOhKfY= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:06:47 +0300 Message-Id: <20220423200651.36689-1-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423200335.36487-1-nil-admirari@mailo.com> References: <20220423200335.36487-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 2/6] libavformat/avisynth.c: Remove MAX_PATH limit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: xKijl9tys613 --- libavformat/avisynth.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 8ba2bdea..f7bea8c3 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -34,6 +34,7 @@ /* Platform-specific directives. */ #ifdef _WIN32 #include "compat/w32dlfcn.h" + #include "libavutil/wchar_filename.h" #undef EXTERN_C #define AVISYNTH_LIB "avisynth" #else @@ -810,8 +811,7 @@ static int avisynth_open_file(AVFormatContext *s) AVS_Value arg, val; int ret; #ifdef _WIN32 - char filename_ansi[MAX_PATH * 4]; - wchar_t filename_wc[MAX_PATH * 4]; + char *filename_ansi = NULL; #endif if (ret = avisynth_context_create(s)) @@ -819,10 +819,12 @@ static int avisynth_open_file(AVFormatContext *s) #ifdef _WIN32 /* Convert UTF-8 to ANSI code page */ - MultiByteToWideChar(CP_UTF8, 0, s->url, -1, filename_wc, MAX_PATH * 4); - WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, - MAX_PATH * 4, NULL, NULL); + if (utf8toansi(s->url, &filename_ansi)) { + ret = AVERROR_UNKNOWN; + goto fail; + } arg = avs_new_value_string(filename_ansi); + av_free(filename_ansi); #else arg = avs_new_value_string(s->url); #endif From patchwork Sat Apr 23 20:06:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nil Admirari X-Patchwork-Id: 35381 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1086164pzh; Sat, 23 Apr 2022 13:07:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3x/uAXhzJW5Jkjb70PILWj8vQL3amuS1P/siFjGJVUf3DGmyHzgiR6AzPQzzDALhCnu4V X-Received: by 2002:a05:6402:1941:b0:413:2b5f:9074 with SMTP id f1-20020a056402194100b004132b5f9074mr11333962edz.414.1650744456852; Sat, 23 Apr 2022 13:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650744456; cv=none; d=google.com; s=arc-20160816; b=hIpGjBswE/wYr8c1fvSDLPuErk+12d6JllbHbOvxdFDCkiOKQXPQooGk2YhX2gIF24 fTwQUpnabSLeJ1fEZpzVOlyEoB29wXL50HlfiEkG9VmhO+fg6tWjrlmso6knU4rXcgxH HqRY6RNzjlT93Aa+RF826ffm3SdqwOqJZNc6W6khHF7F9e2NWfYuDB1qao7fQ4AVCjrR yYRugX1HLJLeJP0b89ufNHQEP8Dk0lx4iwJDc+HIOgdDcFy8pMV2CsamIw/vxKyQIrwn cKF2dm3T5sn/i/hp0wPRo2DNKqiVdr+2uOOWhqjAfh+TN4MH+x+1MZSZzd9uYs2Jdy4v nuXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=uHyCHVBUkrH5Yz4E5WxGL0uu6iqYEBFNH0S35hpjK60=; b=jCK+/5bm9Owex4o1pm5/nz1y83GGNXn/wwo187vqoMyTFFJQ51sTghLvF24sU5f/9O sJ4oy0lwp/re30NU2kxjbH606+OfH0NeDJTodqoNYOLsHM5LpSGOfsKv4quSOpID/syg NjPwpn46VXAhL2g8Yhye/wlQoSij7O4Oaf+ZovGFkjV5Z0f7dGT49mChqXJYCb13JDbJ lmhkUblj8xOXOxA7p6CMaRU36rHxqmtgdxq882bP7dwpkAaU+BhW5EK1lqbgdZURCZ5h G7sE7eeNU849+nogX575CVi/76ifY1S/APICoVDzuFula9q8QrIyokBvth5+b65QlRP0 vgNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=WfKque1f; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r15-20020a17090638cf00b006e7f3596911si9409503ejd.147.2022.04.23.13.07.36; Sat, 23 Apr 2022 13:07:36 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=WfKque1f; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 071E768B365; Sat, 23 Apr 2022 23:07:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-6.mailo.com (ip-16.mailobj.net [213.182.54.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5442468B2E2 for ; Sat, 23 Apr 2022 23:07:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650744428; bh=o7cCSSHxhw0qMfLHF34MnbZ4lwmJnRwVmoNOxavqbwM=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=WfKque1fSdZd+Vx5jgsxUSAYdK8WVt79PBJLts0ba7OkQ8kCGEYEWztBYI/8AYHvO +Ysho/6SpPopfQbyRC0gw2puQPvhle/AOpdz5dlyDrLLneDhgLjZsdxmFMdT49hU4Z bS5QP1IwBICxccCF2pK1e6lBRvXEXdujKTl3//5Q= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:07:08 +0200 (CEST) X-EA-Auth: Xz1puvJQ3ORZmFboQ0WialbLQFwXHrMKBvyEmbdixCvRiD3nnkiS6BMs+y+qS0eJv0KDruuP93WIWthsbDDkKK0RtJ6ppj0F6X7DIhdSE7c= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:06:48 +0300 Message-Id: <20220423200651.36689-2-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423200651.36689-1-nil-admirari@mailo.com> References: <20220423200335.36487-1-nil-admirari@mailo.com> <20220423200651.36689-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 3/6] compat/w32dlfcn.h: Remove MAX_PATH limit and replace LoadLibraryExA with LoadLibraryExW 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: gV18luf4SKSg --- compat/w32dlfcn.h | 78 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h index 52a94efa..2284ac7a 100644 --- a/compat/w32dlfcn.h +++ b/compat/w32dlfcn.h @@ -25,6 +25,30 @@ #if (_WIN32_WINNT < 0x0602) || HAVE_WINRT #include "libavutil/wchar_filename.h" #endif + +static inline wchar_t *get_module_filename(HMODULE module) +{ + wchar_t *path = NULL, *new_path = NULL; + DWORD path_size = 0, path_len = 0; + + do { + path_size = path_size ? 2 * path_size : MAX_PATH; + new_path = av_realloc_array(path, path_size, sizeof *path); + if (!new_path) { + av_free(path); + return NULL; + } + path = new_path; + path_len = GetModuleFileNameW(module, path, path_size); + } while (path_len && path_size <= 32768 && path_size <= path_len); + + if (!path_len) { + av_free(path); + return NULL; + } + return path; +} + /** * Safe function used to open dynamic libs. This attempts to improve program security * by removing the current directory from the dll search path. Only dll's found in the @@ -34,29 +58,53 @@ */ static inline HMODULE win32_dlopen(const char *name) { + wchar_t *name_w = NULL; + if (utf8towchar(name, &name_w)) + name_w = NULL; #if _WIN32_WINNT < 0x0602 // Need to check if KB2533623 is available if (!GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDefaultDllDirectories")) { HMODULE module = NULL; - wchar_t *path = NULL, *name_w = NULL; - DWORD pathlen; - if (utf8towchar(name, &name_w)) + wchar_t *path = NULL, *new_path = NULL; + DWORD pathlen, pathsize, namelen; + if (!name_w) goto exit; - path = (wchar_t *)av_calloc(MAX_PATH, sizeof(wchar_t)); + namelen = wcslen(name_w); // Try local directory first - pathlen = GetModuleFileNameW(NULL, path, MAX_PATH); - pathlen = wcsrchr(path, '\\') - path; - if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + path = get_module_filename(NULL); + if (!path) goto exit; - path[pathlen] = '\\'; + new_path = wcsrchr(path, '\\'); + if (!new_path) + goto exit; + pathlen = new_path - path; + pathsize = pathlen + namelen + 2; + new_path = av_realloc_array(path, pathsize, sizeof *path); + if (!new_path) + goto exit; + path = new_path; wcscpy(path + pathlen + 1, name_w); module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (module == NULL) { // Next try System32 directory - pathlen = GetSystemDirectoryW(path, MAX_PATH); - if (pathlen == 0 || pathlen + wcslen(name_w) + 2 > MAX_PATH) + pathlen = GetSystemDirectoryW(path, pathsize); + if (!pathlen) goto exit; - path[pathlen] = '\\'; + // Buffer is not enough in two cases: + // 1. system directory + \ + module name + // 2. system directory even without module name. + if (pathlen + namelen + 2 > pathsize) { + pathsize = pathlen + namelen + 2; + new_path = av_realloc_array(path, pathsize, sizeof *path); + if (!new_path) + goto exit; + path = new_path; + // Query again to handle case #2. + pathlen = GetSystemDirectoryW(path, pathsize); + if (!pathlen) + goto exit; + } + path[pathlen] = L'\\'; wcscpy(path + pathlen + 1, name_w); module = LoadLibraryExW(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); } @@ -73,15 +121,17 @@ exit: # define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800 #endif #if HAVE_WINRT - wchar_t *name_w = NULL; int ret; - if (utf8towchar(name, &name_w)) + if (!name_w) return NULL; ret = LoadPackagedLibrary(name_w, 0); av_free(name_w); return ret; #else - return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); + /* filename may be be in CP_ACP */ + if (!name_w) + return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); + return LoadLibraryExW(name_w, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); #endif } #define dlopen(name, flags) win32_dlopen(name) From patchwork Sat Apr 23 20:06:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nil Admirari X-Patchwork-Id: 35384 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1086261pzh; Sat, 23 Apr 2022 13:07:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0xk0LAbIeyNtgzo/C8G+qY+GTd/pqYcVoq/T5NmTJZOLfn/oDoFMChZJT6M1ddt2IiU0W X-Received: by 2002:a17:907:2d2a:b0:6f3:85a0:3987 with SMTP id gs42-20020a1709072d2a00b006f385a03987mr997894ejc.383.1650744473912; Sat, 23 Apr 2022 13:07:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650744473; cv=none; d=google.com; s=arc-20160816; b=Q6xvcDT4Th7LeRl1HgZkrKhO8nn4BzVC2brZHI4rOLMcLVpafwcRVCZ9WLjmcklDUN 4QZbE91RRrjCHdAywSuy3xjTlmBdXrw+qLX80lzKF+z6PHUbhA7uJP/MN8+uovCvmulI vBcI21ibm1E2D8fe72dGmlmKFQNg4VtU13lMFlQlncU49oIETYawCJt3RT7fxq8TyEiF MhB788XpfzycQpwWUOf/dSgEswKX9DZNlO1Wtk1ZwJYtNH7zHp2GFi8GHWkTSjjtsiQK v5u3IZZsir7gXcKPQbD2ntfpQYkJyloGBcLSe/UfhvRpDRTCGebTU+w5Z5iXn4MGkBBM BwIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=S10EnQOsIjb/nuT2A4RUfZXYU+QrCip1x9DKLZdCxmA=; b=eWKT9/N96DF2y63vJ7aGb9Y362s4dIJ5RgKhy1USvfQl1RRiy4gYODsOdnFqIMFmru LgPcJ8O+CMHGQ05nB0LgAY2mynLItKeJ3JT7vIj9MArZmTaDfBKSPR23YonO8RPNE5nO jIlyEj12n9IUJLDyqeWoe4OMZG3pJ5eSk6iLh8nJikdwlL2YKLWW7W1rLJ0gH8sI4YWG UhzkVIcD1t/WNWV6jW2Qv6ly5Iaf3kiX2LDjHcwnxw0yAi0M1PibsSjHxdlTI7PzC0ZE mR6uBwPpBeYugh91xBVTL8GVT4DSntTms6cFESaHMGBkyHbOh+bScNR4p8BDAu1sIQyh 54Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=ceRQcJyQ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t22-20020a170906065600b006e893bdaefesi10206042ejb.884.2022.04.23.13.07.53; Sat, 23 Apr 2022 13:07:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=ceRQcJyQ; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BA10C68B3CE; Sat, 23 Apr 2022 23:07:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-1.mailo.com (msg-1.mailo.com [213.182.54.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 59B8868B315 for ; Sat, 23 Apr 2022 23:07:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650744429; bh=t6smklZrgNMtUmHuzuyBy4kwDx5oFHVH8hZzOjXBKFw=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=ceRQcJyQ0A68zYWd31poe39Sp6p3KS8stYX6f5P4kODtqYRn4AlMrZ4fILCZZ89Lj /gKzwjL35E5vO+ntb7kaI/QxCMtiGaPBquHEoOYEFaIHQRugBzcKXF1FgMHOUeg1go FC4ekiaosrFNS7GeG+ExVqTsTtmw89tFDQw7pDBk= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:07:09 +0200 (CEST) X-EA-Auth: w1ZoZqcIlZD2h/qFVbiACcqjAsaMscb8RHwEfAI9moPPy0QCJQiSeyFCCrQiVOKp6LSf/jmFYJh+Q/b68HUteI1l8o7AWiQAzemTHF3wyRc= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:06:49 +0300 Message-Id: <20220423200651.36689-3-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423200651.36689-1-nil-admirari@mailo.com> References: <20220423200335.36487-1-nil-admirari@mailo.com> <20220423200651.36689-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 4/6] fftools/cmdutils.c: Remove MAX_PATH limit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 15tY2Kxv7TGD --- fftools/cmdutils.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 5d7cdc3e..af070c19 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -37,6 +37,7 @@ #include "libswresample/swresample.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" +#include "libavutil/avutil.h" #include "libavutil/channel_layout.h" #include "libavutil/display.h" #include "libavutil/mathematics.h" @@ -50,6 +51,7 @@ #include "opt_common.h" #ifdef _WIN32 #include +#include "compat/w32dlfcn.h" #endif AVDictionary *sws_dict; @@ -812,6 +814,9 @@ FILE *get_preset_file(char *filename, size_t filename_size, { FILE *f = NULL; int i; +#if HAVE_GETMODULEHANDLE && defined(_WIN32) + char *datadir = NULL; +#endif const char *base[3] = { getenv("FFMPEG_DATADIR"), getenv("HOME"), FFMPEG_DATADIR, }; @@ -821,19 +826,31 @@ FILE *get_preset_file(char *filename, size_t filename_size, f = fopen(filename, "r"); } else { #if HAVE_GETMODULEHANDLE && defined(_WIN32) - char datadir[MAX_PATH], *ls; + wchar_t *datadir_w = get_module_filename(NULL); base[2] = NULL; - if (GetModuleFileNameA(GetModuleHandleA(NULL), datadir, sizeof(datadir) - 1)) + if (wchartoutf8(datadir_w, &datadir)) + datadir = NULL; + av_free(datadir_w); + + if (datadir) { - for (ls = datadir; ls < datadir + strlen(datadir); ls++) + char *ls; + for (ls = datadir; *ls; ls++) if (*ls == '\\') *ls = '/'; if (ls = strrchr(datadir, '/')) { - *ls = 0; - strncat(datadir, "/ffpresets", sizeof(datadir) - 1 - strlen(datadir)); - base[2] = datadir; + ptrdiff_t datadir_len = ls - datadir; + size_t desired_size = datadir_len + strlen("/ffpresets") + 1; + char *new_datadir = av_realloc_array( + datadir, desired_size, sizeof *datadir); + if (new_datadir) { + datadir = new_datadir; + datadir[datadir_len] = 0; + strncat(datadir, "/ffpresets", desired_size - 1 - datadir_len); + base[2] = datadir; + } } } #endif @@ -853,6 +870,9 @@ FILE *get_preset_file(char *filename, size_t filename_size, } } +#if HAVE_GETMODULEHANDLE && defined(_WIN32) + av_free(datadir); +#endif return f; } From patchwork Sat Apr 23 20:06:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nil Admirari X-Patchwork-Id: 35379 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1086059pzh; Sat, 23 Apr 2022 13:07:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3THvjDK2frKuV0M+/VVovEU1tigcypF9A+jgMLE89L4ZyiFARYB+63+cE2L7adzUrS6bD X-Received: by 2002:a17:907:a05a:b0:6db:f118:8834 with SMTP id gz26-20020a170907a05a00b006dbf1188834mr9631639ejc.536.1650744441142; Sat, 23 Apr 2022 13:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650744441; cv=none; d=google.com; s=arc-20160816; b=ICDfwh55fScWHYEDRa54I6JmrmsI+3gC4P8jFqGnJOjYbCzdxvzU8KJuDSOhdRvEft FqQGG2DOBdn5BVAGcWl32v//BUL5/Lnxgfi6CQRS984kATVCDnelXPJbn4mmWrwsTCvQ Ky3ubi0meLufzG4kS5pVImvK0QpEunnIFwET4hM32kmSaNwuYpfxGFOSvhWRBvoCEdU6 Jnk56wXIg87DAOF4hTCsBa0bxB3SH+ZhfapkPdMI+7ll2SIpU4WJzO+JWRN3BHMVtwB5 Uc7M5meI/t+A9XciP7QjxkodEJDCYhyE9+1wTxmUE6lYzbwjKW0QQBEnS6cE8LzLhAb7 ptVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=yJ++MKXYIxrHDHeuwvXOriTfXAOmbMp3sZdxVZGxMTU=; b=JzwjXtkJrfRLl8QJh7qyoEatc6orVLB9LXJfHN6uTMWDkiXHpRGg/uAIpvKsxPJ6sA Af+gk92AjpmWYIX30dtfA+4jfwE/sys4s9Qzp4u3hTlE50gCwwXrvLXb75qDepwtYerh smSrQ4JYoIjZ3DSxRryvXXfic/m7M2TWShUm2Ct9XQG0Eh9U5xNyD1Tr/07iqNA3C4Ke uCdF6V3KkK+I7vedx5aKRtcKnC4WDzBaze7KvGGnVxIZTGOgt3DR77jUSD4hx4QJtUUW jLRaBnSMg/P/ci/ATOqDjJgz/oiZrZPm4OPPEK2ilSBg6nY3KNlfa5s1hp6CGG9OvQsl e7qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=doTRUfRq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i35-20020a0564020f2300b00418c2b5bf77si9130427eda.601.2022.04.23.13.07.19; Sat, 23 Apr 2022 13:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=doTRUfRq; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 15A4A68B383; Sat, 23 Apr 2022 23:07:17 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-6.mailo.com (ip-16.mailobj.net [213.182.54.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 513D668B0E6 for ; Sat, 23 Apr 2022 23:07:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650744429; bh=hgZlviNGbxJy64Ovqik4Y+rNDcrjoXqjdemKcxkdE6g=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=doTRUfRqfkO0EaUb9nmW7twcOyJJo7cSs2MKYIjpukTmxB1AY95eLkxYGn5pIslN/ CM5ep3HLo4yCzdeRxha31OFRBA4qLmRWURlKPnvJpM1AeB4md4zUhy2JVuGh2HbcNl 6MRQX+cDtpNEiqv42IuflqQ3ujD9bA0VYKqFVL1s= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:07:09 +0200 (CEST) X-EA-Auth: XL2V/Izs+Wbw0bZ4esEav/aBNRWeRtGbCXtjJokWu8073UBUlJbaM/NOZyl9BggZLQkgpL4AQVk7n2S2R5LbF+jm6JFW9d1PKlq+APepAmk= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:06:50 +0300 Message-Id: <20220423200651.36689-4-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423200651.36689-1-nil-admirari@mailo.com> References: <20220423200335.36487-1-nil-admirari@mailo.com> <20220423200651.36689-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 5/6] fftools: Enable long path support on Windows (fixes #8885) 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: DV383ZGQkTAb Newer versions of Windows (Windows 10 1607 and newer) can support path names longer than MAX_PATH (260 characters). To take advantage of that, an application needs to opt in, by including a small manifest as a resource. Application must be prepared to handle filenames greater than MAX_PATH. Additionally, the path length limitation is only lifted for file APIs that pass paths as wchar_t. Therefore, the preceding patches have refactored a few remaining cases where: 1. filename length was restricted to MAX_PATH 2. files were opened using ANSI functions. On older versions of Windows, the newly added manifest has no effect. --- fftools/Makefile | 5 +++++ fftools/fftools.manifest | 10 ++++++++++ fftools/manifest.rc | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 fftools/fftools.manifest create mode 100644 fftools/manifest.rc diff --git a/fftools/Makefile b/fftools/Makefile index 81ad6c4f..105ae5cc 100644 --- a/fftools/Makefile +++ b/fftools/Makefile @@ -15,6 +15,11 @@ OBJS-ffmpeg += \ fftools/ffmpeg_mux.o \ fftools/ffmpeg_opt.o \ +# Windows resource files +OBJS-ffmpeg-$(HAVE_GNU_WINDRES) += fftools/manifest.o +OBJS-ffplay-$(HAVE_GNU_WINDRES) += fftools/manifest.o +OBJS-ffprobe-$(HAVE_GNU_WINDRES) += fftools/manifest.o + define DOFFTOOL OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes) $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1)) diff --git a/fftools/fftools.manifest b/fftools/fftools.manifest new file mode 100644 index 00000000..30b7d8fe --- /dev/null +++ b/fftools/fftools.manifest @@ -0,0 +1,10 @@ + + + + + + + true + + + diff --git a/fftools/manifest.rc b/fftools/manifest.rc new file mode 100644 index 00000000..e436fa73 --- /dev/null +++ b/fftools/manifest.rc @@ -0,0 +1,3 @@ +#include + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "fftools.manifest" From patchwork Sat Apr 23 20:06:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nil Admirari X-Patchwork-Id: 35383 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp1086213pzh; Sat, 23 Apr 2022 13:07:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyufpl/f631/VCBlOoZ+V0bWQMTpDn+UX8Tuac9Hv7s0G12F2aGqokSHyp5iO/JR6iwefN5 X-Received: by 2002:a17:906:c149:b0:6df:f047:1698 with SMTP id dp9-20020a170906c14900b006dff0471698mr9612144ejc.16.1650744464640; Sat, 23 Apr 2022 13:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650744464; cv=none; d=google.com; s=arc-20160816; b=B6G7LzSEA/kQCq9YN/DaYVHraCLCxCLbgO4sVTyS3h7alx1Xdb5fRC2TGJpLDIjMFs 9+aUlWc0pqZV7iIrGFMdThHLe4SKqVcCi7xl3chuhBQPc2XWu6kcliX3OiKMG7qCTe7D 8Ssbk85zxqizeIwAny+5qaTQlg+xRIiz91sOizystxUUqv1K0KqBXIdc3IkHXdH8UEip ryA3paOJB7vMbZqrSzS3W0NGtIlinC0IxVrpoJByzpb8Y+PwBvp+RwEsJ5z8KnvLpFG8 UCyd2fc28OgD15KkDjsTwGoJcCBex4+yLLELgc0SNEYDuRo9fhpCnDeEhLMXwIv4+Dnk 29rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=YD8vROeMvv3Jb7CTQyhFsVpEd+XFca4JS5mKAJIcNrg=; b=dbWENpkFJ3uS/avH8yRMtXMn9hKleldEkrE2wbFekHl0z4WMLgCO9+gvTZKlJp3uEn jeu+az+TpvtHFl0nyv4to4EAh47wxCzv0bOSvo14cu6rpeZs+4rDsYzqQlTG7giOH31O +KqAP6s+Ocmyy/DHFN+GhuEQTLV6uc0h+wQ7gte4nPVUkNYmhsEWoFThn7YV5cpYhCCi zt6xcktysVQIBp4ljk2AFDGdOALlf5ZRGQWOmU2XV706R1Wq5//x2pEbgYcSp8UfC7WD LBqga8f+B/KDP0RmTQP0/g5pz1qWpNF5snZGqZsKw9wzo6FqLrUsoP05idH4XJkXy63O kNrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=TRWPMEov; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j11-20020a170906254b00b006e449a9eb9csi9420010ejb.829.2022.04.23.13.07.44; Sat, 23 Apr 2022 13:07:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@mailo.com header.s=mailo header.b=TRWPMEov; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F41ED68B3C5; Sat, 23 Apr 2022 23:07:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from msg-4.mailo.com (ip-15.mailobj.net [213.182.54.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 56F7768B301 for ; Sat, 23 Apr 2022 23:07:11 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1650744430; bh=WK8WC8dBfgUPr4A7UZCcWaWfOwOcjl3gQIzkI9WfB88=; h=X-EA-Auth:From:To:Subject:Date:Message-Id:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding; b=TRWPMEov/2GU6q7ZmmDlbjV5rPWFaBxfqZkU4ow6XEKQC3ibDM5Hh5Uh+zsxjW1xN yJ6PrfhG3B8+tEy17kRjoYm8XwEjQl7orsoic98mbebJ59BkL2cGIzQI7LGMiUfd/P EzUR6cYKAizB/8MnO3Pz1Jg+TELiAnNZjh707ybQ= Received: by b-1.in.mailobj.net [192.168.90.11] with ESMTP via ip-206.mailobj.net [213.182.55.206] Sat, 23 Apr 2022 22:07:10 +0200 (CEST) X-EA-Auth: qGLlSNRiB53w1I+dE3MMFIIREc9jqDteqzrsWujTpP/6ciMjex68IlfoUcY8HphstPNbKSQzOD5a5lpckq3KRFhVKuj+R11vNoAmQsCIQUI= From: Nil Admirari To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Apr 2022 23:06:51 +0300 Message-Id: <20220423200651.36689-5-nil-admirari@mailo.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220423200651.36689-1-nil-admirari@mailo.com> References: <20220423200335.36487-1-nil-admirari@mailo.com> <20220423200651.36689-1-nil-admirari@mailo.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v10 6/6] fftools: Set active code page to UTF-8 on Windows 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: N04Ss0U07FpM Starting with Windows 1903 applications can set active code page to UTF-8 with the application manifest. It improves path name compatibility with dependencies that use char* pathnames internally, but whose code page has already been changed to UTF-8 via a manifest (e.g. AviSynth). On older versions of Windows, changes in the manifest have no effect. --- fftools/fftools.manifest | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fftools/fftools.manifest b/fftools/fftools.manifest index 30b7d8fe..d1ac1e4e 100644 --- a/fftools/fftools.manifest +++ b/fftools/fftools.manifest @@ -3,8 +3,10 @@ - + true + UTF-8