[FFmpeg-devel] [PATCH 04/12] avcodec/avcodec: add AVCodecContext.alpha_mode

James Almer jamrial at gmail.com
Wed Feb 19 23:04:18 EET 2025


On 2/19/2025 5:45 PM, Niklas Haas wrote:
> From: Niklas Haas <git at haasn.dev>
> 
> Following in the footsteps of the previous commit, this commit adds the
> new fields to AVCodecContext so we can start properly setting it on codecs,
> as well as limiting the list of supported options to detect a format mismatch
> during encode.
> 
> This commit also sets up the necessary infrastructure to start using the
> newly added field in all codecs.
> ---
>   doc/APIchanges              | 4 ++++
>   doc/codecs.texi             | 8 ++++++++
>   libavcodec/avcodec.c        | 6 ++++++
>   libavcodec/avcodec.h        | 8 ++++++++
>   libavcodec/codec_internal.h | 5 +++++
>   libavcodec/codec_par.c      | 3 +++
>   libavcodec/codec_par.h      | 5 +++++
>   libavcodec/decode.c         | 2 ++
>   libavcodec/options_table.h  | 5 +++++
>   libavcodec/version.h        | 4 ++--
>   10 files changed, 48 insertions(+), 2 deletions(-)
> 

[...]

> diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
> index 47da41b0ad..32f853bc54 100644
> --- a/libavcodec/options_table.h
> +++ b/libavcodec/options_table.h
> @@ -358,6 +358,11 @@ static const AVOption avcodec_options[] = {
>   {"bottomleft",  "Bottom-left", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOMLEFT },  INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"},
>   {"bottom",      "Bottom",      0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOM },      INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"},
>   {"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"},
> +{"alpha_mode", "alpha mode", OFFSET(alpha_mode), AV_OPT_TYPE_INT, {.i64 = AVALPHA_MODE_UNSPECIFIED }, 0, INT_MAX, V|E|D, .unit = "alpha_mode_type"},

Should it have the D flag if it's only settable by the user in encoding 
scenarios?

> +{"unknown",       "Unspecified",   0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_UNSPECIFIED   }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
> +{"unspecified",   "Unspecified",   0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_UNSPECIFIED   }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
> +{"premultiplied", "Premultiplied", 0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_PREMULTIPLIED }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
> +{"straight",      "Straight",      0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_STRAIGHT      }, 0, 0, V|E|D, .unit = "alpha_mode_type"},
>   {"log_level_offset", "set the log level offset", OFFSET(log_level_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX },
>   {"slices", "set the number of slices, used in parallelized encoding", OFFSET(slices), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E},
>   {"thread_type", "select multithreading type", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, {.i64 = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|A|E|D, .unit = "thread_type"},
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 62e7eba3db..0ef6c991f3 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,8 +29,8 @@
>   
>   #include "version_major.h"
>   
> -#define LIBAVCODEC_VERSION_MINOR  33
> -#define LIBAVCODEC_VERSION_MICRO 102
> +#define LIBAVCODEC_VERSION_MINOR  34
> +#define LIBAVCODEC_VERSION_MICRO 100
>   
>   #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                  LIBAVCODEC_VERSION_MINOR, \

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250219/d029b05c/attachment.sig>


More information about the ffmpeg-devel mailing list