aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2024-03-03 16:42:47 +0100
committerAnton Khirnov <anton@khirnov.net>2024-03-08 07:24:50 +0100
commitfc706276c051c425538d1476a7be05442d06dd0f (patch)
treea45e1c7af356e4a5ea56d9271d87ae2dfde02eca
parentc259f8031561662da32f8027b8503c218679af3b (diff)
downloadffmpeg-fc706276c051c425538d1476a7be05442d06dd0f.tar.gz
lavu/opt: distinguish between native and foreign access for AVOption fields
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.
-rw-r--r--libavutil/opt.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 91024da022..82bca920fb 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.
*
@@ -298,6 +308,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.
*/
@@ -305,6 +317,8 @@ typedef struct AVOption {
enum AVOptionType type;
/**
+ * Native access only.
+ *
* the default value for scalar options
*/
union {