Message ID | 20240818112655.18270-1-anton@khirnov.net |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/3] lavu/opt: document underlying C types for enum AVOptionType | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Hi On Sun, Aug 18, 2024 at 01:26:53PM +0200, Anton Khirnov wrote: > --- > libavutil/opt.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 75 insertions(+), 3 deletions(-) > > diff --git a/libavutil/opt.h b/libavutil/opt.h > index 07e27a9208..23bc495158 100644 > --- a/libavutil/opt.h > +++ b/libavutil/opt.h > @@ -240,26 +240,98 @@ > * before the file is actually opened. > */ > > +/** > + * An option type determines: > + * - for native access, the underlying C type of the field that an AVOption > + * refers to; > + * - for foreign access, the semantics of accessing the option through this API, > + * e.g. which av_opt_get_*() and av_opt_set_*() functions can be called, or > + * what format will av_opt_get()/av_opt_set() expect/produce. "foreign access" ? is this a standard/ common term ? if not, maybe somone has a more descriptive more common term/idea > + */ > enum AVOptionType{ > + /** > + * Underlying C type is unsigned int. > + */ > AV_OPT_TYPE_FLAGS = 1, > + /** > + * Underlying C type is int. > + */ > AV_OPT_TYPE_INT, > + /** > + * Underlying C type is int64_t. > + */ > AV_OPT_TYPE_INT64, > + /** > + * Underlying C type is double. > + */ > AV_OPT_TYPE_DOUBLE, > + /** > + * Underlying C type is float. > + */ > AV_OPT_TYPE_FLOAT, > + /** > + * Underlying C type is a uint8_t* that is either NULL or points to a C > + * string allocated with the av_malloc() family of functions. > + */ > AV_OPT_TYPE_STRING, > + /** > + * Underlying C type is AVRational. > + */ > AV_OPT_TYPE_RATIONAL, > - AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length > + /** > + * Underlying C type is a uint8_t* that is either NULL or points to an array > + * allocated with the av_malloc() family of functions. The pointer is > + * immediately followed by an int containing the array length in bytes. > + */ > + AV_OPT_TYPE_BINARY, > + /** > + * Underlying C type is AVDictionary*. > + */ > AV_OPT_TYPE_DICT, > + /** > + * Underlying C type is uint64_t. > + */ > AV_OPT_TYPE_UINT64, > + /** > + * Special option type for declaring named constants. Does not correspond to > + * an actual field in the object, offset must be 0. > + */ > AV_OPT_TYPE_CONST, > - AV_OPT_TYPE_IMAGE_SIZE, ///< offset must point to two consecutive ints > + /** > + * Underlying C type is two consecutive integers. > + */ > + AV_OPT_TYPE_IMAGE_SIZE, > + /** > + * Underlying C type is enum AVPixelFormat. > + */ > AV_OPT_TYPE_PIXEL_FMT, > + /** > + * Underlying C type is enum AVSampleFormat. > + */ > AV_OPT_TYPE_SAMPLE_FMT, > - AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational > + /** > + * Underlying C type is AVRational. > + */ > + AV_OPT_TYPE_VIDEO_RATE, > + /** > + * Underlying C type is int64_t. > + */ > AV_OPT_TYPE_DURATION, > + /** > + * Underlying C type is uint8_t[4]. > + */ > AV_OPT_TYPE_COLOR, > + /** > + * Underlying C type is int. > + */ > AV_OPT_TYPE_BOOL, > + /** > + * Underlying C type is AVChannelLayout. > + */ > AV_OPT_TYPE_CHLAYOUT, > + /** > + * Underlying C type is unsigned int. > + */ > AV_OPT_TYPE_UINT, > > /** LGTM thx [...]
Quoting Michael Niedermayer (2024-08-20 22:57:37) > Hi > > On Sun, Aug 18, 2024 at 01:26:53PM +0200, Anton Khirnov wrote: > > --- > > libavutil/opt.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++-- > > 1 file changed, 75 insertions(+), 3 deletions(-) > > > > diff --git a/libavutil/opt.h b/libavutil/opt.h > > index 07e27a9208..23bc495158 100644 > > --- a/libavutil/opt.h > > +++ b/libavutil/opt.h > > @@ -240,26 +240,98 @@ > > * before the file is actually opened. > > */ > > > > +/** > > + * An option type determines: > > + * - for native access, the underlying C type of the field that an AVOption > > + * refers to; > > + * - for foreign access, the semantics of accessing the option through this API, > > + * e.g. which av_opt_get_*() and av_opt_set_*() functions can be called, or > > + * what format will av_opt_get()/av_opt_set() expect/produce. > > "foreign access" ? is this a standard/ common term ? > if not, maybe somone has a more descriptive more common term/idea The term is defined higher up in the file, cf. fc706276c05
On Thu, Aug 22, 2024 at 02:39:10PM +0200, Anton Khirnov wrote: > Quoting Michael Niedermayer (2024-08-20 22:57:37) > > Hi > > > > On Sun, Aug 18, 2024 at 01:26:53PM +0200, Anton Khirnov wrote: > > > --- > > > libavutil/opt.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++-- > > > 1 file changed, 75 insertions(+), 3 deletions(-) > > > > > > diff --git a/libavutil/opt.h b/libavutil/opt.h > > > index 07e27a9208..23bc495158 100644 > > > --- a/libavutil/opt.h > > > +++ b/libavutil/opt.h > > > @@ -240,26 +240,98 @@ > > > * before the file is actually opened. > > > */ > > > > > > +/** > > > + * An option type determines: > > > + * - for native access, the underlying C type of the field that an AVOption > > > + * refers to; > > > + * - for foreign access, the semantics of accessing the option through this API, > > > + * e.g. which av_opt_get_*() and av_opt_set_*() functions can be called, or > > > + * what format will av_opt_get()/av_opt_set() expect/produce. > > > > "foreign access" ? is this a standard/ common term ? > > if not, maybe somone has a more descriptive more common term/idea > > The term is defined higher up in the file, cf. fc706276c05 if it sounds fine to you, then no objection. I wonder if direct vs access through accessor functions are clearer terms though thx [...]
Quoting Michael Niedermayer (2024-08-23 21:30:06) > On Thu, Aug 22, 2024 at 02:39:10PM +0200, Anton Khirnov wrote: > > Quoting Michael Niedermayer (2024-08-20 22:57:37) > > > Hi > > > > > > On Sun, Aug 18, 2024 at 01:26:53PM +0200, Anton Khirnov wrote: > > > > --- > > > > libavutil/opt.h | 78 +++++++++++++++++++++++++++++++++++++++++++++++-- > > > > 1 file changed, 75 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/libavutil/opt.h b/libavutil/opt.h > > > > index 07e27a9208..23bc495158 100644 > > > > --- a/libavutil/opt.h > > > > +++ b/libavutil/opt.h > > > > @@ -240,26 +240,98 @@ > > > > * before the file is actually opened. > > > > */ > > > > > > > > +/** > > > > + * An option type determines: > > > > + * - for native access, the underlying C type of the field that an AVOption > > > > + * refers to; > > > > + * - for foreign access, the semantics of accessing the option through this API, > > > > + * e.g. which av_opt_get_*() and av_opt_set_*() functions can be called, or > > > > + * what format will av_opt_get()/av_opt_set() expect/produce. > > > > > > "foreign access" ? is this a standard/ common term ? > > > if not, maybe somone has a more descriptive more common term/idea > > > > The term is defined higher up in the file, cf. fc706276c05 > > if it sounds fine to you, then no objection. > I wonder if direct vs access through accessor functions are clearer > terms though That's not what the difference is.
diff --git a/libavutil/opt.h b/libavutil/opt.h index 07e27a9208..23bc495158 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -240,26 +240,98 @@ * before the file is actually opened. */ +/** + * An option type determines: + * - for native access, the underlying C type of the field that an AVOption + * refers to; + * - for foreign access, the semantics of accessing the option through this API, + * e.g. which av_opt_get_*() and av_opt_set_*() functions can be called, or + * what format will av_opt_get()/av_opt_set() expect/produce. + */ enum AVOptionType{ + /** + * Underlying C type is unsigned int. + */ AV_OPT_TYPE_FLAGS = 1, + /** + * Underlying C type is int. + */ AV_OPT_TYPE_INT, + /** + * Underlying C type is int64_t. + */ AV_OPT_TYPE_INT64, + /** + * Underlying C type is double. + */ AV_OPT_TYPE_DOUBLE, + /** + * Underlying C type is float. + */ AV_OPT_TYPE_FLOAT, + /** + * Underlying C type is a uint8_t* that is either NULL or points to a C + * string allocated with the av_malloc() family of functions. + */ AV_OPT_TYPE_STRING, + /** + * Underlying C type is AVRational. + */ AV_OPT_TYPE_RATIONAL, - AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + /** + * Underlying C type is a uint8_t* that is either NULL or points to an array + * allocated with the av_malloc() family of functions. The pointer is + * immediately followed by an int containing the array length in bytes. + */ + AV_OPT_TYPE_BINARY, + /** + * Underlying C type is AVDictionary*. + */ AV_OPT_TYPE_DICT, + /** + * Underlying C type is uint64_t. + */ AV_OPT_TYPE_UINT64, + /** + * Special option type for declaring named constants. Does not correspond to + * an actual field in the object, offset must be 0. + */ AV_OPT_TYPE_CONST, - AV_OPT_TYPE_IMAGE_SIZE, ///< offset must point to two consecutive ints + /** + * Underlying C type is two consecutive integers. + */ + AV_OPT_TYPE_IMAGE_SIZE, + /** + * Underlying C type is enum AVPixelFormat. + */ AV_OPT_TYPE_PIXEL_FMT, + /** + * Underlying C type is enum AVSampleFormat. + */ AV_OPT_TYPE_SAMPLE_FMT, - AV_OPT_TYPE_VIDEO_RATE, ///< offset must point to AVRational + /** + * Underlying C type is AVRational. + */ + AV_OPT_TYPE_VIDEO_RATE, + /** + * Underlying C type is int64_t. + */ AV_OPT_TYPE_DURATION, + /** + * Underlying C type is uint8_t[4]. + */ AV_OPT_TYPE_COLOR, + /** + * Underlying C type is int. + */ AV_OPT_TYPE_BOOL, + /** + * Underlying C type is AVChannelLayout. + */ AV_OPT_TYPE_CHLAYOUT, + /** + * Underlying C type is unsigned int. + */ AV_OPT_TYPE_UINT, /**