From patchwork Thu Jun 6 16:02:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Sayers X-Patchwork-Id: 49621 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp476741vqo; Thu, 6 Jun 2024 09:02:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXbffY472y6c8TorPfCGtDoFtBQHmvQ++ka3vD14Ibo5H4nSL66sQBkYp5In0OwfJOSji4UyN1nLiTGpy9Q4Im7cfJQrMDj4SSVEw== X-Google-Smtp-Source: AGHT+IFsX63C0UqY7yIke8+xZz/nPQSaSnKm/gLhTmxhPXvCrt4U+sC4o8bvtnFqHtgCMhX2D/Fg X-Received: by 2002:a17:906:fd86:b0:a68:fcc9:6c1c with SMTP id a640c23a62f3a-a6cca208e08mr4462466b.0.1717689743683; Thu, 06 Jun 2024 09:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717689743; cv=none; d=google.com; s=arc-20160816; b=fCO91508kw6hzm4frse4eQOY74KAtL8lfXw26BqZ4oOxzf6AwpHsy+hya6g9f1S0uQ e3xDYs8tipFB+H+9MAhEEkd3s01Q2t14U9LmO4no0tccpUrKGwv1YQxYS4uQjsXMqdiI KUEFVu7vAK4vlhblMWXlTNRHlc8aOd8kKJjOaBpMIgf11i4hIvFkonsa0HpF6XW4k2Y9 ja8pxuLeawdJlHpayVLncKV/sv+5oZZg8pV4FgihyumyqAAcSaW5jiqlxKdyRkvGgB7h NCeJJ9b5w7QZCg6gvcJF8Oluv9Z2HdDbl+ik78O3xoqz45lHfSsKa9npz0VpIVTdkT9h U2IQ== 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:delivered-to; bh=nH/EhlfQ0piwqNwmP8S2dljYvYymZFdhVnGfPcFJRQU=; fh=73ExZnkQ8FYbu/qeQNmI0dtHCfShNh8/NmZJs1umltM=; b=SVomu1M8at2qbtEbKroEWkSzgSEiI0eI3YCfyIWWhriBZAZz2DPlnP289f/t8GSS+t cPApRu+4cFHi42SK+kE1NmIMasQ3OQBgqb2wOAuMJFn2rtgJEkkNsnzBXaMs0iDrSwZw FCTJXZDUKFDed8mIk3iBVKgpfosczM1XM6KL9JcKgn2VKe7FCCuiS9ZuYaU6jTqmNbnM LuCXHLfDwYGdprTafJeVEyz82tJRVAYyrkQh1XpSNeQvqJYwYThlglDQWAmbS8otJ0RX 0oHKRYpQF9yGSCg2c1B0rYSvabM+Cg5FtoFSAWkDVuTSKKHE+ZPqSymZAZGDSltCvsOT ABgA==; dara=google.com 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 a640c23a62f3a-a6c80728628si85304466b.809.2024.06.06.09.02.22; Thu, 06 Jun 2024 09:02:23 -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 75D5268D705; Thu, 6 Jun 2024 19:02:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from alt2.a-painless.mh.aa.net.uk (alt2.a-painless.mh.aa.net.uk [81.187.30.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0D30C68D17B for ; Thu, 6 Jun 2024 19:02:11 +0300 (EEST) Received: from 0.b.4.b.7.4.0.8.c.4.a.5.d.8.b.2.0.5.8.0.9.1.8.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:819:850:2b8d:5a4c:8047:b4b0] helo=andrews-2024-laptop.lan) by painless-a.thn.aa.net.uk with esmtp (Exim 4.96) (envelope-from ) id 1sFFZ4-00Arka-30; Thu, 06 Jun 2024 17:02:11 +0100 From: Andrew Sayers To: ffmpeg-devel@ffmpeg.org Date: Thu, 6 Jun 2024 17:02:06 +0100 Message-ID: <20240606160206.501956-1-ffmpeg-devel@pileofstuff.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] lavu/opt: Discuss AV_OPT_FLAG_RUNTIME_PARAM more explicitly 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: Andrew Sayers Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 5rU8x+1j+N8p After a struct is initialized, only options with the AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. Make that clearer, for the sake of readers who would otherwise assume all options can be modified at any time. --- libavutil/opt.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/libavutil/opt.h b/libavutil/opt.h index 07e27a9208..d23c10bcf5 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -53,6 +53,9 @@ * question is allowed to access the field. This allows us to extend the * semantics of those fields without breaking API compatibility. * + * Note: only options with the AV_OPT_FLAG_RUNTIME_PARAM flag can be + * modified after the struct is initialized. + * * @section avoptions_scope Scope of AVOptions * * AVOptions is designed to support any set of multimedia configuration options @@ -300,7 +303,7 @@ enum AVOptionType{ #define AV_OPT_FLAG_BSF_PARAM (1 << 8) /** - * A generic parameter which can be set by the user at runtime. + * A generic parameter which can be set by the user after initialization. */ #define AV_OPT_FLAG_RUNTIME_PARAM (1 << 15) /** @@ -483,6 +486,9 @@ typedef struct AVOptionRanges { /** * Set the values of all AVOption fields to their default values. * + * Note: after a struct is initialized, only options with the + * AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. + * * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) */ void av_opt_set_defaults(void *s); @@ -492,6 +498,9 @@ void av_opt_set_defaults(void *s); * AVOption fields for which (opt->flags & mask) == flags will have their * default applied to s. * + * Note: after a struct is initialized, only options with the + * AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. + * * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) * @param mask combination of AV_OPT_FLAG_* * @param flags combination of AV_OPT_FLAG_* @@ -661,6 +670,9 @@ enum { * key. ctx must be an AVClass context, storing is done using * AVOptions. * + * Note: after a struct is initialized, only options with the + * AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. + * * @param opts options string to parse, may be NULL * @param key_val_sep a 0-terminated list of characters used to * separate key from value @@ -679,6 +691,9 @@ int av_set_options_string(void *ctx, const char *opts, * Parse the key-value pairs list in opts. For each key=value pair found, * set the value of the corresponding option in ctx. * + * Note: after a struct is initialized, only options with the + * AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. + * * @param ctx the AVClass object to set options on * @param opts the options string, key-value pairs separated by a * delimiter @@ -709,6 +724,9 @@ int av_opt_set_from_string(void *ctx, const char *opts, /** * Set all the options from a given dictionary on an object. * + * Note: after a struct is initialized, only options with the + * AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. + * * @param obj a struct whose first element is a pointer to AVClass * @param options options to process. This dictionary will be freed and replaced * by a new one containing all options not found in obj. @@ -726,6 +744,9 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); /** * Set all the options from a given dictionary on an object. * + * Note: after a struct is initialized, only options with the + * AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. + * * @param obj a struct whose first element is a pointer to AVClass * @param options options to process. This dictionary will be freed and replaced * by a new one containing all options not found in obj. @@ -764,6 +785,9 @@ int av_opt_copy(void *dest, const void *src); * @{ * Those functions set the field of obj with the given name to value. * + * Note: after a struct is initialized, only options with the + * AV_OPT_FLAG_RUNTIME_PARAM flag can be modified. + * * @param[in] obj A struct whose first element is a pointer to an AVClass. * @param[in] name the name of the field to set * @param[in] val The value to set. In case of av_opt_set() if the field is not