From patchwork Wed Sep 15 17:10:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30258 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp474504iov; Wed, 15 Sep 2021 10:11:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrT8S11SkD/cQPHfanGT3L86QSrt+TUlQaP5Pgbv0GVgSSBINuhFrLGOht5I3Bi4ZtKENg X-Received: by 2002:a17:906:1299:: with SMTP id k25mr1070446ejb.139.1631725878319; Wed, 15 Sep 2021 10:11:18 -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 h15si583601ejj.98.2021.09.15.10.11.17; Wed, 15 Sep 2021 10:11:18 -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="bp/US4Dg"; 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 EC8A168AF99; Wed, 15 Sep 2021 20:11:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075107.outbound.protection.outlook.com [40.92.75.107]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2DAD068AD2A for ; Wed, 15 Sep 2021 20:11:06 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GFSxPikKfPDlDSOV7D0mZLLlXaKr1IR7eRtrxJLkCedsXYrgvhTrJ4PX4Xi1tdTD6zgBZUOQo4M4oQua2CduWc/rCi+qm+Qz3x5QxQqUR+hv2g7fU1z3uyz5m3sCFnm7aFmC0+/4Cj5PxjDzPyde2a6I+omScqObf4lDEUl+JNa1YlL8FarBA4pvLihlGjvI3bO0pznhPFqFTdybWlhueFp/LeT3Qx+WN201DTTCveqqkCoKoCv7xkj9+5WBhtGvrqQ8AySJ2nT1L3SU/fHRia34Vj4gr0oKGb4gT765hBJyMwuNRQ/SRNBsdx2aP9rJS6ybq7Smjji3/VNEkUWP1Q== 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=ISmMGz3xbq9CMPeR8cF4LlfobmmfuxbJj9/AUAk6je8=; b=WjA8rtTtVdTnSy2cPqq9XCd7K2bAevJApgTD47CE81+Oee6wQBZC+N+wyO5BkiFoyxPuMGh8IazbOxlHOBYow6w1rmhPnhpLRTz4MJ9QfN/Rjmx6Yv+zs2TvNKPn8kJRLKM+hkEZGb64bFkapH0g4IAbp83nRUBCxhp4wTg1XR1ZSvQ92CzMfsi+6MmoPqW5no/F8aApIMP1BhXECYDVXDf3S1caA5v7u/37/M2d5SMtn4O1WtLZsggBcFM+TtX6n+ua9xojUfw+XRXFmXZtNhiyKIYdx1mJK+WN4iafd8KHbb2zwT96YwMQ8wgkbKe+41RkWWBrA+I4ClRNf1ezxg== 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=ISmMGz3xbq9CMPeR8cF4LlfobmmfuxbJj9/AUAk6je8=; b=bp/US4DgPwWzRVzJP2dKwZaAroKX5iRPa1vvo4m6FYGz1FSWwILTkugCthRCduqg5xpT82eLc5Op9/ccaWCwieNHLUg2/5/+NyYVhKsFd9LdfCpO0N6tpCzNZ6RJuXJLsNZSXOkot5IxIFV3GEAHvtf+eR0J+AgzZHsmdsB6VOVePFlLTuPr4w/mtl6aVAfXb8x2KZ5eADCaRvJ3m9b8FtRmWpITn1lQf5nJuemO915Wsg5ZdHVyidl8v6kf9S0hpKoo58QV4lSUYqqQTnkx9kaDBktYJTAL7pJU9SMu/+rZXuoDTgVGEvgVwmtccA5aTTYy7DcDTgWXEOqbmFPN1w== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB5251.eurprd03.prod.outlook.com (2603:10a6:20b:c1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.17; Wed, 15 Sep 2021 17:11:03 +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; Wed, 15 Sep 2021 17:11:03 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Sep 2021 19:10:51 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [kDApn0PuORvQrboJUl43H5om7iwsqWyW] X-ClientProxiedBy: AM0PR10CA0061.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::14) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210915171055.4090552-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR10CA0061.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 17:11:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ebc1bb5-c765-4123-b0ef-08d9786bcc1d X-MS-Exchange-SLBlob-MailProps: EpEO96k6WokGvwIxdby95+//ygP2I9bmKJAaGeegW3e3gDRA65Pue0CG2nzljWDQKP+z47e4ncpXJDxUhwx53SadzbYcAXAWZybHQbG07UlXI29WAz+mu9PAVMC8iOiIkW4UEQrIvRTCQ8K65UU0/bDOElq64bORcgK4JIxVDn42SwMEtr0gNyJudx/gIDP7CiMvN4rPwamdoY8Pl35f3kIqtMZnfkVCeafTWBYeuNnLbP40fBMNcEvxG667wLxL9riEgmbIHZZUI16AeGX4NJi/vZtagBd5YS1KuoSa+dqu2Nn77YXjmBNwdMY9CSC3J4XR35tatfvJP3mshkEJ4StdBoSnLnPxq4YThjh6gYLiM7Dz9cCTPFwtw6RR0enSTocn9k8YyzQFr4WXkKS+v13gW1Qrtz/cGw7YLlAXwHyWTn2UL4ASykDIi8FSnFzgeKNi7XNoYJhaexePmXLQ6vkxZ5zCQTesKLU9dThQCcS+l0BAm50kUfYRlWlv5j8ZziPzZ/gyvs8rBKmODkdXAf+J6PBkSv53Ygaqd//F++Q6+lm1n9lN/ZCQ7GxB7NbsaGvqotcku5pFHRQWMYpsl9nWeTdUN9BzyD9W8uVHK3JNFyLHNTuwpgxICRep8QRp1zBC6YBO9KS9uwEw5RRhEAFfEqv4kylC35srijUWpOLfMtNSi1WoybSKFwws7XIVl0il8Ph3rjeUIG28tLsVwZvpmI8+mzjSSNDmnD3FVqNfkK0RTcy0hDe1UIOGLyGS8NETTrx6h/U= X-MS-TrafficTypeDiagnostic: AM6PR03MB5251: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mLBCKGIXw35Uv5paZxoNxMVgPI8qYDGXV/qmD5B1k6QwczKBjlR8bqiWKh165QsbzJCDLxHhhSUZdZ8l/M52JiM8VrO78rm6Q+Va1WUiQxRmj8MDHe2TKIGp4Y6CsEvhZSBBDXoPS6TPysL/GsnXir1cvCLZ/m+rYYIc2kwci3b2tgVJZ6V8K4heVEQFbQbo8cUZxiFa8pNhSASiD6jOIhfnqgFq9lOQCl1EmVz6mX3qTRHcdW5LXbTnleQqmkL3BE2guolEn9Wk4iWNVYH5QpecIrkzrPmyyDzDrNZqH2/rlHwhsWrQGZ24EQSkpeIHdcW37bPWWstge7WWsxoUeBICCL2HFZ1SRXAvyfwhYvJW4i3YFitr5MjPBWacWBpwO7Edf6F5/8D8vYnaZO6aNTX/poPH5qBvMo/9jAm8j7uVyW9m0YwqVsAYyhfXIuBL X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MNsIZWmDHpofO4nbOGLbX8o9qDS06n/6cBX7/p1eQyUN90ONdo6wo6H2SUCLbw+FHvcRx95EgMDdyD62ZHWXxo6MQeICE2UgBpTOfjgjb3HH3QZJsGNuYz6Kg5V9h7+bOhAUoXeRWSWotf5Hp2P4Jw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ebc1bb5-c765-4123-b0ef-08d9786bcc1d X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 17:11:03.6762 (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: AM6PR03MB5251 Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/avcodec: Set options only once via AV_OPT_SEARCH_CHILDREN 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: sBd46vYFdWtp For codecs with a private class the options are currently first applied to the private context after which the remaining options are applied to the AVCodecContext. This can be done in one step with av_opt_set_dict2() and the AV_OPT_SEARCH_CHILDREN flag. Doing so preserves the current order of applying options (namely children, i.e. private contexts, first), which is important for those decoders that have a "lowres" option of their own (distinct from the generic option). Doing this also avoids (re)allocations: Up until now, for a codec with private class, generic options are not found in the first av_opt_set_dict() call and are therefore put into a new AVDictionary. Signed-off-by: Andreas Rheinhardt --- libavcodec/avcodec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index 2dd7dd84e0..d806fab393 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -205,12 +205,10 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code av_opt_set_defaults(avctx->priv_data); } } - if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, options)) < 0) - goto free_and_end; } else { avctx->priv_data = NULL; } - if ((ret = av_opt_set_dict(avctx, options)) < 0) + if ((ret = av_opt_set_dict2(avctx, options, AV_OPT_SEARCH_CHILDREN)) < 0) goto free_and_end; if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) { From patchwork Wed Sep 15 17:22:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30260 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp484449iov; Wed, 15 Sep 2021 10:23:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ70lSbkiBCXDa6HuS6kGA/CG/1sqW8nYmTmW1c1y8kQRLcKQ24mVrDmVesxGzbMXESKnA X-Received: by 2002:a17:906:9401:: with SMTP id q1mr1146169ejx.313.1631726598403; Wed, 15 Sep 2021 10:23:18 -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 g8si476936edq.535.2021.09.15.10.23.17; Wed, 15 Sep 2021 10:23:18 -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=W636ya0Q; 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 02D3568AFB1; Wed, 15 Sep 2021 20:23:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2013.outbound.protection.outlook.com [40.92.90.13]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 326A468AE51 for ; Wed, 15 Sep 2021 20:23:07 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZC0j6yOq3K2BNKVGxCYyCjLW2z+MVVZNuCT+qxeDfC3zoDGco1TK/VixXuepF9vMzGl98SMTo000/p1NqoYkAxDb51Lok0yFGSWO1oJqz+bpWejEZwB8O2Ig8AQEvAtKXBdo17pnx8CdX0rk6FwTI9/iksAQiXdkN6mCRWdGnA/V4rNxZc0DWbtPpB2luOwadrRrlx4xnPE/GntU8uRIzc0MrdbdiYvn1j+7jc9B+uuizs26m5I2YBBOc5IxcvP9ngf934UUshiCQ6j4b5uvNV1pkbjEZ9G//Hwnb8K2yD7Ak5jGXPx6OKy8cnp1/h7eKDqAXpJOLJzHEN040BeCOA== 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=r5TdglbS3HKr+CloMVdoaBhGFxYmyZqnI3/arIacg50=; b=Bt9ZTJwlKok904XORlyDnFRvd5lEOr59AHhF0lu/lFZZ8C0OXCYineFryLHedKqfs2hF5jyhGI9dZ9Fy/CIqnPfV7raKUJ5p+EE3C7Z1u8sQpzgKl387hh2A7vbLIJCYxXWvgPfdJlRRJRqKV9IIZkMZJWrSks5yh3yVk2kyNRXtpFg4AHDGJIBqMuC1CN24lrbejfn9yo2PZ3SUBupcdNdbZ0iWUFBlqyMhRKs5U5SJ4yVrr2lUsiFIcrfS1lqJBPC5ORVx4tsxxFuUUg5OWk2Zo04FoG9046ndW8B5eaawEar8s1Yq61ymjAe9JxyKtfOWozqKE727xywF7PHfOQ== 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=r5TdglbS3HKr+CloMVdoaBhGFxYmyZqnI3/arIacg50=; b=W636ya0QijLZhpZuj0HiNbDRyKizAijRI1OnO1DrpgqxrLWgD7MzR9lQvx5bBfSxK7v1afuoUsOggOw7Lz087Q4a4XntUOoIjoFCEiLV29IVJfe9yxpIwWE3o0W77eAySvHhbG+YdZAc0l9rHn22Zba/Elfj1kRnAeoP3+YMDFFnZISqD/6JQG4GFbEJVpRHeVi4wWQxC/W5m1XYzDXvtQOovz/Q4/5IZZsErj2XsqmZ6dkDvaOqsrBsJFmgMXXgn9/21WSqyHK9ORKdif4/Sc7apKLdyktdpOveb4IKqMz4dgUqSN5Q2YHXfapkaz2AGkI6fMcYi/hfUYBhZRFu3A== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3957.eurprd03.prod.outlook.com (2603:10a6:20b:15::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Wed, 15 Sep 2021 17:23:05 +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; Wed, 15 Sep 2021 17:23:05 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Sep 2021 19:22:54 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [+BIAmRtQKhj23sdLwP7v8Xr5WgtJWZZv] X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210915172257.4090685-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 17:23:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1e1d4f44-dd67-43cc-62f3-08d9786d7a89 X-MS-Exchange-SLBlob-MailProps: f36zkjAOy3X3eVjtKbgI22CZAXZ3l2idOKqUB6F4emxIu+vZXa/fNT8yXU8/uXQhhtG2JyShyWBxea2ZXhc6dmB5DYd7J32FIVt0Mz5Imuv9XSj8h7a2cuPWJXTNDGXClWreBf2MgB2KLh8qhpBH8a63WlB2PsJYfSZBMDeB4W0BRok8UlcaW1CIPpAf6khmQsAMzEJ/Op/JTbM1m/Dxst5KKlrR54IZaAbSrOR6EUF726Y6NqZdQ59ejdLZ/JdV0bZwiM0ubeiB0QTnV+/7vIUyhuPgZEyouQIIEMYYRbhkJZU2rKhA9/+ivTkzZxp1MhxNMN3TTOfQOyg2Y2tuCveYxxAmNf0xGsKl56IOWOGKTw3rlc5sqZp9yh1XzjWpAL2Wov1FMDjTBWrOmAjZAO/h54iM3dsjAkw/IEAIIk/BKmvld3iC8Bt+1Ef01PPpDhGGCIUkUwjbuNB/glR4wTPRgvG+6ofZWrpfK4YQmlCePmXEK02rXbjM62PAgdT5HBIrxd4yZzwjdwSg+wB2lN6fJw2AIC82m4a+Gz+r0fNeRJs1LGtdGvYkf7WAVXUZhj/wZ+SQzTdfAOL8RZKFPjHxwAnP7erSeSUPZzgK1mdWEjl6HiWIV26JwX9xpzcQm5nxBvVpyQoJJ80Y6HvyTm3EpeLrff/jvMadNl9ZHLKDK2/hb6uokGFIj2FP1GVblPP93ICHDrPwIdQi9d5IMXTQPt0W+vwV+1sbPHieFXw= X-MS-TrafficTypeDiagnostic: AM6PR03MB3957: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J0Oy9eLBa9yoi8MLFaNj5sOa12vtXCNJ+ujiLz5FIV/3+bnIgIFEFfieV0PeJDErBUFU4ceUKvT6KQbiuoXfZF29D/MBdWsqZ254kwYMq68aTE3xj/0FyEAviIiTT21nwD9ar1VQ2fUpo064aOjR9qnPGfk4GgGZjBye7E0ubvDMAu6mrU1uk4brxH6KkDYXOqiqRCA+acjl3OLafbn4ZF3kN8OKfltX6TjfUInaGNKS154Psjh50ddP7Xs8BwSwS9poel6Pg4MdUbYQeLk5nOEjX4UySkX9zyle9L8ccgzWRJ7CXrNmlEGXmCZO00fP4vhly7CQsKoSsza5RmDdXNmqkAv7GT8IPDLXdAb6y3zn8+JQrAJdAGcBBfFTGAtBlmtTTHETM6z2HedwnGx/Un6SO6D8gscWMc0yCcMd0BMn7xPzAPkBFonxFeSVFCm0 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TP8i/vqyiwUS8g9JOpDWSuTqjNdO6iGaZ+bFlbXLX0q1M8kgUvTGohVf6X9YPUWCaBc1etfLoDLpjzgQE5j1olw8E0JRUuRoJ9qxlVEG3T/Ft1sJ/JT6ZJxD+Gu8mySXvQckuWJzftnkz3j5sJ7emw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e1d4f44-dd67-43cc-62f3-08d9786d7a89 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 17:23:05.4617 (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: AM6PR03MB3957 Subject: [FFmpeg-devel] [PATCH 2/5] avfilter/avfilter: Actually error out on init error 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: vLDbKybxTTbv Currently an error from init could be overwritten by successfully setting the enable expression. Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c614eb0740..ce63b9762f 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -924,6 +924,8 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) ret = ctx->filter->init(ctx); else if (ctx->filter->init_dict) ret = ctx->filter->init_dict(ctx, options); + if (ret < 0) + return ret; if (ctx->enable_str) { ret = set_enable_expr(ctx, ctx->enable_str); @@ -931,7 +933,7 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) return ret; } - return ret; + return 0; } int avfilter_init_str(AVFilterContext *filter, const char *args) From patchwork Wed Sep 15 17:22:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30262 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp484563iov; Wed, 15 Sep 2021 10:23:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJza7fxICeQBRD866EBA5Q52gTFKgDMl6gXBZ+q071HAxLJ4aMJReakeXKmgoIkk87q/kXmE X-Received: by 2002:a50:ff0b:: with SMTP id a11mr1138141edu.373.1631726607647; Wed, 15 Sep 2021 10:23:27 -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 v8si582585ejv.188.2021.09.15.10.23.27; Wed, 15 Sep 2021 10:23:27 -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=t5ibjYzG; 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 DA58C68AFD4; Wed, 15 Sep 2021 20:23:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2092.outbound.protection.outlook.com [40.92.90.92]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9266E68AD0C for ; Wed, 15 Sep 2021 20:23:13 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UlhgjZGs69chKilQvTM2WUF89llT1ifhNgbDUTfyZpBVWPutKKM8WYzxqy6faR/txJ9P4ob5OvOwwKUU514NTfqUuyaNel9Q4gfSasPNhJJ0KI//3BVZlsdZxmVK5kFq2leQ0xKbjRvFCibZVnqsbSI6ofw1VW2yIgjFM93oak/8/fCLJnOURNLQfJPV4MEcUdhHOb09GW7IhlKFnKlbAHAqryXfoRnibGicurvcb1R+/wgOQXXhUCYTOYJLbBXNnlync8xLmsIjtpWXR62RWvoPANSCTXE7bs9wI5fejrnixfrKgY5pN+16BwfB2eCAmq7X2bcH12Ay3LtW4rdxYg== 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=6r3qL8L/YtDO+kTZa9yvzYQNnxt4Ba0vm7UQEZjKZfc=; b=bTAWY0nNy5y1xgB6sWH042RjrDexKUp47Llg56ZkRZ3KSzQ0pTnuDNiCLG1Ej8Kquz85GcRitw7sekP1PnWhhOrolb2U1kGBqC7tE9Jnzexdr24uTX4lzDVDPCtNrfYx6yxQe6yGX7i4sz9yzFNNF8WgYH9RtXsHC3oWzI9x84Ng50xLt3JO6YpKhDq3XE/Q28t1b7t0uRpJGXtk6GwlQk+cmF1jtHFHVyCmFVw0TnfsX2sDmq3tT6glZFAccOBFUPT2jh1ceghkU4ywP4MB98PtAhTLZurKdsiiImngs0aAKbNHFYXIOtPA2Hu/8963cvKwrKBqCWY7OxEuDv7UxA== 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=6r3qL8L/YtDO+kTZa9yvzYQNnxt4Ba0vm7UQEZjKZfc=; b=t5ibjYzGFIGD2DaQbiAH26QyHI44OQH9m/XzsJ/iSI7nOxf3hy2ZFE2VjnIKudfaVv2zu4GTqHxV4IOnJVcl+eWe6xFn67j7HlwrCPbEDM2enXldNTUB5XeuXpxonO8wJZGOkhqMxSBzzXEbX2ds2Ervaub709TA9m5qFmKcsr2MXOin1gfAxrBDi95c+n4RM6wH7I1Ph58tV0ZXiP1Af2khwpQSm6UFmi0CyoKX8oPhP32FwwDu0rhLiAEu75StO3Ov+b8JD99SB9U6S+xED53maOW2s6MhHnroPVWwDchslugZ2P0bmT6Rvah84R9c8Eq+cDXoWbErok0D162wZg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3957.eurprd03.prod.outlook.com (2603:10a6:20b:15::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Wed, 15 Sep 2021 17:23:12 +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; Wed, 15 Sep 2021 17:23:12 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Sep 2021 19:22:55 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [N/IUZSK+A6nfHXFITxyBTX5z4k24gTO0] X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210915172257.4090685-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 17:23:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 013db4bb-69e2-4951-609a-08d9786d7ee2 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNXfHZQH94EuYDPZCXB5h7IrJTkGjiLwBY6sHjAlnf/7RXcICJ3y4Wn42q1lrpMPBSHPpKV/dnWiSh3/JNM1xuInKA5TDzQUtfw8Wx/C270O5cli0KYWK9yb2UIN/clPIpc4WPOmx0Lym8UYmP97+pjvHmFrTA3x3iwfTYyFiyzu4TuBN84UFjPQAUFTv/CM/yIKfQIy/TqsmR4m86crTqqaHD5SsMqpgwVZmCO49bkveF+iQEQs/+QUEJCdf+/PIVYy+Y/d8brFaSwVmJGXqsXFhKBHQTApo70lBpTS9z6pO5278cL5EKfjRDnwXHMsSLcacevqu39oL2AMF5hTCUB+Zi5SO/vBrZy2VVVdTTGey+EplOjrb5mEbY+caHKKpUKub/RRGjjyaNf2/K4QZj2id1g2wVbXOudJdUkMbxXcLOMrnSKFUDdG5fZk2rSLOIsJmQZ+AkyjJLmfbk4ViqQIuV9uj1O7zJ+hQsNBRf8t2fyaRvi4ecttfJqrKmta2hnB+jBbgRxbH5h+HyCXzmvnoyCtQySWWIPFYUYSwfjIoFQwechZxFZEbyuZ70V+JNaWVBRoHfDXYgZlolE2hfUODDTbMJzbcw90gnkuY3RZoyCv41i7hQn015PHIHBvudSsPti2VAKKrktwq6P6lVvXqWtyQ152gRJJhrpRgtcjYvRlxoJ9ZeFw8UHeV1e4ZrwxFXbDwCgKKLgz5epgoTSimZ2qBIkvy00= X-MS-TrafficTypeDiagnostic: AM6PR03MB3957: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zaLNBXjzO1KHDXVGN3dc3A/ZWEFcNPw9EM0AZuY5FCTPpZaDV/o8172TzuD8v+0Z3q4x59keQiDbMQlhr5Z6ivzzsrxZ6ZsOvDJdWFcMUGz/OXc/ITZkQ5u5Pg97c7cmoljrpwQnjIKJnu9uOPgeJKLpwcrJdjmMlle363PFMm7EQvezHd/bcwHxy20eOVZdZcjQO0wKx9CF2ndRLwS6u6QBfkODPK/wjdvdxThIzvUN6w18TMA1rBnO73NDlUn2dJmvzalkcx/CxUpWZceRzHIrOVAPUiUJsvKH/Jqu3pK/8rrO3wg5zo/xp4HKCZjZ1OXc9IMssJpy4BXO1TnWlW9ZL1ImoHdq0KBipG7dqiV2POoswdeTf4HFAcL92cQ8dkuAadPQvhhNiYJMDPVKLj1Om0nWDhKkcAlqlVnG0W5hovKKAIEymjgAGXmZXrLD X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bfgfq3nin+FSfH8IL2HC2ixepLjIFdw9HuMkc+pEAS+mDJbP9a/VEX3wG+KXkG2YX9RDhy02+W7Y8nE0Cs+nS9ejqXjj7k8aGB8svF9t7gGSwL2i2tQxXnk/BO+858GONgQ1oUUA5WJdbNkozHujeQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 013db4bb-69e2-4951-609a-08d9786d7ee2 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 17:23:12.8026 (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: AM6PR03MB3957 Subject: [FFmpeg-devel] [PATCH 3/5] avutil/opt: Add search flag to search children after the current object 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: 8KBypFrxLm+c The current way searches children first which is odd and not always intended. Signed-off-by: Andreas Rheinhardt --- Missing APIchanges entry and version bump. libavutil/opt.c | 12 ++++++++++++ libavutil/opt.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/libavutil/opt.c b/libavutil/opt.c index 41284d4ecd..de06728cd1 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -1679,6 +1679,11 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, return NULL; if (search_flags & AV_OPT_SEARCH_CHILDREN) { + /* Searching children both last and first makes no sense. */ + if (search_flags & AV_OPT_SEARCH_CHILDREN_AFTER_ME) + return NULL; + +search_children: if (search_flags & AV_OPT_SEARCH_FAKE_OBJ) { void *iter = NULL; const AVClass *child; @@ -1691,6 +1696,11 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, if (o = av_opt_find2(child, name, unit, opt_flags, search_flags, target_obj)) return o; } + /* If the AV_OPT_SEARCH_CHILDREN_AFTER_ME flag is set, + * then we have already unsuccesfully checked our own options + * and it is certain that this option is unrecognized. */ + if (search_flags & AV_OPT_SEARCH_CHILDREN_AFTER_ME) + return NULL; } while (o = av_opt_next(obj, o)) { @@ -1706,6 +1716,8 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, return o; } } + if (search_flags & AV_OPT_SEARCH_CHILDREN_AFTER_ME) + goto search_children; return NULL; } diff --git a/libavutil/opt.h b/libavutil/opt.h index 2820435eec..5ce4a8d03d 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -558,6 +558,13 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational #define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the given object first. */ +/** + * Search in possible children of the given object after having + * searched the options of the object itself. + * This flag must not be combined with AV_OPT_SEARCH_CHILDREN. + */ +#define AV_OPT_SEARCH_CHILDREN_AFTER_ME (1 << 3) + /** * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass * instead of a required pointer to a struct containing AVClass. This is From patchwork Wed Sep 15 17:22:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30261 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp484710iov; Wed, 15 Sep 2021 10:23:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMyY4/1aMbARHiI4LKPQ0FQi9MJnZ114Y5+LIAHbgSSW8GbwxLQ4aPtmh/QxqBSp86WnD2 X-Received: by 2002:a50:cc08:: with SMTP id m8mr1233443edi.60.1631726616623; Wed, 15 Sep 2021 10:23:36 -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 rn4si716532ejb.248.2021.09.15.10.23.36; Wed, 15 Sep 2021 10:23: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=@outlook.com header.s=selector1 header.b="o/7qJlUl"; 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 DF6A468AFEF; Wed, 15 Sep 2021 20:23:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2078.outbound.protection.outlook.com [40.92.90.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 43B1E68AFE1 for ; Wed, 15 Sep 2021 20:23:23 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=feRxT0H4KSy0YDmOS9wBotHhuGq5X9b8MPsGf3Q+G9cj6PlFrVn+jP6RfPO3K/OXpA4mheeupdMuM5MbiaG4nrkxhKW1Y2VpoF4bf7ExvUqlw3gbCavKSgA8Sepg/6dFbuKFsBN6oS2vXz8tFgqyOI1hWNAFS96w06Lu8RtNTqVDMIfuvw6EjDUlVUoTH+s+iZlCK0AmIlv0cti1KCO4H0rCACzRN2DdKvhoAKjHE31E/xYilnBd95UpaHOOeyFysSNsYyOiv2O7/tVBfFwG4QZoy4F9hvc4vh51Vv/trzaxDcZ41fgMKUr2X/2CTqhdZUfv7UK9fDDqajv0/igD1Q== 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=EHwyNUfIU4DVKpQzPMaz9b193B1nnYNIX4pTOw8UBvw=; b=TA5GMtU/9e6y8uLOMqgfJK9IcO0n9PLvNnqQM7mQ11T4ZApRmXh5EDi926wx1+fqh0CK2bxAWx7g6xQQv6LlPNUtL58HKcPcUqvV/ckPcxg7G/GLArYwnI0Mj4AMoTe8mC5GvW/3FYU+x0k/2UxdWNIG+/nqmOJTWqJat5d7mEmxzCs+q9x7pknQ2fL764ahD3ZVgaIU+bQFJAFAB43X92d/r/UJZOPpUydXQ+eGtz6ROQyzFunpRykPWwiKM66FvToVZRMjmbxVSe1bAMuRYrpT+MDkQqv4NMZT9yA9z54mOO5cAYGiJKKP8yEdhg1ej3NvHazIKj9a68mfi5ZNFg== 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=EHwyNUfIU4DVKpQzPMaz9b193B1nnYNIX4pTOw8UBvw=; b=o/7qJlUlbHcfUv8SmS6TFznzEI/W9CO2L6Jb/QH5JHPilMbawAKM/1eadHKZShT8VMye4XcvVrJMuznjSWtIBi0DhT5NnV3+/qp3KoNSzSxN68LrGTbbQMTdqfKSJcrv6FwZonkJZEd1/1HgXzHl/pLTJA3ehAbKwD7M/aJBa9zahj7ruxWHwm8tsZSe7er70lKjon2oyFH2fW1KUDQ1lsoMybXTiBl63/DvGpU1vYdmCKj6rzxx+yyB229Keq9iBLrr/sWyNrfDuV9NmQT4R3TsclSP9Yze4GmnMQUVu4I4COCuUCbtxN8TS/87DVgzxeyvIqEF8gjB6MX1Egj+/A== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3957.eurprd03.prod.outlook.com (2603:10a6:20b:15::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Wed, 15 Sep 2021 17:23:22 +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; Wed, 15 Sep 2021 17:23:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Sep 2021 19:22:56 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [lOd/ONUDYJDKxoWGnWDZP10Z7251mQk7] X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210915172257.4090685-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 17:23:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5cd839aa-e2a1-49d9-27c5-08d9786d8482 X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSH+vJHojH/XUp/uqv+O9nEdfZ8TJlUoiYl7mfpuo9uS35PCqGOZjAU0XGp0+JTqtPe+ieEQetyBX8s4PU6MvCAkPchSNDrvm3udEbXUsGOPyfOIGw6RghPjpErpEicV5ohWEvCyKUlIYBqN4hPeRqlVIQC2p8eSdacb+nXyVgqoMFDQwJ11hTQCnDVF8ovIyHyn+Y4knZyCmUIwTBdjS2CYSQItf/Lniu9R2TTzYmRgziYdiV5u5vNdVqnJLobMtQBEntnfGngfKsOjTWdOSJi3ykZWv63k0ABwOs7/igQo/95w1bBgnMzwgnpjVh6Ykk0bq3uWdfSS8d17DYhTg+C04D8cnCavoImLdP36xWjNKI5SfJSKc1n9BelrQfE5X4F4LahVReZhfrOwabvMB9O+Ga0/uQny/0cr66f/OE1cOyo2smPd4NYJHk5nMfWZPuHMZi2BxRUy3jqHLuSLmTWDpWtH/eSlS6TZ7l3wXhxuxcIV53Ooij8ZB7ybkWkaMN0juO3+cpKsp04qMwikN6Fw9nEBXxJrdabbxLDkVr1MZV5QeV/QvYXSfS5gYlke5BrFUSCJpXTJfHaFhueorZBK4IKBBpY/xyiVG8y1nGTTeCpk5cezII23x/bnbpQHhwqFXtvHYeZrHJozkeryvuRVpV/UQ6dsslCUaVMYIIxv7kS4iK3EhDgLIejuwk/VTTaDmPLESV30pY6KIz7ekV5/OdqBfbHVE2v+ZtMIslDi7m6JKq2CaXAc6eRa5r/Vg0= X-MS-TrafficTypeDiagnostic: AM6PR03MB3957: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ull9aLyztFTLKs+9aGUHuoMMfHkPd2Ua3IWsh54xTrthOIX8mnOBf2dVqjqWXF6gr8q874FkOU58VYK1bh4V8uBdmwtQmP+A5ud88Wu51m4/mWS+FXw8Jtw1gYKwkrvxaV0OcI8J5J7+v+k8mN8BvLTl+59tyckQ98tAqbSreJ9F9ayQpKrjGDzz4xY1igjNhndZEkqXkhHBVgrXAs+lCWv3QZDJfcMDu4rRKgaSmPb96ETKgVSYyGL+4JMl52gS0AJeA21Znyii1yPW1YXfqgRuxcXUNxqZdkW2K4OpV+8r3nqvT7e1WESCC7pk0kUvMy4lmV/HHYTLfJzp6ZNpotr+NlXNQX0prjANin7OO8xgqXLz6gT6c+HI+JBidTmGj/cPErdAz8dszYmCKv99WWXyHtoM6PifvyhDltUvJ7uZGF8evpYqeuMjKwfF5P5V X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LoR+o/soDP67tJa5xAkCJfb5Q8TbsOXGXhZ/wT5YjFP5Jc7wlNx1JIHbXfszPDvEtPM1Uzo2y7U2ey/PGUKXlhc+EI+qnbsdOWaGrtseVPkZmfaxk8EpnXiOcbhG48eSlyqFXqVpe7r6d3IoDE4lrA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5cd839aa-e2a1-49d9-27c5-08d9786d8482 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 17:23:22.1697 (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: AM6PR03MB3957 Subject: [FFmpeg-devel] [PATCH 4/5] fftools/ffmpeg_opt: Add missing AV_OPT_SEARCH_FAKE_OBJ 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: 1SKd+HNPvJLq Signed-off-by: Andreas Rheinhardt --- fftools/ffmpeg_opt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 6ca28cf974..8c8d5f60d8 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -821,7 +821,8 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) char *next; char *discard_str = NULL; const AVClass *cc = avcodec_get_class(); - const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL, 0, 0); + const AVOption *discard_opt = av_opt_find(&cc, "skip_frame", NULL, + 0, AV_OPT_SEARCH_FAKE_OBJ); if (!ist) exit_program(1); From patchwork Wed Sep 15 17:22:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30259 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp484837iov; Wed, 15 Sep 2021 10:23:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVq10Z2PMyQvrVfq4Ztrueq8VzZj+kzap+E08QMlm/mCM5fpMfOQsItDWRMOeae4Tk01OR X-Received: by 2002:a50:8e06:: with SMTP id 6mr1148170edw.107.1631726627037; Wed, 15 Sep 2021 10:23: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 hr13si534263ejc.66.2021.09.15.10.23.46; Wed, 15 Sep 2021 10:23: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="UnY/WNvD"; 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 D820168AFF5; Wed, 15 Sep 2021 20:23:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2078.outbound.protection.outlook.com [40.92.90.78]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6BD1768AFBF for ; Wed, 15 Sep 2021 20:23:28 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gO36BQt+e+fUwvnONEhpmv47Vk8MWhojlWCpn46XeEENhqt46IBAR1je3AbrDEGhP0i0Eolc9ZD1B5zZ8Ji6gV5SiGVUZlzAwsD7+724j0bHSszhBfNTqoISgZfCy7yqeFxdu1bCSloXx50OtnhOechLuDcyfbD5PSYCdOgOPwGhJMqVtiE2neSphnJaPte93e1vnZPJ1CXAQ44/MB7Yl1RcuQ87SUERdInohVG66ksNkPwH7HGyzi7FdtDksA+ewcmnkUhCPSG3suShJ43pjAvu0P+hWST/trlbQet0anykigeT3U3JHXQOXJF+NawAdjo7VVG4IBABXK4YrFypVg== 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=l0OmzlbYlSF3Gd0JhYsIa4FSedoiRBZOrtYAB8696kk=; b=Gn0y9VcSifLg8tjvf96hDnS+k6SqtTEz9AxYfWivv61zyGGCbA0sCjoPhdjVBA8cNLqG4/cSKMqHYA4fH1qEJBg1xuECSrDu7syqjUoWrZB7uN+S+kiTo6wii8fBj6PjOySUDy+IVSWWqJ6+QWa3ropYfxXfmj/7ZbjQzpw2/kl6I7Vz6CGG7JlUWQoqn/2cq2zlms/rxTJ+conM3/E9f9hJGvTFNx2HnrP872mXmhrwM6coJvA6xkLQjY+I8N7BFFfUjD9QDma53oE6VotTd6PSFoD/HMVPsUUJ86pHziZEzLVHY2+uLp0dTtbGRe4FLLzwdyjWGd2gvpVlKow33w== 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=l0OmzlbYlSF3Gd0JhYsIa4FSedoiRBZOrtYAB8696kk=; b=UnY/WNvDBi4xk1bWAkj4AQd31eYdLWSc4K/ykDhmCSU1d1WavRGIzVO1FLTGyYUPO1erpyiFL5Hf1sTQ7xN8AKqKmGc4VvV0Lm3PHvH//+Jc44rvZBd0Z4oHxCXlZ4PXRkBqVCDoPCpUim4OyRaL2XRavvc/iSTzoyW/UGQIzwl2k5Wq6/WJbcObioUiO2DCAuvddgBYp/2YNXFzs5BDOTZ9oZ7QnegQAnCYeqga7NviiF99/CTlSWmSoLfzSXGmLmWMq0Bdk+8GbwopGGl4vIrSJfegQa/H4Ed8XL7LW7i45yW29qEqTDQOrwmg81GZSUdX0KF6JkX8kTd1T9/ljg== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB3957.eurprd03.prod.outlook.com (2603:10a6:20b:15::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Wed, 15 Sep 2021 17:23:26 +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; Wed, 15 Sep 2021 17:23:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 15 Sep 2021 19:22:57 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: X-TMN: [RRtsSqKEsqg56IqXTp1BdRVKfvWsCE2P] X-ClientProxiedBy: AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20210915172257.4090685-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM0PR02CA0153.eurprd02.prod.outlook.com (2603:10a6:20b:28d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.14 via Frontend Transport; Wed, 15 Sep 2021 17:23:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ade00ab2-2adf-407b-8c09-08d9786d86ed X-MS-Exchange-SLBlob-MailProps: S/btQ8cKWiSH+vJHojH/XUp/uqv+O9nEaubDNUIz7HXax7EzlzuJKzmYQpCO+h0KT77+C/krkF1rc0vMw8JxZrzTYP3eAXlyWE0t0fcxZUpfR0HS2mxpveaiyZBw1btFyKAZvy8H36rj0iHPM6UEHUyHhbgU9hph9IRdKhyVFga8mMnaCKPU/JNFS4vw9qAqLO6nHy7CM4phEDHNuZfjTKjq4elK7EsUejZQzN14/RAObVEtZIgZqJFgjycRs+3H4Shg1q+KOb9l7ZX0FEGHAj/0hZFOzxw+uOhRTuZve0m76RX8PILC/EQHxNPb5A4OscWTRa2Nr29WPravY5exLRD/aPDh2/+z7O9+SjUurvPgcJRYTwI2z3izFniDWFGyBPFZ2h5dtFFXJiR+agw3iSiVxXdVK9zFat4v2CtSoXVQF5/idHL5TUKoLw6QCK2IS4oAFyOHZ2e3uDA0x0I3dVKAZhTn2ViOrT5ulpghV4wkXQJCQzXM0CY5f3p3iDJwhA21B1k0wUrbQtJCzwZNngruXXm3Vt6z8P2ACjc5n5SGF1jENtFzIt13D0tzSd1wL1vVvMJr+y1kjnTLqrTLmJMMaJJdo6xZOAAtE8tCMqCyfIOzfBg5zLqn4Qbc2YYYbvETTS/H261zPyq/iaIu0IxL0pGxPzP4LGGlCZUT8ibWvH8m7NV/Dggf3Kk9ltgNalwiY7tRmeELb2oljC646qhpBzgYFvanZ8DTuJHEjQEDKJpbP8gVPVEQMoq2hI+5w+ABKWSlNsE= X-MS-TrafficTypeDiagnostic: AM6PR03MB3957: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xQOsQs6ziALY9Soz34C5/oU9hdfFztrc2yaiIEXCrtT+7bO/30Ts/ctqZtBAAKMEMBHK0BdgAoD106yrkTxHq1cSmyps+zBH4CSCpeqy9zx3kaaSqcZYOUEhmEvv5qL1KB+b5qUwk1DVdkf/qJND+idiGP3zwNhdj1Rs5skWTHj8im66MkqxjAR5n2sqd/w/lHFu6q/MbM1mWKkEUoJ0Jchu6X+R0iackQS78L+YhIxn6VmCFfDfdyBDGdxQMiag4hkBVMVRX3wqjDi6XDztRbZYnLVwW8VAwhnBhnOKQXUTollr1EIp4d+bObYaIm02IWCwSGfHSmoJEURE81l7ciW7VNcrLP3O6m4k624kHXTrN5BKpGVlOOPhoIf0CshSOF8JqByg33cz5OsarvAGW+L/W1ZP/x6OuUP7wl+Z6fNY1+kcWwBhwXWxJEnv2ON6 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H6BnBQnLlTUQjnLgKtfZVKqdmiOUylv3KFcHiUon56D5Z4hnFvpBX2ILJpwy8xkMAIW2GsO51Xdlnbpp+Dh4yXHgz9PnqQpM1aoYJFKP6JOUHbnLCgqU9nhRBlhj/thbT47fuX0WIS3fMFQ7tuRsWQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ade00ab2-2adf-407b-8c09-08d9786d86ed X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2021 17:23:26.2319 (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: AM6PR03MB3957 Subject: [FFmpeg-devel] [PATCH 5/5] avfilter/avfilter: Apply options in one av_opt_set_dict2() call 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: 7g0ljpQQRy8d Up until now, avfilter_init_dict() first applied the generic options via av_opt_set_dict(), then set the filter-specific options via av_opt_set_dict2() applied to the private context with the AV_OPT_SEARCH_CHILDREN flag set (this ensures that e.g. framesync options are set, too). For filters with the init_dict callback the remaining options were passed to it. This has the downside that all non-generic options are copied to a new dictionary in the first av_opt_set_dict() which involves allocations. This commit changes this by using av_opt_set_dict2() on the AVFilterContext to set all options (except those for init_dict) in one step. In order to ensure that the generic options are still applied first, the new AV_OPT_SEARCH_CHILDREN_AFTER_ME flag is used. This also reverses the search order between the private context and its children (if any), but this is actually more logical (the child contexts are more generic, hence the more special private context options should take precedence) as well as irrelevant (there is some option duplication*, but all duplicated options are entirely equivalent). Notice that there is also no option collision between the generic option and any child option (i.e. one could have used AV_OPT_SEARCH_CHILDREN) as well, but there might be some day: E.g. both the AVFilterContext class as well as the swresample class have an option named "threads". If the scale filters would expose this class in their preinit callback, there would be a problem when using AV_OPT_SEARCH_CHILDREN. Finally, in case an error happens in the second step (e.g. due to an option being out-of-range) the name and address of the AVFilterContext instead of the private context are used. This allows the user to more easily map this error to the actual filter. *: Several overlay filters duplicate framesync options (to preserve the ability to set them via the shorthand notation). Signed-off-by: Andreas Rheinhardt --- libavfilter/avfilter.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index ce63b9762f..87e28a8024 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -897,9 +897,9 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) { int ret = 0; - ret = av_opt_set_dict(ctx, options); + ret = av_opt_set_dict2(ctx, options, AV_OPT_SEARCH_CHILDREN_AFTER_ME); if (ret < 0) { - av_log(ctx, AV_LOG_ERROR, "Error applying generic filter options.\n"); + av_log(ctx, AV_LOG_ERROR, "Error applying filter options.\n"); return ret; } @@ -912,14 +912,6 @@ int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) ctx->thread_type = 0; } - if (ctx->filter->priv_class) { - ret = av_opt_set_dict2(ctx->priv, options, AV_OPT_SEARCH_CHILDREN); - if (ret < 0) { - av_log(ctx, AV_LOG_ERROR, "Error applying options to the filter.\n"); - return ret; - } - } - if (ctx->filter->init) ret = ctx->filter->init(ctx); else if (ctx->filter->init_dict)