From patchwork Wed Dec 13 13:12:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Haas X-Patchwork-Id: 45104 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:1225:b0:181:818d:5e7f with SMTP id v37csp4263952pzf; Wed, 13 Dec 2023 05:16:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxNUFjwKbUUON+K54EByM7Grw7HAyuOfdgYTC8fDAM1rAjfBLvNzCFyrvFt2425d/TzDt6 X-Received: by 2002:a17:906:1083:b0:a19:a19b:5608 with SMTP id u3-20020a170906108300b00a19a19b5608mr4185106eju.152.1702473418616; Wed, 13 Dec 2023 05:16:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702473418; cv=none; d=google.com; s=arc-20160816; b=MzEr4RpYs//I2N0ICDxgyLOx57+bMj2uNgiOZJJyvcxrfwChkV2lkW5NwAZlc9OAZw Zylis+AvfoM2AFDi1w0ftridCARekHXfuy0p+M5xVLcht3sN3+8ZMY1Mc1XDs63Tu4Xs PbXZ4j3lqee2FgyFjP26GgJjI5E1r+XgwHMei38Wn0poyJN/9Tzg52lBC6CPp88jHKQ9 PBvM4e7uX8cywyXTY/FmcqcBfYv3nkybKTfkCrmTwYzQ8civiikY/c5Q3wQ0sMdlMxPK gvbR9xc4kjKAuEvlwS4ZgtIryAO20oOWqk/yjgBt+ydmM36hB0XNoz+wRXZfYPuKCI8l POgA== 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:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=PIJf1WphmT1np+7piGH4qziOpBGRlzaBcLr8d4xQAYc=; fh=xmAeKtysnShNOmkhiJmYkS30uw4Fu2hvBJ7qlIwukxQ=; b=m6ZIeKcrQG2uTTPEPFEDSN8Y/uFfwMf7+4Fgnwe6+e8Z23JZsc5x346LMYPWW/cnym oTw018E407z+TdzLZntF+8o6Rm4nCFbFOAKHEOsxYPSTY9eBv6Qh3vPkSP2Ojb4vitTF 013RkjvHdpaTK+ZIMoCWUVUoUL4B/uebQSdzitKm7fXg6+EwpLEEfsiZk5KTecCcfk2V iD/lNK0ZD849pnLlFAsMXm0REdvYr1Lcf47kYgLestOoc90+SDUP8uX6K1nOmkJ+vSgS 9ciqjXjbQiGmLYCIlVkphYZynikN7AtY6b90UveF7IXXjKI145gnveMXmmvYs9IEPJXJ 56+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@haasn.xyz header.s=mail header.b=Aa7UsMng; 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 h14-20020a170906110e00b00a1d9d1e09f1si5475491eja.214.2023.12.13.05.16.56; Wed, 13 Dec 2023 05:16:58 -0800 (PST) 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=@haasn.xyz header.s=mail header.b=Aa7UsMng; 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 EBB4068D20F; Wed, 13 Dec 2023 15:15:53 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6399C68D15D for ; Wed, 13 Dec 2023 15:15:45 +0200 (EET) Received: from haasn.dev (unknown [10.30.0.2]) by haasn.dev (Postfix) with ESMTP id 8C65D4BD4E; Wed, 13 Dec 2023 14:15:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=haasn.xyz; s=mail; t=1702473343; bh=qaCUdr5buc4kX5IRj+lzXx8mSumZsYx6RYwzMJNLDIk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Aa7UsMngMLM5XdwB8NGvH0T1vv+cnr3fPRed4FTCeOeiYOA0eGaRak8vNDfNhE0SH dqxeDMTFBEdZYzyK0wztLVwieIMMpvsZf8tnp+piMIo0+x3TbwE/8JFoqD/GtSrZB9 1lA/Ggp+BZpshkKP0laO4tPKauO5QywAXn3kBKhQ= From: Niklas Haas To: ffmpeg-devel@ffmpeg.org Date: Wed, 13 Dec 2023 14:12:12 +0100 Message-ID: <20231213131536.10242-16-ffmpeg@haasn.xyz> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213131536.10242-1-ffmpeg@haasn.xyz> References: <20231213131536.10242-1-ffmpeg@haasn.xyz> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 15/15] avfilter/vf_format: allow empty pix_fmts list 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: Niklas Haas Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: xaOyiAU26Grl From: Niklas Haas Which will impose no restriction. This makes sense when using e.g. `color_ranges=pc` to limit the color range, without also limiting the pixel format. --- libavfilter/vf_format.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index d1bb9daa97..3a353bbb0d 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -91,11 +91,6 @@ static av_cold int init(AVFilterContext *ctx) enum AVPixelFormat pix_fmt; int ret; - if (!s->pix_fmts) { - av_log(ctx, AV_LOG_ERROR, "Empty output format string.\n"); - return AVERROR(EINVAL); - } - for (char *sep, *cur = s->pix_fmts; cur; cur = sep) { sep = strchr(cur, '|'); if (sep && *sep) @@ -131,7 +126,7 @@ static av_cold int init(AVFilterContext *ctx) } /* hold on to a ref for the lifetime of the filter */ - if ((ret = ff_formats_ref(s->formats, &s->formats)) < 0 || + if (s->formats && (ret = ff_formats_ref(s->formats, &s->formats)) < 0 || s->color_spaces && (ret = ff_formats_ref(s->color_spaces, &s->color_spaces)) < 0 || s->color_ranges && (ret = ff_formats_ref(s->color_ranges, &s->color_ranges)) < 0) return ret; @@ -144,7 +139,7 @@ static int query_formats(AVFilterContext *ctx) FormatContext *s = ctx->priv; int ret; - if ((ret = ff_set_common_formats(ctx, s->formats)) < 0 || + if (s->formats && (ret = ff_set_common_formats(ctx, s->formats)) < 0 || s->color_spaces && (ret = ff_set_common_color_spaces(ctx, s->color_spaces)) < 0 || s->color_ranges && (ret = ff_set_common_color_ranges(ctx, s->color_ranges)) < 0) return ret;