From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 61EBF49BA9 for ; Mon, 4 Mar 2024 13:08:49 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E13E468D47B; Mon, 4 Mar 2024 15:07:22 +0200 (EET) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6C44568D43B for ; Mon, 4 Mar 2024 15:07:14 +0200 (EET) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=L6JnEC2x; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id EA8864D3E for ; Mon, 4 Mar 2024 14:07:08 +0100 (CET) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 4u5llzm96hVy for ; Mon, 4 Mar 2024 14:07:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1709557626; bh=Itn1Z2BVuifxV3igR8UIKPpOb+btRTjIEigEcFT+OD8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=L6JnEC2x84Plb28TQkj9vNo7h/EH60iOfjyAV9k2c9boMibauMSjV1iGHydkzDKJs 6wgsX/9aerbMHkj//3/eTpZH5n2wDtnGtvOpUF21LNW/H0irhMNHJ9yZ3jzKecQRcO qT7p/ztDLjdklmVjhDh32fcOIwr+y7pNJHenNHcdt0AGxQZ/qdTos6c6h2rGcbhGn2 rRsV1VlUbR1TsnO19grEO+hUrE+lL+ETYAfnzFYaRgVCKL9SoZAv6q0V10+Z2eUH8p 3ULJ72LmfmcIqe7knHW021rAIAeBpi8Md6rsJX1+n4bHvak7f/qlw8wnnZ2Tbj2PkA Ue+4sz/oh7JJQ== 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 mail1.khirnov.net (Postfix) with ESMTPS id 671774D52 for ; Mon, 4 Mar 2024 14:07:06 +0100 (CET) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 134463A0B9C for ; Mon, 4 Mar 2024 14:07:00 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Mar 2024 14:06:20 +0100 Message-ID: <20240304130657.30631-5-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240304130657.30631-1-anton@khirnov.net> References: <20240304130657.30631-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 05/29] lavu/opt: distinguish between native and foreign access for AVOption fields 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Native access is from the code that declared the options, foreign access is from code that is using the options. Forbid foreign access to AVOption.offset/default_val, for which there is no good reason, and which should allow us more freedom in extending their semantics in a compatible way. --- libavutil/opt.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libavutil/opt.h b/libavutil/opt.h index e34b8506f8..e402f6a0a0 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -43,6 +43,16 @@ * ("objects"). An option can have a help text, a type and a range of possible * values. Options may then be enumerated, read and written to. * + * There are two modes of access to members of AVOption and its child structs. + * One is called 'native access', and refers to access from the code that + * declares the AVOption in question. The other is 'foreign access', and refers + * to access from other code. + * + * Certain struct members in this header are documented as 'native access only' + * or similar - it means that only the code that declared the AVOption in + * question is allowed to access the field. This allows us to extend the + * semantics of those fields without breaking API compatibility. + * * @section avoptions_implement Implementing AVOptions * This section describes how to add AVOptions capabilities to a struct. * @@ -301,6 +311,8 @@ typedef struct AVOption { const char *help; /** + * Native access only. + * * The offset relative to the context structure where the option * value is stored. It should be 0 for named constants. */ @@ -308,6 +320,8 @@ typedef struct AVOption { enum AVOptionType type; /** + * Native access only. + * * the default value for scalar options */ union { -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".