From 8a322c956f3808a7199aef9b63a187af17c0a372 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 26 Oct 2025 17:40:02 +0100 Subject: [PATCH] avcodec/avcodec: Schedule parser API to use enum AVCodecID for codec ids Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt --- doc/APIchanges | 4 ++++ libavcodec/avcodec.h | 8 ++++++++ libavcodec/parser.c | 4 ++++ libavcodec/parser_internal.h | 4 ++++ libavcodec/version.h | 2 +- libavcodec/version_major.h | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 293b5c4883..d1e535d6e8 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2025-03-28 API changes, most recent first: +2025-11-01 - xxxxxxxxxx - lavc 62.19.100 - avcodec.h + Schedule AVCodecParser and av_parser_init() to use enum AVCodecID + for codec ids on the next major version bump. + 2025-11-01 - xxxxxxxxxx - lavc 62.18.100 - avcodec.h Deprecate AVCodecParser fields priv_data_size, parser_init, parser_parse, parser_close, and split with no replacement. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 4027ae3316..91bd7cb7ef 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2732,7 +2732,11 @@ typedef struct AVCodecParserContext { } AVCodecParserContext; typedef struct AVCodecParser { +#if FF_API_PARSER_CODECID int codec_ids[7]; /* several codec IDs are permitted */ +#else + enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */ +#endif #if FF_API_PARSER_PRIVATE /***************************************************************** * All fields below this line are not part of the public API. They @@ -2770,7 +2774,11 @@ typedef struct AVCodecParser { */ const AVCodecParser *av_parser_iterate(void **opaque); +#if FF_API_PARSER_CODECID AVCodecParserContext *av_parser_init(int codec_id); +#else +AVCodecParserContext *av_parser_init(enum AVCodecID codec_id); +#endif /** * Parse a packet. diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 789bd9d1f1..12fdc3bb58 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -31,7 +31,11 @@ #include "parser.h" #include "parser_internal.h" +#if FF_API_PARSER_CODECID av_cold AVCodecParserContext *av_parser_init(int codec_id) +#else +av_cold AVCodecParserContext *av_parser_init(enum AVCodecID codec_id) +#endif { AVCodecParserContext *s = NULL; const AVCodecParser *parser; diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h index cb1995de8b..e366b5576a 100644 --- a/libavcodec/parser_internal.h +++ b/libavcodec/parser_internal.h @@ -28,7 +28,11 @@ #if FF_API_PARSER_PRIVATE typedef union FFCodecParser { struct { +#if FF_API_PARSER_CODECID int codec_ids[7]; /* several codec IDs are permitted */ +#else + enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */ +#endif int priv_data_size; int (*init)(AVCodecParserContext *s); int (*parse)(AVCodecParserContext *s, diff --git a/libavcodec/version.h b/libavcodec/version.h index 65bc52fb24..4b7ec515fe 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 18 +#define LIBAVCODEC_VERSION_MINOR 19 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h index be95bafca0..5eed53e038 100644 --- a/libavcodec/version_major.h +++ b/libavcodec/version_major.h @@ -46,6 +46,7 @@ #define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63) #define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63) // reminder to remove the OMX encoder on next major bump #define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)