From patchwork Thu May 19 21:40:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aman Karmani X-Patchwork-Id: 35836 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:9992:b0:82:461d:f3b with SMTP id ve18csp290193pzb; Thu, 19 May 2022 14:40:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFXbVMEZyH4MJLLNkiupc9G+vhQxDF0k3eaVamdnegHocdjgzKEGqtCLEn/Aigl9GmEPFP X-Received: by 2002:a05:6402:ea1:b0:42b:2c59:503 with SMTP id h33-20020a0564020ea100b0042b2c590503mr69108eda.9.1652996456428; Thu, 19 May 2022 14:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652996456; cv=none; d=google.com; s=arc-20160816; b=FmxOvDyWpP/e/KJd2n2p+udFjPZcAddzzlZxf9N/FSp0yMg3vRf0rtCPBDy5ln57BF osUGsyTCGamWi+5twGuA4oK+AdZGnpyK9MUkM2fSJNpqtDXe8GU2rfxDp9JHRxd0DDum FOKAKHVxOTPmdiEEgQhO7LwdCFqY9ychjWDUI4ZMyeqAnzCggxenjWA0FbHlp/8zbDe/ 10k93FPQit7HuKdS6EirS6JsHOeSSJBWP9e9Y4gusvIFNmqQnuH/nD1uc7aJoR9+2u3K cy9MqIPG8zldJVPpvSNh0gEwL0YJuST2X9rVoehmPEQqqkPkUFxiSO8K0L2AZDpmUSDt 9hNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:to:mime-version:fcc:date:references :in-reply-to:message-id:from:dkim-signature:delivered-to; bh=ybKFwEaoEmNGwfFRRIdfaW0p/Vch0maHRqn5T5MnzRU=; b=lzGxW8ULzEPA8XJ37bwUH0EB0OERs50dXmPJRtQvxnEV5XgLddBydNhuwBmPvdgwL3 pCe2i8WLMxGpivXNRUkLQK3+nqlV6YdF0w677eARTm4+KOVwqgEeypODaDbk4HRTLX0E 6P1OHmPxD0g88h8Q+/InzWe2YrHFAmVYb9BVAcApVr1fgC7XqIW/G5SFhyKwgSelNTAv Q3+qaK33s8Y5TBK+5gMOPOLACDsKAYE4JG4M+N4wT4NNmOaJYkZG+f3q1t4BFoAQFYQM KAccW0/D1jF4KheD6A9WP1eZ7xjB3tbKxQQT6awjoxQDc+1JjZAmcCySUIfrh+iNgsZP 1OMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=XlwEY7A5; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q13-20020a056402518d00b0042aef351535si5992724edd.564.2022.05.19.14.40.56; Thu, 19 May 2022 14:40:56 -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=@gmail.com header.s=20210112 header.b=XlwEY7A5; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4859668B4AD; Fri, 20 May 2022 00:40:48 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 51B3B68B49F for ; Fri, 20 May 2022 00:40:41 +0300 (EEST) Received: by mail-pj1-f50.google.com with SMTP id t11-20020a17090a6a0b00b001df6f318a8bso9843885pjj.4 for ; Thu, 19 May 2022 14:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:message-id:in-reply-to:references:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=uulbtmIky/jbci4r7YbzEyBWG0sN2r94tWbYVQhGf5Y=; b=XlwEY7A552u+EFH+LGRUeXiQWaY5QlVgYfqsJxNVIx1F/iM4fxmiUWoMvQzmgDRCAI L7vgoiy9UPvfxhxd7cJBEyl8t6zt69R9niCXMh0vFs+QrIkM5EZqoYLoDKTb9N7QYC0w famVo0RJG5jxtwxdpguH9q0/LOVrGpQJ/xmK5UIKm8A8sUDcdFH9AnzfbcDXWkYdJwY0 I8h0m+nG8QLx9WJ+1B5Z351ijbbyC6PRj4D45eYOsVtMBnT3bgknf0/FZFCBIkIUyNCo P6KOKsEJK4JJybVTmydYMjL8ExCkiVlDrNBqxC0hk6w068n6aSMzvYmZoO+obwueB9fe M7/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:in-reply-to:references:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=uulbtmIky/jbci4r7YbzEyBWG0sN2r94tWbYVQhGf5Y=; b=R4V+vOzAOx3CaTysQsyG9BX3DjZ1C1+75qwU9wMCEpIR+dRbBEZYIL+leiHCCs03l8 9s10SHfR4xgZTG6bNYnnGlOLKQIT/EFpO6ntAxny7kzDTc56jBRuTe/ExDwGmRuobYhp DQ8TH34GptznUkSctt8N4kAPc0+aqyfYWu4AmoTwsaB0rF/O+19eecHTUlcljTyKnRmV 5YR5LnDs8AqcVyDzmRdt0740jeIktIfFS2XTFpzgj/PzvoWOH/Gc2F9HXuB/bNe0cMmW 2HBNfETgj/3uFr+i3sRAXUSi+5R+j18CO50P9lccM4Jm3+So9GaYrvhTVem/uOKKXQe0 Bi+A== X-Gm-Message-State: AOAM5338bsq3YMy6pUK+D1kD6YDTK51na6Rp7pY0gMePV+STif5md//X 6Yx4NPUfJyU+4BaZwZYbq9FSfVE8wJ4GaA== X-Received: by 2002:a17:902:be01:b0:15e:fb07:ba85 with SMTP id r1-20020a170902be0100b0015efb07ba85mr6713683pls.85.1652996439331; Thu, 19 May 2022 14:40:39 -0700 (PDT) Received: from [127.0.0.1] (master.gitmailbox.com. [34.83.118.50]) by smtp.gmail.com with ESMTPSA id y15-20020a17090322cf00b0015e8d4eb2d3sm4166080plg.285.2022.05.19.14.40.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2022 14:40:38 -0700 (PDT) From: softworkz X-Google-Original-From: softworkz Message-Id: In-Reply-To: References: Date: Thu, 19 May 2022 21:40:35 +0000 Fcc: Sent MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH v5 1/3] avfilter: use av_fopen_utf8() instead of plain fopen() 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: Martin =?utf-8?q?Storsj=C3=B6?= , softworkz , Tobias Rapp Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: j3UJ+5MR0WTa From: softworkz Unify file access operations by replacing usages of direct calls to posix fopen() to prepare for long filename support on Windows. Signed-off-by: softworkz --- libavfilter/af_firequalizer.c | 2 +- libavfilter/vf_deshake.c | 2 +- libavfilter/vf_psnr.c | 2 +- libavfilter/vf_signature.c | 4 ++-- libavfilter/vf_ssim.c | 2 +- libavfilter/vf_vidstabdetect.c | 2 +- libavfilter/vf_vidstabtransform.c | 2 +- libavfilter/vf_vmafmotion.c | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavfilter/af_firequalizer.c b/libavfilter/af_firequalizer.c index c19a2fe122..e1497dcef0 100644 --- a/libavfilter/af_firequalizer.c +++ b/libavfilter/af_firequalizer.c @@ -604,7 +604,7 @@ static int generate_kernel(AVFilterContext *ctx, const char *gain, const char *g if (ret < 0) return ret; - if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = fopen(s->dumpfile, "w")))) + if (s->dumpfile && (!s->dump_buf || !s->analysis_rdft || !(dump_fp = av_fopen_utf8(s->dumpfile, "w")))) av_log(ctx, AV_LOG_WARNING, "dumping failed.\n"); vars[VAR_CHS] = inlink->ch_layout.nb_channels; diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index 4f28467bb2..dea69e11cd 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -353,7 +353,7 @@ static av_cold int init(AVFilterContext *ctx) } if (deshake->filename) - deshake->fp = fopen(deshake->filename, "w"); + deshake->fp = av_fopen_utf8(deshake->filename, "w"); if (deshake->fp) fwrite("Ori x, Avg x, Fin x, Ori y, Avg y, Fin y, Ori angle, Avg angle, Fin angle, Ori zoom, Avg zoom, Fin zoom\n", 1, 104, deshake->fp); diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index 19852eaa69..09c2a5164a 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -280,7 +280,7 @@ static av_cold int init(AVFilterContext *ctx) if (!strcmp(s->stats_file_str, "-")) { s->stats_file = stdout; } else { - s->stats_file = fopen(s->stats_file_str, "w"); + s->stats_file = av_fopen_utf8(s->stats_file_str, "w"); if (!s->stats_file) { int err = AVERROR(errno); char buf[128]; diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index 4ca57ebf1d..904123fd4e 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -386,7 +386,7 @@ static int xml_export(AVFilterContext *ctx, StreamContext *sc, const char* filen FILE* f; unsigned int pot3[5] = { 3*3*3*3, 3*3*3, 3*3, 3, 1 }; - f = fopen(filename, "w"); + f = av_fopen_utf8(filename, "w"); if (!f) { int err = AVERROR(EINVAL); char buf[128]; @@ -500,7 +500,7 @@ static int binary_export(AVFilterContext *ctx, StreamContext *sc, const char* fi if (!buffer) return AVERROR(ENOMEM); - f = fopen(filename, "wb"); + f = av_fopen_utf8(filename, "wb"); if (!f) { int err = AVERROR(EINVAL); char buf[128]; diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index 32f313817d..4a82cbec06 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -404,7 +404,7 @@ static av_cold int init(AVFilterContext *ctx) if (!strcmp(s->stats_file_str, "-")) { s->stats_file = stdout; } else { - s->stats_file = fopen(s->stats_file_str, "w"); + s->stats_file = av_fopen_utf8(s->stats_file_str, "w"); if (!s->stats_file) { int err = AVERROR(errno); char buf[128]; diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c index 267a62ea9b..4acae5a3ea 100644 --- a/libavfilter/vf_vidstabdetect.c +++ b/libavfilter/vf_vidstabdetect.c @@ -126,7 +126,7 @@ static int config_input(AVFilterLink *inlink) av_log(ctx, AV_LOG_INFO, " show = %d\n", s->conf.show); av_log(ctx, AV_LOG_INFO, " result = %s\n", s->result); - s->f = fopen(s->result, "w"); + s->f = av_fopen_utf8(s->result, "w"); if (s->f == NULL) { av_log(ctx, AV_LOG_ERROR, "cannot open transform file %s\n", s->result); return AVERROR(EINVAL); diff --git a/libavfilter/vf_vidstabtransform.c b/libavfilter/vf_vidstabtransform.c index 4619e9b256..17214f039f 100644 --- a/libavfilter/vf_vidstabtransform.c +++ b/libavfilter/vf_vidstabtransform.c @@ -191,7 +191,7 @@ static int config_input(AVFilterLink *inlink) av_log(ctx, AV_LOG_INFO, " zoomspeed = %g\n", tc->conf.zoomSpeed); av_log(ctx, AV_LOG_INFO, " interpol = %s\n", getInterpolationTypeName(tc->conf.interpolType)); - f = fopen(tc->input, "r"); + f = av_fopen_utf8(tc->input, "r"); if (!f) { int ret = AVERROR(errno); av_log(ctx, AV_LOG_ERROR, "cannot open input file %s\n", tc->input); diff --git a/libavfilter/vf_vmafmotion.c b/libavfilter/vf_vmafmotion.c index 8b7e9b17ef..2ac67e5935 100644 --- a/libavfilter/vf_vmafmotion.c +++ b/libavfilter/vf_vmafmotion.c @@ -312,7 +312,7 @@ static av_cold int init(AVFilterContext *ctx) if (!strcmp(s->stats_file_str, "-")) { s->stats_file = stdout; } else { - s->stats_file = fopen(s->stats_file_str, "w"); + s->stats_file = av_fopen_utf8(s->stats_file_str, "w"); if (!s->stats_file) { int err = AVERROR(errno); char buf[128];