From patchwork Mon Sep 13 23:23:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30235 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp4467357iov; Mon, 13 Sep 2021 16:25:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5F6ExWHJD12zgd6K6FgOHmvDmQSZ/7RYVFvdZfShMdDH+dSFlvgol6PvBW7HiqF7rDBO4 X-Received: by 2002:a05:6402:5:: with SMTP id d5mr15957632edu.359.1631575547367; Mon, 13 Sep 2021 16:25:47 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bm16si4246633edb.317.2021.09.13.16.25.47; Mon, 13 Sep 2021 16:25:47 -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=@outlook.com header.s=selector1 header.b=iy4l5GpF; arc=fail (body hash mismatch); 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=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 50A2C68AF1C; Tue, 14 Sep 2021 02:24:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071089.outbound.protection.outlook.com [40.92.71.89]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3BC6168AEFF for ; Tue, 14 Sep 2021 02:24:40 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ns6BK6r1eJ1BzaQVaYh8U0LKUjZZppwsqsDqqjnPlhzenzqMEn+rFp08V7zbfwh8BcIdt2aFuTdWl3xObUfL99ai9ChlgJeWnTvmp7FU+JpEofka6t3oaxvcYIYx+GJtaVS+jGJKJsJu/bU5gbnpdCicuK6WYZb3bq8NDxHbtnFx6XRNMCt7t9te0hcdOLH12tUsRfOomw6lb0wbazsuhFbvMd+bqqe8f/0rS3dJywkSjwf2Y/YaCSFSw2Ebtv+2cWeJfiHNakXEVlauAaGZgfOOZs2O6F5VEMCKW0OrTL5gkZPpwYi0KDIxw0tL0lXG2ROCmbSBNVX8e8PqERTyUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Wz60DlJ/5npm3t1PRCOF3nmngegG7yakdcEtJcsNdNc=; b=AmzOSTa8etBG0nxNotDzgGvQFlVJ0O1hlGO0KazBT2p51zppNkskN/yIYFAPmr11KwFTFkxfHT6afu5ixgGpuifPgpZzqXp+CKiwYYMlGtX3tbKZ7kwQYQbkMdOo7jrYz/k3RvlIrPRfAsrRzQfAv7vgVeFXo+OshvX7tp6o27xD2Gj7DnnH8uZCGp/ac0VDzves7rFDMcGH23K8+0a2CI5ZWaTZgP/9IeeyTthgI2WqCTX2bHTpDvOs81KzTyWU1VX6mDKvLBqZyiZEeOeKaC3SdKk5AXDkJ8Eqnf69RkW/NCIyKM+icwbZe2DCzzt/FG8sMqlcoVsAR+MA3ZyMPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wz60DlJ/5npm3t1PRCOF3nmngegG7yakdcEtJcsNdNc=; b=iy4l5GpFbHHstF8T7niTe3/IecOEDrOc3YQJxZWr1dO0DscazAAaN7UaPZbjLOhCX4eer0gzxLpm0ugNPKGvF+6qljK9p2iycvBxapYxLB7CQ9PpO5C4xANbZ75lO2/jSKve5IY1fpLJS3QOF9Gp0P8ra0g7VU/vXM9fP6zsN51u4q5DA7Ihv1KLu9GSurw/rc79SY98dSIR9aR0alJspS+LjlX+YKdLIi7YM+2xRQ1UjtGckVWMOS1P5eoeXlIlI4a9Dr73+Qsz0Q71gkjIej5+TX570B4Q77EPFZTsq+wdLWc/N9A45+ckEUdsl3FOR+8vTpRACohRoHOM+pvpTg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4216.eurprd03.prod.outlook.com (2603:10a6:20b:d::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.18; Mon, 13 Sep 2021 23:24:39 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::787b:2156:ca99:fe00%4]) with mapi id 15.20.4500.019; Mon, 13 Sep 2021 23:24:39 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 14 Sep 2021 01:23:38 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [0oTZ2lobjf6bVOsvfuIp/IO4UCHX51Hp] X-ClientProxiedBy: AM4P190CA0008.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::18) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210913232339.3115725-12-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM4P190CA0008.EURP190.PROD.OUTLOOK.COM (2603:10a6:200:56::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 23:24:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 029ea761-393e-4dda-5619-08d9770da897 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSwGI4buAwfZe0futHLJHOz2hSX1kfQucMpsP1qP52xGAYI41QZ+We9XsLcxtj4WtmVDnT6rdLoDKwhCXjLDbEgI4CEtEtA3wpRcJLAfRJbEyTOHYW/lsogctFsZ0nP5IX55oWoHDjDjw7/u92a0HeMWlbNJCeNlcrKy/+9vhJiDVIIiJVzmUwMtem0QguBifA930HSRU242bixIR4mcFpLN03zByVqw/OKuBVoOU49c/W3/7ZUEm7JaTAuM9wCPq6btq9TW5be+GTomuLL5SWTGcKMLZulJd2urMuAD7IrpSBpAUlcG4EwsziETEhKGzSeysAZOKwVG8at4JIkpuGKtDvpg7W01BX2wmuP3+AbDPydUkWziKHjkcJ1Hwi8EzC28iNTmE6c8IzO03/AheOBkuUZnKCJObweILQurPyMIaZV+hWGM73rYiXuV/omEQL8j6cP3x3YLYj0D4U8ks0uV/0jxcxnmCpHgzGYTwhe6qoIAUHZV18w9HmRlar0ROAGM1DgWpk8Cba0CS+C0DBljQKmI6asqKTqJULW0kAPRsL0sgeCXd4X4xIXT/yy2fnQZieHrUWAjJIgSrieu+L4vXSNjoWKIuUdslpbYKxGPclMIf8oxBFjPisBHC6HR8110gOYPZBF97uiLV0NHxA3nrDpYrpuSN+6jkh+RTXBb1ndwNh7QRFgOTwjhRYU1Ug3LfyC5eEMsvPrRi6VFEY/77DGdCY1fczaNQ9dXfx4PlASfRkG+REc1XpSnZpdrCo= X-MS-TrafficTypeDiagnostic: AM6PR03MB4216: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DyPReMT2YxXgWbsjeA8u40T7BPsRigj7HN+vkO83uVj78hC1TZAGhN4/9OFMrR1sGjTfCPbRI6NKZbI9VJMTK3qVw4vfxXRjZtXfHhVMaUgsJdeBOlyAvq1577MwFkvkTf315v67vW8Ld8AwGDw/QRxrMJw0fBXcW7GFN9mTCxtOg2eJ92z7/uKFWc+Eg762GDz/Eq6NeCQ1Jtdvx+JZVaDGjQ4eqTLqbuig79vgrEXCHWro6auYcu63Qtd/uq+jY9WgKIcYCW4jV5BfxKJKMRb2Y8mWecNzwDi2OAqqLIEyYDZ1wXNxK9SnNQXlBNgvEE7iebzYvhUQwgrfwa4UmEbhnQu6+/UNXEm7+GkLb/5P8dzt08WbDS1gYtfDz0oJN4h/4hzo6vvw0sYw49aTWt3SER6vuURIJif/8/DSph2UZ6ZEYSKucauurYBfIEB4 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1aO+8gWFtBGchsNS2BOkPAaayfI5LgGBE8YMbSQ69C5bQXqwQwbyc7qYQD/gyXufXOLDI0m3WzqOoRC2caEVCsGy+7yRUVtpXfHQMRErse1WydmEZMjBkienfAFt4MrxMc3k7LOjgcjSW69RAIt5PQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 029ea761-393e-4dda-5619-08d9770da897 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 23:24:39.8258 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4216 Subject: [FFmpeg-devel] [PATCH v2 13/14] avfilter/avfilter: Don't fail upon options for filter without AVClass 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 7NLxCA2meAeq Commit 62549f9655c48f0ec061087fa33a96040ce01145 added a check to (the predecessor of) avfilter_init_str() to error out if options were provided to a filter without options (or rather, without private class). This was fine at the time, yet soon afterwards commit fdd93eabfb2644f541f7aac9943abce26776ea73 added a generic option for all AVFilterContexts and since then it is wrong to error out in case options have been provided to a filter without AVClass. To workaround this issue, several filters with timeline support added AVClasses and empty options; these will be removed in subsequent commits. Furthermore, the super2xsai filter supports slice threading, but no options and so has no AVClass, making it impossible to set the number of threads when using avfilter_init_str() (and therefore from the ffmpeg-tool). This is fixed by this commit, too. Signed-off-by: Andreas Rheinhardt --- Now with a comment explaining the two functions of checking for priv. libavfilter/avfilter.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 165ab1f44a..4971ad9d9f 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -825,6 +825,9 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, const char *shorthand = NULL; int flags = AV_DICT_DONT_STRDUP_VAL; + /* Besides ensuring that shorthand options after long options + * are rejected checking for priv also ensures that we don't call + * av_opt_next when ctx->priv is not AVOpt-enabled. */ if (priv && (o = av_opt_next(ctx->priv, o))) { if (o->type == AV_OPT_TYPE_CONST || o->offset == offset) continue; @@ -922,12 +925,6 @@ int avfilter_init_str(AVFilterContext *filter, const char *args) int ret = 0; if (args && *args) { - if (!filter->filter->priv_class) { - av_log(filter, AV_LOG_ERROR, "This filter does not take any " - "options, but options were provided: %s.\n", args); - return AVERROR(EINVAL); - } - ret = process_options(filter, &options, args); if (ret < 0) goto fail;