From patchwork Sat Jul 23 14:09:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 36902 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp1046607pzb; Sat, 23 Jul 2022 07:10:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uoUpAt9fBl0UIKEG2z37zQBGab/Gvy/ZPe0vgqA/qFvso7Bm58PJPsJZsPOhoLFeBcMGbw X-Received: by 2002:a17:907:e91:b0:72f:d76:b22c with SMTP id ho17-20020a1709070e9100b0072f0d76b22cmr3495011ejc.364.1658585450124; Sat, 23 Jul 2022 07:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658585450; cv=none; d=google.com; s=arc-20160816; b=KWDMZ8va7NbGsTcKZTVyYBNwNd6GE83W0o3eiFFavnrJxa8F6BQY4yFrQRXTyrUU3t 5mWxblasO2SwKs1kCuj1tfaWH98QfHQ0ILn/H5xg2pERV7upfzY5icqUbKvH83IndZFj aHh1+MBiN3SnBEiLTNs2AzJ722ARmOxfPqCS3TF5OnNJkdzaYtatWngw8l8uxjmvYJ5L gxTAV8TN1X+N+ysj70Wlt/mEQB2tMxrae5D9QyUbhzFQUv9RYc58ynXU5LvJ/Kc+spyJ 2Ih9VK3Tb0lAHFUr5aXHEfaRTwCytOCHFM7Q/15hzJbSpQnbhEu3NALuXmxGqfHuoUyr VCGA== 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:delivered-to; bh=mVaiVa1ZGRaMicwczujfpXxb3Zaw1DxoLbprIzSi/8Y=; b=uOrd3TMaQgaRDy4MFHS2zS4TYNnpS4oWrB5i3dkLsxzBNwuw+gvFJQsnBcbiOV+37c EM3mDZ2i5BOFfbCroBoJdpAIxodyIYPifDfF1/a1gTpLmjhT/gZrUThO1UsulCtQXOog IWEt94Hypv13J+g5UwB7x9RdqCza7idwyxSoxRl6gqPC9kHQQjZJWEjQoD1wnQ/A63cu QCFj570PcQAfwsshpO2T7nfgsV8uqeRJ8r84m7/r8sfBRJTRb3PgCeDAczdAF1l+bpxY +ayb4vfx9A/P6r9ZsQ/96qOYXWpvkQXsw18xI/7XaN/Cco1lSP5UOytFWGdq/3WitR1s ARsg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y13-20020a056402270d00b0043bb67ba75fsi9668094edd.489.2022.07.23.07.10.49; Sat, 23 Jul 2022 07:10:50 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C958168B1F1; Sat, 23 Jul 2022 17:10:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 25FFC68B704 for ; Sat, 23 Jul 2022 17:10:22 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 9DC2F240179 for ; Sat, 23 Jul 2022 16:10:21 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id VGV5-QJ5OhIP for ; Sat, 23 Jul 2022 16:10:21 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 63A8624017E for ; Sat, 23 Jul 2022 16:10:19 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 637443A03EF; Sat, 23 Jul 2022 16:10:19 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 23 Jul 2022 16:09:30 +0200 Message-Id: <20220723140952.31814-5-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220723140952.31814-1-anton@khirnov.net> References: <20220723140952.31814-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/27] fftools/ffmpeg_filter: do not pass the entire AVCodecContext to choose_pixel_fmt() 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: xQRkklSQ99iX It only uses strict_std_compliance, so pass just that value. Makes it more clear what fields are accessed. --- fftools/ffmpeg_filter.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index f16f4b13b1..f715ecb6b6 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -52,8 +52,9 @@ static const enum AVPixelFormat *get_compliance_normal_pix_fmts(const AVCodec *c } } -static enum AVPixelFormat choose_pixel_fmt(AVCodecContext *enc_ctx, - const AVCodec *codec, enum AVPixelFormat target) +static enum AVPixelFormat +choose_pixel_fmt(const AVCodec *codec, enum AVPixelFormat target, + int strict_std_compliance) { if (codec && codec->pix_fmts) { const enum AVPixelFormat *p = codec->pix_fmts; @@ -62,7 +63,7 @@ static enum AVPixelFormat choose_pixel_fmt(AVCodecContext *enc_ctx, int has_alpha = desc ? desc->nb_components % 2 == 0 : 0; enum AVPixelFormat best= AV_PIX_FMT_NONE; - if (enc_ctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) { + if (strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL) { p = get_compliance_normal_pix_fmts(codec, p); } for (; *p != AV_PIX_FMT_NONE; p++) { @@ -102,7 +103,8 @@ static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint) return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt); } if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) { - return av_get_pix_fmt_name(choose_pixel_fmt(ost->enc_ctx, ost->enc, ost->enc_ctx->pix_fmt)); + return av_get_pix_fmt_name(choose_pixel_fmt(ost->enc, ost->enc_ctx->pix_fmt, + ost->enc_ctx->strict_std_compliance)); } else if (ost->enc && ost->enc->pix_fmts) { const enum AVPixelFormat *p;