* [FFmpeg-devel] [PATCH] Schedule semi-private AVCodecParser fields for removal from avcodec.h (PR #20757)
@ 2025-10-26 23:13 mkver via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: mkver via ffmpeg-devel @ 2025-10-26 23:13 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: mkver
PR #20757 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20757
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20757.patch
>From a6fe151ebef1150fe8145cae1281ba9960272002 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 26 Oct 2025 09:33:25 +0100
Subject: [PATCH 1/5] avcodec: Remove unnecessary parser.h inclusions
It only contains declarations for some auxiliary functions for parsing
that parsers that only work with complete packets don't need.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/av1_parser.c | 2 +-
libavcodec/cook_parser.c | 2 +-
libavcodec/dvaudio_parser.c | 2 +-
libavcodec/dvd_nav_parser.c | 4 ++--
libavcodec/vp3_parser.c | 2 +-
libavcodec/vp9_parser.c | 5 ++---
libavcodec/xma_parser.c | 2 +-
7 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index ed6e1b61ad..0a07a9647e 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -24,9 +24,9 @@
#include "libavutil/avassert.h"
#include "av1_parse.h"
+#include "avcodec.h"
#include "cbs.h"
#include "cbs_av1.h"
-#include "parser.h"
typedef struct AV1ParseContext {
CodedBitstreamContext *cbc;
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index 0d9473845e..404f611cf4 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -28,7 +28,7 @@
#include <stdint.h>
#include "libavutil/intreadwrite.h"
-#include "parser.h"
+#include "avcodec.h"
typedef struct CookParseContext {
int duration;
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index ef6bd45582..e99ffc0517 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -23,7 +23,7 @@
* Determines the duration for each packet.
*/
-#include "parser.h"
+#include "avcodec.h"
#include "dvaudio.h"
static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index 3ea4cd1ef5..3005a10572 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -18,9 +18,9 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
#include "avcodec.h"
-#include "get_bits.h"
-#include "parser.h"
+#include "libavutil/intreadwrite.h"
#define PCI_SIZE 980
#define DSI_SIZE 1018
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index 1bed43e779..e8bfebdc39 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "parser.h"
+#include "avcodec.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index ffcb93505f..72df554da5 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -21,9 +21,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "libavutil/intreadwrite.h"
-#include "libavcodec/get_bits.h"
-#include "parser.h"
+#include "avcodec.h"
+#include "get_bits.h"
static int parse(AVCodecParserContext *ctx,
AVCodecContext *avctx,
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index dc8a197c67..26db266a3e 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -21,7 +21,7 @@
* XMA2 audio parser
*/
-#include "parser.h"
+#include "avcodec.h"
typedef struct XMAParserContext{
int skip_packets;
--
2.49.1
>From 0e799d3f7685f2a12239a27c16c04f6f151dd023 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 26 Oct 2025 13:16:27 +0100
Subject: [PATCH 2/5] avcodec/parsers: Add macro to set list of codec ids
The current code relies on AV_CODEC_ID_NONE being zero, so that
unused codec ids are set to their proper value. This commit adds
a macro to set unset ids to AV_CODEC_ID_NONE.
(The actual rationale for this macro is to simplify
the transition to making the private fields that are
currently public in avcodec.h really private.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aac_parser.c | 3 ++-
libavcodec/ac3_parser.c | 3 ++-
libavcodec/adx_parser.c | 4 ++--
libavcodec/ahx_parser.c | 3 ++-
libavcodec/amr_parser.c | 3 ++-
libavcodec/apv_parser.c | 3 ++-
libavcodec/av1_parser.c | 3 ++-
libavcodec/avs2_parser.c | 3 ++-
libavcodec/avs3_parser.c | 3 ++-
libavcodec/bmp_parser.c | 3 ++-
libavcodec/cavs_parser.c | 3 ++-
libavcodec/cook_parser.c | 3 ++-
libavcodec/cri_parser.c | 3 ++-
libavcodec/dca_parser.c | 3 ++-
libavcodec/dirac_parser.c | 3 ++-
libavcodec/dnxhd_parser.c | 3 ++-
libavcodec/dnxuc_parser.c | 3 ++-
libavcodec/dolby_e_parser.c | 3 ++-
libavcodec/dpx_parser.c | 3 ++-
libavcodec/dvaudio_parser.c | 3 ++-
libavcodec/dvbsub_parser.c | 3 ++-
libavcodec/dvd_nav_parser.c | 3 ++-
libavcodec/dvdsub_parser.c | 3 ++-
libavcodec/evc_parser.c | 3 ++-
libavcodec/ffv1_parser.c | 3 ++-
libavcodec/flac_parser.c | 3 ++-
libavcodec/ftr_parser.c | 3 ++-
libavcodec/g723_1_parser.c | 3 ++-
libavcodec/g729_parser.c | 3 ++-
libavcodec/gif_parser.c | 3 ++-
libavcodec/gsm_parser.c | 3 ++-
libavcodec/h261_parser.c | 3 ++-
libavcodec/h263_parser.c | 3 ++-
libavcodec/h264_parser.c | 3 ++-
libavcodec/hdr_parser.c | 3 ++-
libavcodec/hevc/parser.c | 3 ++-
libavcodec/ipu_parser.c | 3 ++-
libavcodec/jpeg2000_parser.c | 3 ++-
libavcodec/jpegxl_parser.c | 3 ++-
libavcodec/latm_parser.c | 3 ++-
libavcodec/misc4_parser.c | 3 ++-
libavcodec/mjpeg_parser.c | 3 ++-
libavcodec/mlp_parser.c | 3 ++-
libavcodec/mpeg4video_parser.c | 3 ++-
libavcodec/mpegaudio_parser.c | 4 +++-
libavcodec/mpegvideo_parser.c | 3 ++-
libavcodec/opus/parser.c | 3 ++-
libavcodec/parser_internal.h | 38 ++++++++++++++++++++++++++++++++++
libavcodec/png_parser.c | 3 ++-
libavcodec/pnm_parser.c | 7 ++++---
libavcodec/prores_parser.c | 3 ++-
libavcodec/prores_raw_parser.c | 3 ++-
libavcodec/qoi_parser.c | 3 ++-
libavcodec/rv34_parser.c | 3 ++-
libavcodec/sbc_parser.c | 3 ++-
libavcodec/sipr_parser.c | 3 ++-
libavcodec/tak_parser.c | 3 ++-
libavcodec/vc1_parser.c | 3 ++-
libavcodec/vorbis_parser.c | 3 ++-
libavcodec/vp3_parser.c | 7 +++----
libavcodec/vp8_parser.c | 3 ++-
libavcodec/vp9_parser.c | 3 ++-
libavcodec/vvc_parser.c | 3 ++-
libavcodec/webp_parser.c | 3 ++-
libavcodec/xbm_parser.c | 3 ++-
libavcodec/xma_parser.c | 3 ++-
libavcodec/xwd_parser.c | 3 ++-
67 files changed, 174 insertions(+), 72 deletions(-)
create mode 100644 libavcodec/parser_internal.h
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index 186fcd887a..ce7d2f58e0 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -24,6 +24,7 @@
#include "aac_ac3_parser.h"
#include "adts_header.h"
#include "adts_parser.h"
+#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
static int aac_sync(uint64_t state, int *need_next_header, int *new_frame_start)
@@ -52,7 +53,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
const AVCodecParser ff_aac_parser = {
- .codec_ids = { AV_CODEC_ID_AAC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = aac_parse_init,
.parser_parse = ff_aac_ac3_parse,
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index a8bc3afc74..fe7f0fee61 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -31,6 +31,7 @@
#include "ac3_parser_internal.h"
#include "aac_ac3_parser.h"
#include "get_bits.h"
+#include "parser_internal.h"
#define AC3_HEADER_SIZE 7
@@ -478,7 +479,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
const AVCodecParser ff_ac3_parser = {
- .codec_ids = { AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = ac3_parse_init,
.parser_parse = ff_aac_ac3_parse,
diff --git a/libavcodec/adx_parser.c b/libavcodec/adx_parser.c
index 62b4415bc1..e11cc4a3bf 100644
--- a/libavcodec/adx_parser.c
+++ b/libavcodec/adx_parser.c
@@ -25,9 +25,9 @@
* Splits packets into individual blocks.
*/
-#include "libavutil/intreadwrite.h"
#include "parser.h"
#include "adx.h"
+#include "parser_internal.h"
typedef struct ADXParseContext {
ParseContext pc;
@@ -99,7 +99,7 @@ static int adx_parse(AVCodecParserContext *s1,
}
const AVCodecParser ff_adx_parser = {
- .codec_ids = { AV_CODEC_ID_ADPCM_ADX },
+ PARSER_CODEC_LIST(AV_CODEC_ID_ADPCM_ADX),
.priv_data_size = sizeof(ADXParseContext),
.parser_parse = adx_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/ahx_parser.c b/libavcodec/ahx_parser.c
index 4be037f666..07eaf697b3 100644
--- a/libavcodec/ahx_parser.c
+++ b/libavcodec/ahx_parser.c
@@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct AHXParseContext {
ParseContext pc;
@@ -71,7 +72,7 @@ static int ahx_parse(AVCodecParserContext *s1,
}
const AVCodecParser ff_ahx_parser = {
- .codec_ids = { AV_CODEC_ID_AHX },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AHX),
.priv_data_size = sizeof(AHXParseContext),
.parser_parse = ahx_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c
index 9484d720ee..ce1cd1be35 100644
--- a/libavcodec/amr_parser.c
+++ b/libavcodec/amr_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
static const uint8_t amrnb_packed_size[16] = {
13, 14, 16, 18, 20, 21, 27, 32, 6, 1, 1, 1, 1, 1, 1, 1
@@ -123,7 +124,7 @@ static int amr_parse(AVCodecParserContext *s1,
}
const AVCodecParser ff_amr_parser = {
- .codec_ids = { AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB),
.priv_data_size = sizeof(AMRParseContext),
.parser_init = amr_parse_init,
.parser_parse = amr_parse,
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
index fdd575339b..ffcaabf2f0 100644
--- a/libavcodec/apv_parser.c
+++ b/libavcodec/apv_parser.c
@@ -23,6 +23,7 @@
#include "apv.h"
#include "cbs.h"
#include "cbs_apv.h"
+#include "parser_internal.h"
typedef struct APVParseContext {
CodedBitstreamContext *cbc;
@@ -141,7 +142,7 @@ static av_cold void close(AVCodecParserContext *s)
}
const AVCodecParser ff_apv_parser = {
- .codec_ids = { AV_CODEC_ID_APV },
+ PARSER_CODEC_LIST(AV_CODEC_ID_APV),
.priv_data_size = sizeof(APVParseContext),
.parser_init = init,
.parser_parse = parse,
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 0a07a9647e..ba321d3ba5 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "cbs.h"
#include "cbs_av1.h"
+#include "parser_internal.h"
typedef struct AV1ParseContext {
CodedBitstreamContext *cbc;
@@ -210,7 +211,7 @@ static av_cold void av1_parser_close(AVCodecParserContext *ctx)
}
const AVCodecParser ff_av1_parser = {
- .codec_ids = { AV_CODEC_ID_AV1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AV1),
.priv_data_size = sizeof(AV1ParseContext),
.parser_init = av1_parser_init,
.parser_close = av1_parser_close,
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index 0d68ab1d00..b20181213b 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -23,6 +23,7 @@
#include "avs2.h"
#include "get_bits.h"
#include "parser.h"
+#include "parser_internal.h"
static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@@ -190,7 +191,7 @@ static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_avs2_parser = {
- .codec_ids = { AV_CODEC_ID_AVS2 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AVS2),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs2_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index 71278c7e2d..4fa1c983c5 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -24,6 +24,7 @@
#include "avs3.h"
#include "get_bits.h"
#include "parser.h"
+#include "parser_internal.h"
static int avs3_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@@ -173,7 +174,7 @@ static int avs3_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_avs3_parser = {
- .codec_ids = { AV_CODEC_ID_AVS3 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AVS3),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs3_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index 3440794b2c..84cdc9e873 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct BMPParseContext {
ParseContext pc;
@@ -106,7 +107,7 @@ flush:
}
const AVCodecParser ff_bmp_parser = {
- .codec_ids = { AV_CODEC_ID_BMP },
+ PARSER_CODEC_LIST(AV_CODEC_ID_BMP),
.priv_data_size = sizeof(BMPParseContext),
.parser_parse = bmp_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index 4a03effd0f..b71f226c75 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -27,6 +27,7 @@
#include "parser.h"
#include "cavs.h"
+#include "parser_internal.h"
/**
@@ -97,7 +98,7 @@ static int cavsvideo_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_cavsvideo_parser = {
- .codec_ids = { AV_CODEC_ID_CAVS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_CAVS),
.priv_data_size = sizeof(ParseContext),
.parser_parse = cavsvideo_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index 404f611cf4..f9e3a9db15 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -29,6 +29,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "parser_internal.h"
typedef struct CookParseContext {
int duration;
@@ -54,7 +55,7 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_cook_parser = {
- .codec_ids = { AV_CODEC_ID_COOK },
+ PARSER_CODEC_LIST(AV_CODEC_ID_COOK),
.priv_data_size = sizeof(CookParseContext),
.parser_parse = cook_parse,
};
diff --git a/libavcodec/cri_parser.c b/libavcodec/cri_parser.c
index 9295f823ce..356f35a00c 100644
--- a/libavcodec/cri_parser.c
+++ b/libavcodec/cri_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct CRIParser {
ParseContext pc;
@@ -98,7 +99,7 @@ static int cri_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_cri_parser = {
- .codec_ids = { AV_CODEC_ID_CRI },
+ PARSER_CODEC_LIST(AV_CODEC_ID_CRI),
.priv_data_size = sizeof(CRIParser),
.parser_parse = cri_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index eb0ef55d46..b9e9191cbc 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -29,6 +29,7 @@
#include "dca_syncwords.h"
#include "get_bits.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct DCAParseContext {
ParseContext pc;
@@ -344,7 +345,7 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_dca_parser = {
- .codec_ids = { AV_CODEC_ID_DTS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DTS),
.priv_data_size = sizeof(DCAParseContext),
.parser_init = dca_parse_init,
.parser_parse = dca_parse,
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 61f8067001..96ab6c7780 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -34,6 +34,7 @@
#include "libavutil/mem.h"
#include "avcodec.h"
+#include "parser_internal.h"
#define DIRAC_PARSE_INFO_PREFIX 0x42424344
@@ -275,7 +276,7 @@ static av_cold void dirac_parse_close(AVCodecParserContext *s)
}
const AVCodecParser ff_dirac_parser = {
- .codec_ids = { AV_CODEC_ID_DIRAC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DIRAC),
.priv_data_size = sizeof(DiracParseContext),
.parser_parse = dirac_parse,
.parser_close = dirac_parse_close,
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 631ac83860..09d8dce1e5 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -26,6 +26,7 @@
#include "parser.h"
#include "dnxhddata.h"
+#include "parser_internal.h"
typedef struct {
ParseContext pc;
@@ -139,7 +140,7 @@ static int dnxhd_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dnxhd_parser = {
- .codec_ids = { AV_CODEC_ID_DNXHD },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DNXHD),
.priv_data_size = sizeof(DNXHDParserContext),
.parser_parse = dnxhd_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index 34088ac3b1..bfed6b5b6f 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
#include "libavutil/bswap.h"
typedef struct DNxUcParseContext {
@@ -82,7 +83,7 @@ static int dnxuc_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dnxuc_parser = {
- .codec_ids = { AV_CODEC_ID_DNXUC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DNXUC),
.priv_data_size = sizeof(DNxUcParseContext),
.parser_parse = dnxuc_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dolby_e_parser.c b/libavcodec/dolby_e_parser.c
index d2566e5446..53bf44d86e 100644
--- a/libavcodec/dolby_e_parser.c
+++ b/libavcodec/dolby_e_parser.c
@@ -21,6 +21,7 @@
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "dolby_e.h"
+#include "parser_internal.h"
typedef struct DBEParseContext {
DBEContext dectx;
@@ -66,7 +67,7 @@ end:
}
const AVCodecParser ff_dolby_e_parser = {
- .codec_ids = { AV_CODEC_ID_DOLBY_E },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DOLBY_E),
.priv_data_size = sizeof(DBEParseContext),
.parser_parse = dolby_e_parse,
};
diff --git a/libavcodec/dpx_parser.c b/libavcodec/dpx_parser.c
index b74e6c5c68..9ca17bd94d 100644
--- a/libavcodec/dpx_parser.c
+++ b/libavcodec/dpx_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct DPXParseContext {
ParseContext pc;
@@ -109,7 +110,7 @@ flush:
}
const AVCodecParser ff_dpx_parser = {
- .codec_ids = { AV_CODEC_ID_DPX },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DPX),
.priv_data_size = sizeof(DPXParseContext),
.parser_parse = dpx_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index e99ffc0517..1b4253aa83 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -25,6 +25,7 @@
#include "avcodec.h"
#include "dvaudio.h"
+#include "parser_internal.h"
static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@@ -41,6 +42,6 @@ static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_dvaudio_parser = {
- .codec_ids = { AV_CODEC_ID_DVAUDIO },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVAUDIO),
.parser_parse = dvaudio_parse,
};
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index b2d5446867..68c2b77b39 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "parser_internal.h"
/* Parser (mostly) copied from dvdsub.c */
@@ -164,7 +165,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dvbsub_parser = {
- .codec_ids = { AV_CODEC_ID_DVB_SUBTITLE },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVB_SUBTITLE),
.priv_data_size = sizeof(DVBSubParseContext),
.parser_parse = dvbsub_parse,
};
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index 3005a10572..bb8c284ad5 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -20,6 +20,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
#define PCI_SIZE 980
@@ -108,7 +109,7 @@ static int dvd_nav_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_dvd_nav_parser = {
- .codec_ids = { AV_CODEC_ID_DVD_NAV },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVD_NAV),
.priv_data_size = sizeof(DVDNavParseContext),
.parser_init = dvd_nav_parse_init,
.parser_parse = dvd_nav_parse,
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index 8871b6a383..fd5baf719f 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -24,6 +24,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avcodec.h"
+#include "parser_internal.h"
/* parser definition */
typedef struct DVDSubParseContext {
@@ -85,7 +86,7 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
}
const AVCodecParser ff_dvdsub_parser = {
- .codec_ids = { AV_CODEC_ID_DVD_SUBTITLE },
+ PARSER_CODEC_LIST(AV_CODEC_ID_DVD_SUBTITLE),
.priv_data_size = sizeof(DVDSubParseContext),
.parser_parse = dvdsub_parse,
.parser_close = dvdsub_parse_close,
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index ea6675693e..5cd9b5544c 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -24,6 +24,7 @@
#include "bytestream.h"
#include "evc.h"
#include "evc_parse.h"
+#include "parser_internal.h"
#include "libavutil/attributes.h"
@@ -372,7 +373,7 @@ static av_cold void evc_parser_close(AVCodecParserContext *s)
}
const AVCodecParser ff_evc_parser = {
- .codec_ids = { AV_CODEC_ID_EVC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_EVC),
.priv_data_size = sizeof(EVCParserContext),
.parser_parse = evc_parse,
.parser_close = evc_parser_close,
diff --git a/libavcodec/ffv1_parser.c b/libavcodec/ffv1_parser.c
index e54854d84f..5f17d6a75b 100644
--- a/libavcodec/ffv1_parser.c
+++ b/libavcodec/ffv1_parser.c
@@ -18,6 +18,7 @@
#include "avcodec.h"
#include "ffv1.h"
+#include "parser_internal.h"
#include "rangecoder.h"
#include "libavutil/attributes.h"
@@ -81,7 +82,7 @@ static av_cold void ffv1_close(AVCodecParserContext *s)
}
const AVCodecParser ff_ffv1_parser = {
- .codec_ids = { AV_CODEC_ID_FFV1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_FFV1),
.priv_data_size = sizeof(FFV1ParseContext),
.parser_parse = parse,
.parser_close = ffv1_close,
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index c310832617..ed0f4bc336 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -36,6 +36,7 @@
#include "libavutil/crc.h"
#include "libavutil/mem.h"
#include "flac_parse.h"
+#include "parser_internal.h"
/** maximum number of adjacent headers that compare CRCs against each other */
#define FLAC_MAX_SEQUENTIAL_HEADERS 4
@@ -903,7 +904,7 @@ static av_cold void flac_parse_close(AVCodecParserContext *c)
}
const AVCodecParser ff_flac_parser = {
- .codec_ids = { AV_CODEC_ID_FLAC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_FLAC),
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,
.parser_parse = flac_parse,
diff --git a/libavcodec/ftr_parser.c b/libavcodec/ftr_parser.c
index 656fd289f6..422b775d7c 100644
--- a/libavcodec/ftr_parser.c
+++ b/libavcodec/ftr_parser.c
@@ -28,6 +28,7 @@
#include "adts_header.h"
#include "adts_parser.h"
#include "mpeg4audio.h"
+#include "parser_internal.h"
typedef struct FTRParseContext {
ParseContext pc;
@@ -97,7 +98,7 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_ftr_parser = {
- .codec_ids = { AV_CODEC_ID_FTR },
+ PARSER_CODEC_LIST(AV_CODEC_ID_FTR),
.priv_data_size = sizeof(FTRParseContext),
.parser_parse = ftr_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/g723_1_parser.c b/libavcodec/g723_1_parser.c
index 2ed1a8ab19..0deec9fdf8 100644
--- a/libavcodec/g723_1_parser.c
+++ b/libavcodec/g723_1_parser.c
@@ -23,6 +23,7 @@
#include "parser.h"
#include "g723_1.h"
+#include "parser_internal.h"
typedef struct G723_1ParseContext {
ParseContext pc;
@@ -53,7 +54,7 @@ static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_g723_1_parser = {
- .codec_ids = { AV_CODEC_ID_G723_1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_G723_1),
.priv_data_size = sizeof(G723_1ParseContext),
.parser_parse = g723_1_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index d51a78877d..c107436a42 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -27,6 +27,7 @@
#include "parser.h"
#include "g729.h"
+#include "parser_internal.h"
typedef struct G729ParseContext {
ParseContext pc;
@@ -85,7 +86,7 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_g729_parser = {
- .codec_ids = { AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN },
+ PARSER_CODEC_LIST(AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN),
.priv_data_size = sizeof(G729ParseContext),
.parser_parse = g729_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/gif_parser.c b/libavcodec/gif_parser.c
index f5903585fa..ceb03b0aab 100644
--- a/libavcodec/gif_parser.c
+++ b/libavcodec/gif_parser.c
@@ -26,6 +26,7 @@
#include "gif.h"
#include "parser.h"
+#include "parser_internal.h"
typedef enum GIFParseStates {
GIF_HEADER = 1,
@@ -201,7 +202,7 @@ static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_gif_parser = {
- .codec_ids = { AV_CODEC_ID_GIF },
+ PARSER_CODEC_LIST(AV_CODEC_ID_GIF),
.priv_data_size = sizeof(GIFParseContext),
.parser_parse = gif_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c
index 3492806052..0162bdcc13 100644
--- a/libavcodec/gsm_parser.c
+++ b/libavcodec/gsm_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/avassert.h"
#include "parser.h"
#include "gsm.h"
+#include "parser_internal.h"
typedef struct GSMParseContext {
ParseContext pc;
@@ -84,7 +85,7 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_gsm_parser = {
- .codec_ids = { AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),
.priv_data_size = sizeof(GSMParseContext),
.parser_parse = gsm_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
index e0b84c509e..7bd912f8bf 100644
--- a/libavcodec/h261_parser.c
+++ b/libavcodec/h261_parser.c
@@ -26,6 +26,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
static int h261_find_frame_end(ParseContext *pc, AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
@@ -87,7 +88,7 @@ static int h261_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_h261_parser = {
- .codec_ids = { AV_CODEC_ID_H261 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_H261),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h261_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index f70a791177..2df6182d78 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
static int h263_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
{
@@ -88,7 +89,7 @@ static int h263_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_h263_parser = {
- .codec_ids = { AV_CODEC_ID_H263 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_H263),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h263_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 722cbcb42f..9d3158d183 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -49,6 +49,7 @@
#include "mpegutils.h"
#include "parser.h"
#include "libavutil/refstruct.h"
+#include "parser_internal.h"
#include "startcode.h"
typedef struct H264ParseContext {
@@ -683,7 +684,7 @@ static av_cold int init(AVCodecParserContext *s)
}
const AVCodecParser ff_h264_parser = {
- .codec_ids = { AV_CODEC_ID_H264 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_H264),
.priv_data_size = sizeof(H264ParseContext),
.parser_init = init,
.parser_parse = h264_parse,
diff --git a/libavcodec/hdr_parser.c b/libavcodec/hdr_parser.c
index 915fd38225..af8ffd06ca 100644
--- a/libavcodec/hdr_parser.c
+++ b/libavcodec/hdr_parser.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct HDRParseContext {
ParseContext pc;
@@ -72,7 +73,7 @@ static int hdr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_hdr_parser = {
- .codec_ids = { AV_CODEC_ID_RADIANCE_HDR },
+ PARSER_CODEC_LIST(AV_CODEC_ID_RADIANCE_HDR),
.priv_data_size = sizeof(HDRParseContext),
.parser_parse = hdr_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c
index 16b40e2b10..1a6b7987a3 100644
--- a/libavcodec/hevc/parser.c
+++ b/libavcodec/hevc/parser.c
@@ -25,6 +25,7 @@
#include "golomb.h"
#include "hevc.h"
+#include "parser_internal.h"
#include "parse.h"
#include "ps.h"
#include "sei.h"
@@ -353,7 +354,7 @@ static void hevc_parser_close(AVCodecParserContext *s)
}
const AVCodecParser ff_hevc_parser = {
- .codec_ids = { AV_CODEC_ID_HEVC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_HEVC),
.priv_data_size = sizeof(HEVCParserContext),
.parser_parse = hevc_parse,
.parser_close = hevc_parser_close,
diff --git a/libavcodec/ipu_parser.c b/libavcodec/ipu_parser.c
index 1193a65b1b..d278e8b449 100644
--- a/libavcodec/ipu_parser.c
+++ b/libavcodec/ipu_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct IPUParseContext {
ParseContext pc;
@@ -70,7 +71,7 @@ static int ipu_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_ipu_parser = {
- .codec_ids = { AV_CODEC_ID_IPU },
+ PARSER_CODEC_LIST(AV_CODEC_ID_IPU),
.priv_data_size = sizeof(IPUParseContext),
.parser_parse = ipu_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index e96efc28ed..2ef29582a7 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
/* Whether frame is jp2 file or codestream
*/
@@ -212,7 +213,7 @@ static int jpeg2000_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_jpeg2000_parser = {
- .codec_ids = { AV_CODEC_ID_JPEG2000 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_JPEG2000),
.priv_data_size = sizeof(JPEG2000ParserContext),
.parser_parse = jpeg2000_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index 3981b0cec0..ca00a86a0b 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -32,6 +32,7 @@
#include "bytestream.h"
#include "codec_id.h"
+#include "parser_internal.h"
#define UNCHECKED_BITSTREAM_READER 0
#define BITSTREAM_READER_LE
#include "get_bits.h"
@@ -1546,7 +1547,7 @@ flush:
}
const AVCodecParser ff_jpegxl_parser = {
- .codec_ids = { AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM),
.priv_data_size = sizeof(JXLParseContext),
.parser_parse = jpegxl_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c
index 8cc2024c4f..b06103aef8 100644
--- a/libavcodec/latm_parser.c
+++ b/libavcodec/latm_parser.c
@@ -25,6 +25,7 @@
#include <stdint.h>
#include "parser.h"
+#include "parser_internal.h"
#define LATM_HEADER 0x56e000 // 0x2b7 (11 bits)
#define LATM_MASK 0xFFE000 // top 11 bits
@@ -105,7 +106,7 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_aac_latm_parser = {
- .codec_ids = { AV_CODEC_ID_AAC_LATM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_AAC_LATM),
.priv_data_size = sizeof(LATMParseContext),
.parser_parse = latm_parse,
.parser_close = ff_parse_close
diff --git a/libavcodec/misc4_parser.c b/libavcodec/misc4_parser.c
index d234dbb629..867e9b0a4c 100644
--- a/libavcodec/misc4_parser.c
+++ b/libavcodec/misc4_parser.c
@@ -19,6 +19,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct MISC4Context {
ParseContext pc;
@@ -74,7 +75,7 @@ static int misc4_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_misc4_parser = {
- .codec_ids = { AV_CODEC_ID_MISC4 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MISC4),
.priv_data_size = sizeof(MISC4Context),
.parser_parse = misc4_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c
index 62b923b625..152580b354 100644
--- a/libavcodec/mjpeg_parser.c
+++ b/libavcodec/mjpeg_parser.c
@@ -27,6 +27,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct MJPEGParserContext{
ParseContext pc;
@@ -129,7 +130,7 @@ static int jpeg_parse(AVCodecParserContext *s,
const AVCodecParser ff_mjpeg_parser = {
- .codec_ids = { AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS),
.priv_data_size = sizeof(MJPEGParserContext),
.parser_parse = jpeg_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index d391390dd5..6ed0fa20a8 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -31,6 +31,7 @@
#include "parser.h"
#include "mlp_parse.h"
#include "mlp.h"
+#include "parser_internal.h"
typedef struct MLPParseContext
{
@@ -205,7 +206,7 @@ lost_sync:
}
const AVCodecParser ff_mlp_parser = {
- .codec_ids = { AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD),
.priv_data_size = sizeof(MLPParseContext),
.parser_init = mlp_init,
.parser_parse = mlp_parse,
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index a2a22234f2..5a75e250d1 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -27,6 +27,7 @@
#include "mpegvideo.h"
#include "mpeg4videodec.h"
#include "mpeg4videodefs.h"
+#include "parser_internal.h"
struct Mp4vParseContext {
ParseContext pc;
@@ -156,7 +157,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_mpeg4video_parser = {
- .codec_ids = { AV_CODEC_ID_MPEG4 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MPEG4),
.priv_data_size = sizeof(struct Mp4vParseContext),
.parser_init = mpeg4video_parse_init,
.parser_parse = mpeg4video_parse,
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index d54366f10a..865d9298d3 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -22,6 +22,7 @@
#include "parser.h"
#include "mpegaudiodecheader.h"
+#include "parser_internal.h"
#include "libavutil/common.h"
#include "libavformat/apetag.h" // for APE tag.
#include "libavformat/id3v1.h" // for ID3v1_TAG_SIZE
@@ -137,7 +138,8 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
const AVCodecParser ff_mpegaudio_parser = {
- .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MP1, AV_CODEC_ID_MP2,
+ AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU),
.priv_data_size = sizeof(MpegAudioParseContext),
.parser_parse = mpegaudio_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index cf9eaddf80..b80e70a740 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -25,6 +25,7 @@
#include "parser.h"
#include "mpeg12.h"
#include "mpeg12data.h"
+#include "parser_internal.h"
#include "startcode.h"
struct MpvParseContext {
@@ -300,7 +301,7 @@ static av_cold int mpegvideo_parse_init(AVCodecParserContext *s)
}
const AVCodecParser ff_mpegvideo_parser = {
- .codec_ids = { AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO },
+ PARSER_CODEC_LIST(AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO),
.priv_data_size = sizeof(struct MpvParseContext),
.parser_init = mpegvideo_parse_init,
.parser_parse = mpegvideo_parse,
diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index 9bf0b31fba..1fe011724c 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -31,6 +31,7 @@
#include "opus.h"
#include "parse.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct OpusParserContext {
ParseContext pc;
@@ -214,7 +215,7 @@ fail:
}
const AVCodecParser ff_opus_parser = {
- .codec_ids = { AV_CODEC_ID_OPUS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_OPUS),
.priv_data_size = sizeof(OpusParserContext),
.parser_parse = opus_parse,
.parser_close = ff_parse_close
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
new file mode 100644
index 0000000000..81ccceeedf
--- /dev/null
+++ b/libavcodec/parser_internal.h
@@ -0,0 +1,38 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_PARSER_INTERNAL_H
+#define AVCODEC_PARSER_INTERNAL_H
+
+#include "libavutil/macros.h"
+#include "codec_id.h"
+
+#define EIGTH_ARG(a,b,c,d,e,f,g,h,...) h
+#define NO_FAIL
+// Expands to nothing if <= 7 args; induces compilation failure if not.
+#define CHECK_FOR_TOO_MANY_IDS(...) AV_JOIN(EIGTH_ARG(__VA_ARGS__, NO, NO, NO, NO, NO, NO, NO, NO), _FAIL)
+
+// For compatibility with MSVC's old, spec-incompliant preprocessor.
+#define PASSTHROUGH(...) __VA_ARGS__
+#define FIRST_SEVEN2(a,b,c,d,e,f,g,...) a,b,c,d,e,f,g
+#define FIRST_SEVEN(...) PASSTHROUGH(FIRST_SEVEN2(__VA_ARGS__))
+#define TIMES_SEVEN(a) a,a,a,a,a,a,a
+#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
+ .codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
+
+#endif /* AVCODEC_PARSER_INTERNAL_H */
diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index 314de1b436..e4af1f2e09 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
#include "png.h"
typedef struct PNGParseContext {
@@ -111,7 +112,7 @@ flush:
}
const AVCodecParser ff_png_parser = {
- .codec_ids = { AV_CODEC_ID_PNG },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PNG),
.priv_data_size = sizeof(PNGParseContext),
.parser_parse = png_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 74f918a94b..65dbaf86f6 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -23,6 +23,7 @@
#include "libavutil/imgutils.h"
#include "parser.h" //for ParseContext
+#include "parser_internal.h"
#include "pnm.h"
typedef struct PNMParseContext {
@@ -134,9 +135,9 @@ end:
}
const AVCodecParser ff_pnm_parser = {
- .codec_ids = { AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
- AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
- AV_CODEC_ID_PHM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
+ AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
+ AV_CODEC_ID_PHM),
.priv_data_size = sizeof(PNMParseContext),
.parser_parse = pnm_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/prores_parser.c b/libavcodec/prores_parser.c
index d778f839bd..9b66c3b415 100644
--- a/libavcodec/prores_parser.c
+++ b/libavcodec/prores_parser.c
@@ -20,6 +20,7 @@
#include "bytestream.h"
#include "avcodec.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@@ -123,6 +124,6 @@ static int parse(AVCodecParserContext *s,
}
const AVCodecParser ff_prores_parser = {
- .codec_ids = { AV_CODEC_ID_PRORES },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PRORES),
.parser_parse = parse,
};
diff --git a/libavcodec/prores_raw_parser.c b/libavcodec/prores_raw_parser.c
index c67935a820..a3470d8cce 100644
--- a/libavcodec/prores_raw_parser.c
+++ b/libavcodec/prores_raw_parser.c
@@ -20,6 +20,7 @@
#include "parser.h"
#include "bytestream.h"
+#include "parser_internal.h"
static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
@@ -81,6 +82,6 @@ static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_prores_raw_parser = {
- .codec_ids = { AV_CODEC_ID_PRORES_RAW },
+ PARSER_CODEC_LIST(AV_CODEC_ID_PRORES_RAW),
.parser_parse = prores_raw_parse,
};
diff --git a/libavcodec/qoi_parser.c b/libavcodec/qoi_parser.c
index e5af11e948..1c20d334d0 100644
--- a/libavcodec/qoi_parser.c
+++ b/libavcodec/qoi_parser.c
@@ -25,6 +25,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct QOIParseContext {
ParseContext pc;
@@ -70,7 +71,7 @@ static int qoi_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_qoi_parser = {
- .codec_ids = { AV_CODEC_ID_QOI },
+ PARSER_CODEC_LIST(AV_CODEC_ID_QOI),
.priv_data_size = sizeof(QOIParseContext),
.parser_parse = qoi_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c
index 2997a4db70..3ce1abf60a 100644
--- a/libavcodec/rv34_parser.c
+++ b/libavcodec/rv34_parser.c
@@ -25,6 +25,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
#include "libavutil/intreadwrite.h"
typedef struct RV34ParseContext {
@@ -76,7 +77,7 @@ static int rv34_parse(AVCodecParserContext *s,
}
const AVCodecParser ff_rv34_parser = {
- .codec_ids = { AV_CODEC_ID_RV30, AV_CODEC_ID_RV40 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_RV30, AV_CODEC_ID_RV40),
.priv_data_size = sizeof(RV34ParseContext),
.parser_parse = rv34_parse,
};
diff --git a/libavcodec/sbc_parser.c b/libavcodec/sbc_parser.c
index 2d427cc7cb..9cd225aa7b 100644
--- a/libavcodec/sbc_parser.c
+++ b/libavcodec/sbc_parser.c
@@ -22,6 +22,7 @@
#include "sbc.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct SBCParseContext {
ParseContext pc;
@@ -117,7 +118,7 @@ static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_sbc_parser = {
- .codec_ids = { AV_CODEC_ID_SBC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_SBC),
.priv_data_size = sizeof(SBCParseContext),
.parser_parse = sbc_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/sipr_parser.c b/libavcodec/sipr_parser.c
index e01da3c8a8..89352663a5 100644
--- a/libavcodec/sipr_parser.c
+++ b/libavcodec/sipr_parser.c
@@ -22,6 +22,7 @@
*/
#include "parser.h"
+#include "parser_internal.h"
typedef struct SiprParserContext{
ParseContext pc;
@@ -67,7 +68,7 @@ static int sipr_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_sipr_parser = {
- .codec_ids = { AV_CODEC_ID_SIPR },
+ PARSER_CODEC_LIST(AV_CODEC_ID_SIPR),
.priv_data_size = sizeof(SiprParserContext),
.parser_parse = sipr_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
index 7f5f5314af..47931288b7 100644
--- a/libavcodec/tak_parser.c
+++ b/libavcodec/tak_parser.c
@@ -27,6 +27,7 @@
#define CACHED_BITSTREAM_READER !ARCH_X86_32
#define BITSTREAM_READER_LE
#include "parser.h"
+#include "parser_internal.h"
#include "tak.h"
typedef struct TAKParseContext {
@@ -124,7 +125,7 @@ fail:
}
const AVCodecParser ff_tak_parser = {
- .codec_ids = { AV_CODEC_ID_TAK },
+ PARSER_CODEC_LIST(AV_CODEC_ID_TAK),
.priv_data_size = sizeof(TAKParseContext),
.parser_parse = tak_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index 124a7a771f..7215e84355 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -28,6 +28,7 @@
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "parser.h"
+#include "parser_internal.h"
#include "vc1.h"
#include "get_bits.h"
#include "vc1dsp.h"
@@ -271,7 +272,7 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s)
}
const AVCodecParser ff_vc1_parser = {
- .codec_ids = { AV_CODEC_ID_VC1 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VC1),
.priv_data_size = sizeof(VC1ParseContext),
.parser_init = vc1_parse_init,
.parser_parse = vc1_parse,
diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index 25884b6b8a..a3b0a4e5c4 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -31,6 +31,7 @@
#include "libavutil/mem.h"
#include "get_bits.h"
+#include "parser_internal.h"
#include "xiph.h"
#include "vorbis_parser_internal.h"
@@ -336,7 +337,7 @@ static av_cold void vorbis_parser_close(AVCodecParserContext *ctx)
}
const AVCodecParser ff_vorbis_parser = {
- .codec_ids = { AV_CODEC_ID_VORBIS },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS),
.priv_data_size = sizeof(VorbisParseContext),
.parser_parse = vorbis_parse,
.parser_close = vorbis_parser_close,
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index e8bfebdc39..9be3f70596 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -19,6 +19,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@@ -36,9 +37,7 @@ static int parse(AVCodecParserContext *s,
}
const AVCodecParser ff_vp3_parser = {
- .codec_ids = {
- AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
- AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A
- },
+ PARSER_CODEC_LIST(AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
+ AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A),
.parser_parse = parse,
};
diff --git a/libavcodec/vp8_parser.c b/libavcodec/vp8_parser.c
index 98b752bfb9..14c0c1462b 100644
--- a/libavcodec/vp8_parser.c
+++ b/libavcodec/vp8_parser.c
@@ -19,6 +19,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
@@ -74,6 +75,6 @@ static int parse(AVCodecParserContext *s,
}
const AVCodecParser ff_vp8_parser = {
- .codec_ids = { AV_CODEC_ID_VP8 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VP8),
.parser_parse = parse,
};
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index 72df554da5..7e1a06201a 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -23,6 +23,7 @@
#include "avcodec.h"
#include "get_bits.h"
+#include "parser_internal.h"
static int parse(AVCodecParserContext *ctx,
AVCodecContext *avctx,
@@ -64,6 +65,6 @@ static int parse(AVCodecParserContext *ctx,
}
const AVCodecParser ff_vp9_parser = {
- .codec_ids = { AV_CODEC_ID_VP9 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VP9),
.parser_parse = parse,
};
diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index 0c7362dde4..4453aaa61d 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -24,6 +24,7 @@
#include "cbs.h"
#include "cbs_h266.h"
#include "parser.h"
+#include "parser_internal.h"
#define START_CODE 0x000001 ///< start_code_prefix_one_3bytes
#define IS_IDR(nut) (nut == VVC_IDR_W_RADL || nut == VVC_IDR_N_LP)
@@ -506,7 +507,7 @@ static av_cold void vvc_parser_close(AVCodecParserContext *s)
}
const AVCodecParser ff_vvc_parser = {
- .codec_ids = { AV_CODEC_ID_VVC },
+ PARSER_CODEC_LIST(AV_CODEC_ID_VVC),
.priv_data_size = sizeof(VVCParserContext),
.parser_init = vvc_parser_init,
.parser_close = vvc_parser_close,
diff --git a/libavcodec/webp_parser.c b/libavcodec/webp_parser.c
index bd5f94dac5..e3edc348e4 100644
--- a/libavcodec/webp_parser.c
+++ b/libavcodec/webp_parser.c
@@ -27,6 +27,7 @@
#include "libavutil/common.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct WebPParseContext {
ParseContext pc;
@@ -105,7 +106,7 @@ flush:
}
const AVCodecParser ff_webp_parser = {
- .codec_ids = { AV_CODEC_ID_WEBP },
+ PARSER_CODEC_LIST(AV_CODEC_ID_WEBP),
.priv_data_size = sizeof(WebPParseContext),
.parser_parse = webp_parse,
.parser_close = ff_parse_close,
diff --git a/libavcodec/xbm_parser.c b/libavcodec/xbm_parser.c
index 436aec96ab..c7e7ce9282 100644
--- a/libavcodec/xbm_parser.c
+++ b/libavcodec/xbm_parser.c
@@ -30,6 +30,7 @@
#include "libavutil/avutil.h"
#include "parser.h"
+#include "parser_internal.h"
typedef struct XBMParseContext {
ParseContext pc;
@@ -101,7 +102,7 @@ static int xbm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_xbm_parser = {
- .codec_ids = { AV_CODEC_ID_XBM },
+ PARSER_CODEC_LIST(AV_CODEC_ID_XBM),
.priv_data_size = sizeof(XBMParseContext),
.parser_init = xbm_init,
.parser_parse = xbm_parse,
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index 26db266a3e..eae39fd031 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -22,6 +22,7 @@
*/
#include "avcodec.h"
+#include "parser_internal.h"
typedef struct XMAParserContext{
int skip_packets;
@@ -56,7 +57,7 @@ static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
}
const AVCodecParser ff_xma_parser = {
- .codec_ids = { AV_CODEC_ID_XMA2 },
+ PARSER_CODEC_LIST(AV_CODEC_ID_XMA2),
.priv_data_size = sizeof(XMAParserContext),
.parser_parse = xma_parse,
};
diff --git a/libavcodec/xwd_parser.c b/libavcodec/xwd_parser.c
index ab5fe86070..cc554c3c97 100644
--- a/libavcodec/xwd_parser.c
+++ b/libavcodec/xwd_parser.c
@@ -26,6 +26,7 @@
#include "libavutil/intreadwrite.h"
#include "parser.h"
+#include "parser_internal.h"
#include "xwd.h"
typedef struct XWDParseContext {
@@ -96,7 +97,7 @@ static int xwd_parse(AVCodecParserContext *s, AVCodecContext *avctx,
}
const AVCodecParser ff_xwd_parser = {
- .codec_ids = { AV_CODEC_ID_XWD },
+ PARSER_CODEC_LIST(AV_CODEC_ID_XWD),
.priv_data_size = sizeof(XWDParseContext),
.parser_parse = xwd_parse,
.parser_close = ff_parse_close,
--
2.49.1
>From 4b109d07f3b2e5d5d6af23111721f55b39228ce4 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 26 Oct 2025 09:42:07 +0100
Subject: [PATCH 3/5] avcodec/avcodec: Schedule moving private fields of
AVCodecParser out of avcodec.h
AVCodecParser has several fields which are not really meant
to be accessed by users, but it has no public-private
demarkation line, so these fields are technically public
and can therefore not simply be made private like
20f972701806be20a77f808db332d9489343bb78 did for AVCodec.*
This commit therefore deprecates these fields and
schedules them to become private. All parsers have already
been switched to FFCodecParser, which (for now) is a union
of AVCodecParser and an unnamed clone of AVCodecParser
(new fields can be added at the end of this clone).
*: This is also the reason why split has never been removed despite
not being set for several years now.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
configure | 4 +-
doc/APIchanges | 5 ++
libavcodec/aac_parser.c | 2 +-
libavcodec/ac3_parser.c | 2 +-
libavcodec/adx_parser.c | 2 +-
libavcodec/ahx_parser.c | 2 +-
libavcodec/amr_parser.c | 2 +-
libavcodec/apv_parser.c | 2 +-
libavcodec/av1_parser.c | 2 +-
libavcodec/avcodec.h | 14 +++
libavcodec/avs2_parser.c | 2 +-
libavcodec/avs3_parser.c | 2 +-
libavcodec/bmp_parser.c | 2 +-
libavcodec/cavs_parser.c | 2 +-
libavcodec/cook_parser.c | 2 +-
libavcodec/cri_parser.c | 2 +-
libavcodec/dca_parser.c | 2 +-
libavcodec/dirac_parser.c | 2 +-
libavcodec/dnxhd_parser.c | 2 +-
libavcodec/dnxuc_parser.c | 2 +-
libavcodec/dolby_e_parser.c | 2 +-
libavcodec/dpx_parser.c | 2 +-
libavcodec/dvaudio_parser.c | 2 +-
libavcodec/dvbsub_parser.c | 2 +-
libavcodec/dvd_nav_parser.c | 2 +-
libavcodec/dvdsub_parser.c | 2 +-
libavcodec/evc_parser.c | 2 +-
libavcodec/ffv1_parser.c | 2 +-
libavcodec/flac_parser.c | 2 +-
libavcodec/ftr_parser.c | 2 +-
libavcodec/g723_1_parser.c | 2 +-
libavcodec/g729_parser.c | 2 +-
libavcodec/gif_parser.c | 2 +-
libavcodec/gsm_parser.c | 2 +-
libavcodec/h261_parser.c | 2 +-
libavcodec/h263_parser.c | 2 +-
libavcodec/h264_parser.c | 2 +-
libavcodec/hdr_parser.c | 2 +-
libavcodec/hevc/parser.c | 2 +-
libavcodec/ipu_parser.c | 2 +-
libavcodec/jpeg2000_parser.c | 2 +-
libavcodec/jpegxl_parser.c | 2 +-
libavcodec/latm_parser.c | 2 +-
libavcodec/misc4_parser.c | 2 +-
libavcodec/mjpeg_parser.c | 2 +-
libavcodec/mlp_parser.c | 2 +-
libavcodec/mpeg4video_parser.c | 2 +-
libavcodec/mpegaudio_parser.c | 2 +-
libavcodec/mpegvideo_parser.c | 2 +-
libavcodec/opus/parser.c | 2 +-
libavcodec/parser.c | 17 ++--
libavcodec/parser_internal.h | 41 +++++++++
libavcodec/parsers.c | 153 ++++++++++++++++++---------------
libavcodec/png_parser.c | 2 +-
libavcodec/pnm_parser.c | 2 +-
libavcodec/prores_parser.c | 2 +-
libavcodec/prores_raw_parser.c | 2 +-
libavcodec/qoi_parser.c | 2 +-
libavcodec/rv34_parser.c | 2 +-
libavcodec/sbc_parser.c | 2 +-
libavcodec/sipr_parser.c | 2 +-
libavcodec/tak_parser.c | 2 +-
libavcodec/vc1_parser.c | 2 +-
libavcodec/version_major.h | 2 +
libavcodec/vorbis_parser.c | 2 +-
libavcodec/vp3_parser.c | 2 +-
libavcodec/vp8_parser.c | 2 +-
libavcodec/vp9_parser.c | 2 +-
libavcodec/vvc_parser.c | 2 +-
libavcodec/webp_parser.c | 2 +-
libavcodec/xbm_parser.c | 2 +-
libavcodec/xma_parser.c | 2 +-
libavcodec/xwd_parser.c | 2 +-
73 files changed, 224 insertions(+), 144 deletions(-)
diff --git a/configure b/configure
index 764bbb0001..12820e6e79 100755
--- a/configure
+++ b/configure
@@ -4398,7 +4398,7 @@ CODEC_LIST="
$ENCODER_LIST
$DECODER_LIST
"
-PARSER_LIST=$(find_things_extern parser AVCodecParser libavcodec/parsers.c)
+PARSER_LIST=$(find_things_extern parser FFCodecParser libavcodec/parsers.c)
BSF_LIST=$(find_things_extern bsf FFBitStreamFilter libavcodec/bitstream_filters.c)
HWACCEL_LIST=$(find_things_extern hwaccel FFHWAccel libavcodec/hwaccels.h)
PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
@@ -8592,7 +8592,7 @@ print_enabled_components(){
print_enabled_components libavfilter/filter_list.c FFFilter filter_list $FILTER_LIST
print_enabled_components libavcodec/codec_list.c FFCodec codec_list $CODEC_LIST
-print_enabled_components libavcodec/parser_list.c AVCodecParser parser_list $PARSER_LIST
+print_enabled_components libavcodec/parser_list.c FFCodecParser parser_list $PARSER_LIST
print_enabled_components libavcodec/bsf_list.c FFBitStreamFilter bitstream_filters $BSF_LIST
print_enabled_components libavformat/demuxer_list.c FFInputFormat demuxer_list $DEMUXER_LIST
print_enabled_components libavformat/muxer_list.c FFOutputFormat muxer_list $MUXER_LIST
diff --git a/doc/APIchanges b/doc/APIchanges
index 3ec8e25f03..654f1646a4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,11 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
+2025-10-xx - xxxxxxxxxx - lavc 62.xx.100 - avcodec.h
+ AVCodecParser fields priv_data_size, parser_init, parser_parse,
+ parser_close, split will be removed from the public API
+ on the next major version bump.
+
2025-10-xx - xxxxxxxxxx - lavu 60.14.100 - csp.h
Add av_csp_approximate_eotf_gamma().
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index ce7d2f58e0..a58c07cae5 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -52,7 +52,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
}
-const AVCodecParser ff_aac_parser = {
+const FFCodecParser ff_aac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = aac_parse_init,
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index fe7f0fee61..de3f6938eb 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -478,7 +478,7 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
}
-const AVCodecParser ff_ac3_parser = {
+const FFCodecParser ff_ac3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3),
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = ac3_parse_init,
diff --git a/libavcodec/adx_parser.c b/libavcodec/adx_parser.c
index e11cc4a3bf..480b915c23 100644
--- a/libavcodec/adx_parser.c
+++ b/libavcodec/adx_parser.c
@@ -98,7 +98,7 @@ static int adx_parse(AVCodecParserContext *s1,
return next;
}
-const AVCodecParser ff_adx_parser = {
+const FFCodecParser ff_adx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_ADPCM_ADX),
.priv_data_size = sizeof(ADXParseContext),
.parser_parse = adx_parse,
diff --git a/libavcodec/ahx_parser.c b/libavcodec/ahx_parser.c
index 07eaf697b3..0e7b9b6e19 100644
--- a/libavcodec/ahx_parser.c
+++ b/libavcodec/ahx_parser.c
@@ -71,7 +71,7 @@ static int ahx_parse(AVCodecParserContext *s1,
return next;
}
-const AVCodecParser ff_ahx_parser = {
+const FFCodecParser ff_ahx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AHX),
.priv_data_size = sizeof(AHXParseContext),
.parser_parse = ahx_parse,
diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c
index ce1cd1be35..821c04c625 100644
--- a/libavcodec/amr_parser.c
+++ b/libavcodec/amr_parser.c
@@ -123,7 +123,7 @@ static int amr_parse(AVCodecParserContext *s1,
return next;
}
-const AVCodecParser ff_amr_parser = {
+const FFCodecParser ff_amr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB),
.priv_data_size = sizeof(AMRParseContext),
.parser_init = amr_parse_init,
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
index ffcaabf2f0..02791bceda 100644
--- a/libavcodec/apv_parser.c
+++ b/libavcodec/apv_parser.c
@@ -141,7 +141,7 @@ static av_cold void close(AVCodecParserContext *s)
ff_cbs_close(&p->cbc);
}
-const AVCodecParser ff_apv_parser = {
+const FFCodecParser ff_apv_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_APV),
.priv_data_size = sizeof(APVParseContext),
.parser_init = init,
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index ba321d3ba5..87510dfbb5 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -210,7 +210,7 @@ static av_cold void av1_parser_close(AVCodecParserContext *ctx)
ff_cbs_close(&s->cbc);
}
-const AVCodecParser ff_av1_parser = {
+const FFCodecParser ff_av1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AV1),
.priv_data_size = sizeof(AV1ParseContext),
.parser_init = av1_parser_init,
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 83a4e56e22..e681b7affe 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2733,16 +2733,30 @@ typedef struct AVCodecParserContext {
typedef struct AVCodecParser {
int codec_ids[7]; /* several codec IDs are permitted */
+#if FF_API_PARSER_PRIVATE
+ /*****************************************************************
+ * All fields below this line are not part of the public API. They
+ * may not be used outside of libavformat and can be changed and
+ * removed at will.
+ * New public fields should be added right above.
+ *****************************************************************
+ */
+ attribute_deprecated
int priv_data_size;
+ attribute_deprecated
int (*parser_init)(AVCodecParserContext *s);
/* This callback never returns an error, a negative value means that
* the frame start was in a previous packet. */
+ attribute_deprecated
int (*parser_parse)(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size);
+ attribute_deprecated
void (*parser_close)(AVCodecParserContext *s);
+ attribute_deprecated
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
+#endif
} AVCodecParser;
/**
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index b20181213b..b96faddabb 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -190,7 +190,7 @@ static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_avs2_parser = {
+const FFCodecParser ff_avs2_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS2),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs2_parse,
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index 4fa1c983c5..c7cfe67b20 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -173,7 +173,7 @@ static int avs3_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_avs3_parser = {
+const FFCodecParser ff_avs3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS3),
.priv_data_size = sizeof(ParseContext),
.parser_parse = avs3_parse,
diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index 84cdc9e873..a4bdf6a025 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -106,7 +106,7 @@ flush:
return next;
}
-const AVCodecParser ff_bmp_parser = {
+const FFCodecParser ff_bmp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_BMP),
.priv_data_size = sizeof(BMPParseContext),
.parser_parse = bmp_parse,
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index b71f226c75..ea36896f5c 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -97,7 +97,7 @@ static int cavsvideo_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_cavsvideo_parser = {
+const FFCodecParser ff_cavsvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CAVS),
.priv_data_size = sizeof(ParseContext),
.parser_parse = cavsvideo_parse,
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index f9e3a9db15..a8d4081235 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -54,7 +54,7 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_cook_parser = {
+const FFCodecParser ff_cook_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_COOK),
.priv_data_size = sizeof(CookParseContext),
.parser_parse = cook_parse,
diff --git a/libavcodec/cri_parser.c b/libavcodec/cri_parser.c
index 356f35a00c..ecf4145cae 100644
--- a/libavcodec/cri_parser.c
+++ b/libavcodec/cri_parser.c
@@ -98,7 +98,7 @@ static int cri_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_cri_parser = {
+const FFCodecParser ff_cri_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CRI),
.priv_data_size = sizeof(CRIParser),
.parser_parse = cri_parse,
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index b9e9191cbc..61b188a902 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -344,7 +344,7 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_dca_parser = {
+const FFCodecParser ff_dca_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DTS),
.priv_data_size = sizeof(DCAParseContext),
.parser_init = dca_parse_init,
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 96ab6c7780..f5ac808d70 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -275,7 +275,7 @@ static av_cold void dirac_parse_close(AVCodecParserContext *s)
av_freep(&pc->buffer);
}
-const AVCodecParser ff_dirac_parser = {
+const FFCodecParser ff_dirac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DIRAC),
.priv_data_size = sizeof(DiracParseContext),
.parser_parse = dirac_parse,
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index 09d8dce1e5..a51f05d458 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -139,7 +139,7 @@ static int dnxhd_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_dnxhd_parser = {
+const FFCodecParser ff_dnxhd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXHD),
.priv_data_size = sizeof(DNXHDParserContext),
.parser_parse = dnxhd_parse,
diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index bfed6b5b6f..6c41e3139d 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -82,7 +82,7 @@ static int dnxuc_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_dnxuc_parser = {
+const FFCodecParser ff_dnxuc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXUC),
.priv_data_size = sizeof(DNxUcParseContext),
.parser_parse = dnxuc_parse,
diff --git a/libavcodec/dolby_e_parser.c b/libavcodec/dolby_e_parser.c
index 53bf44d86e..c685e30ddb 100644
--- a/libavcodec/dolby_e_parser.c
+++ b/libavcodec/dolby_e_parser.c
@@ -66,7 +66,7 @@ end:
return buf_size;
}
-const AVCodecParser ff_dolby_e_parser = {
+const FFCodecParser ff_dolby_e_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DOLBY_E),
.priv_data_size = sizeof(DBEParseContext),
.parser_parse = dolby_e_parse,
diff --git a/libavcodec/dpx_parser.c b/libavcodec/dpx_parser.c
index 9ca17bd94d..d87ae38348 100644
--- a/libavcodec/dpx_parser.c
+++ b/libavcodec/dpx_parser.c
@@ -109,7 +109,7 @@ flush:
return next;
}
-const AVCodecParser ff_dpx_parser = {
+const FFCodecParser ff_dpx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DPX),
.priv_data_size = sizeof(DPXParseContext),
.parser_parse = dpx_parse,
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index 1b4253aa83..7463db35c0 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -41,7 +41,7 @@ static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_dvaudio_parser = {
+const FFCodecParser ff_dvaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVAUDIO),
.parser_parse = dvaudio_parse,
};
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index 68c2b77b39..396b4d90f0 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -164,7 +164,7 @@ static int dvbsub_parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_dvbsub_parser = {
+const FFCodecParser ff_dvbsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVB_SUBTITLE),
.priv_data_size = sizeof(DVBSubParseContext),
.parser_parse = dvbsub_parse,
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index bb8c284ad5..69e6d828eb 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -108,7 +108,7 @@ static int dvd_nav_parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_dvd_nav_parser = {
+const FFCodecParser ff_dvd_nav_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_NAV),
.priv_data_size = sizeof(DVDNavParseContext),
.parser_init = dvd_nav_parse_init,
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index fd5baf719f..cf86b67944 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -85,7 +85,7 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
av_freep(&pc->packet);
}
-const AVCodecParser ff_dvdsub_parser = {
+const FFCodecParser ff_dvdsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_SUBTITLE),
.priv_data_size = sizeof(DVDSubParseContext),
.parser_parse = dvdsub_parse,
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index 5cd9b5544c..8f858c9be8 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -372,7 +372,7 @@ static av_cold void evc_parser_close(AVCodecParserContext *s)
ff_evc_ps_free(&ctx->ps);
}
-const AVCodecParser ff_evc_parser = {
+const FFCodecParser ff_evc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_EVC),
.priv_data_size = sizeof(EVCParserContext),
.parser_parse = evc_parse,
diff --git a/libavcodec/ffv1_parser.c b/libavcodec/ffv1_parser.c
index 5f17d6a75b..f444461647 100644
--- a/libavcodec/ffv1_parser.c
+++ b/libavcodec/ffv1_parser.c
@@ -81,7 +81,7 @@ static av_cold void ffv1_close(AVCodecParserContext *s)
ff_ffv1_close(&p->f);
}
-const AVCodecParser ff_ffv1_parser = {
+const FFCodecParser ff_ffv1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FFV1),
.priv_data_size = sizeof(FFV1ParseContext),
.parser_parse = parse,
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index ed0f4bc336..340ff68f25 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -903,7 +903,7 @@ static av_cold void flac_parse_close(AVCodecParserContext *c)
av_freep(&fpc->wrap_buf);
}
-const AVCodecParser ff_flac_parser = {
+const FFCodecParser ff_flac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FLAC),
.priv_data_size = sizeof(FLACParseContext),
.parser_init = flac_parse_init,
diff --git a/libavcodec/ftr_parser.c b/libavcodec/ftr_parser.c
index 422b775d7c..24ef405488 100644
--- a/libavcodec/ftr_parser.c
+++ b/libavcodec/ftr_parser.c
@@ -97,7 +97,7 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_ftr_parser = {
+const FFCodecParser ff_ftr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FTR),
.priv_data_size = sizeof(FTRParseContext),
.parser_parse = ftr_parse,
diff --git a/libavcodec/g723_1_parser.c b/libavcodec/g723_1_parser.c
index 0deec9fdf8..70a83e3e1b 100644
--- a/libavcodec/g723_1_parser.c
+++ b/libavcodec/g723_1_parser.c
@@ -53,7 +53,7 @@ static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_g723_1_parser = {
+const FFCodecParser ff_g723_1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G723_1),
.priv_data_size = sizeof(G723_1ParseContext),
.parser_parse = g723_1_parse,
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index c107436a42..17b8415584 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -85,7 +85,7 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_g729_parser = {
+const FFCodecParser ff_g729_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN),
.priv_data_size = sizeof(G729ParseContext),
.parser_parse = g729_parse,
diff --git a/libavcodec/gif_parser.c b/libavcodec/gif_parser.c
index ceb03b0aab..c95e9430fd 100644
--- a/libavcodec/gif_parser.c
+++ b/libavcodec/gif_parser.c
@@ -201,7 +201,7 @@ static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_gif_parser = {
+const FFCodecParser ff_gif_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GIF),
.priv_data_size = sizeof(GIFParseContext),
.parser_parse = gif_parse,
diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c
index 0162bdcc13..1823ff3188 100644
--- a/libavcodec/gsm_parser.c
+++ b/libavcodec/gsm_parser.c
@@ -84,7 +84,7 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_gsm_parser = {
+const FFCodecParser ff_gsm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),
.priv_data_size = sizeof(GSMParseContext),
.parser_parse = gsm_parse,
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
index 7bd912f8bf..cedcdfe038 100644
--- a/libavcodec/h261_parser.c
+++ b/libavcodec/h261_parser.c
@@ -87,7 +87,7 @@ static int h261_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_h261_parser = {
+const FFCodecParser ff_h261_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H261),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h261_parse,
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index 2df6182d78..939a839e8e 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -88,7 +88,7 @@ static int h263_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_h263_parser = {
+const FFCodecParser ff_h263_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H263),
.priv_data_size = sizeof(ParseContext),
.parser_parse = h263_parse,
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 9d3158d183..baed7a3e34 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -683,7 +683,7 @@ static av_cold int init(AVCodecParserContext *s)
return 0;
}
-const AVCodecParser ff_h264_parser = {
+const FFCodecParser ff_h264_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H264),
.priv_data_size = sizeof(H264ParseContext),
.parser_init = init,
diff --git a/libavcodec/hdr_parser.c b/libavcodec/hdr_parser.c
index af8ffd06ca..eb34803c73 100644
--- a/libavcodec/hdr_parser.c
+++ b/libavcodec/hdr_parser.c
@@ -72,7 +72,7 @@ static int hdr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_hdr_parser = {
+const FFCodecParser ff_hdr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RADIANCE_HDR),
.priv_data_size = sizeof(HDRParseContext),
.parser_parse = hdr_parse,
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c
index 1a6b7987a3..43f895ad57 100644
--- a/libavcodec/hevc/parser.c
+++ b/libavcodec/hevc/parser.c
@@ -353,7 +353,7 @@ static void hevc_parser_close(AVCodecParserContext *s)
av_freep(&ctx->pc.buffer);
}
-const AVCodecParser ff_hevc_parser = {
+const FFCodecParser ff_hevc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_HEVC),
.priv_data_size = sizeof(HEVCParserContext),
.parser_parse = hevc_parse,
diff --git a/libavcodec/ipu_parser.c b/libavcodec/ipu_parser.c
index d278e8b449..d2ff23e7b2 100644
--- a/libavcodec/ipu_parser.c
+++ b/libavcodec/ipu_parser.c
@@ -70,7 +70,7 @@ static int ipu_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_ipu_parser = {
+const FFCodecParser ff_ipu_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_IPU),
.priv_data_size = sizeof(IPUParseContext),
.parser_parse = ipu_parse,
diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index 2ef29582a7..2e6d91ee59 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -212,7 +212,7 @@ static int jpeg2000_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_jpeg2000_parser = {
+const FFCodecParser ff_jpeg2000_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEG2000),
.priv_data_size = sizeof(JPEG2000ParserContext),
.parser_parse = jpeg2000_parse,
diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index ca00a86a0b..8a6bafdf92 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -1546,7 +1546,7 @@ flush:
return next;
}
-const AVCodecParser ff_jpegxl_parser = {
+const FFCodecParser ff_jpegxl_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM),
.priv_data_size = sizeof(JXLParseContext),
.parser_parse = jpegxl_parse,
diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c
index b06103aef8..6cd1eb3379 100644
--- a/libavcodec/latm_parser.c
+++ b/libavcodec/latm_parser.c
@@ -105,7 +105,7 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_aac_latm_parser = {
+const FFCodecParser ff_aac_latm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC_LATM),
.priv_data_size = sizeof(LATMParseContext),
.parser_parse = latm_parse,
diff --git a/libavcodec/misc4_parser.c b/libavcodec/misc4_parser.c
index 867e9b0a4c..332e79875e 100644
--- a/libavcodec/misc4_parser.c
+++ b/libavcodec/misc4_parser.c
@@ -74,7 +74,7 @@ static int misc4_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_misc4_parser = {
+const FFCodecParser ff_misc4_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MISC4),
.priv_data_size = sizeof(MISC4Context),
.parser_parse = misc4_parse,
diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c
index 152580b354..99ac75771e 100644
--- a/libavcodec/mjpeg_parser.c
+++ b/libavcodec/mjpeg_parser.c
@@ -129,7 +129,7 @@ static int jpeg_parse(AVCodecParserContext *s,
}
-const AVCodecParser ff_mjpeg_parser = {
+const FFCodecParser ff_mjpeg_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS),
.priv_data_size = sizeof(MJPEGParserContext),
.parser_parse = jpeg_parse,
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 6ed0fa20a8..20d01db943 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -205,7 +205,7 @@ lost_sync:
return 1;
}
-const AVCodecParser ff_mlp_parser = {
+const FFCodecParser ff_mlp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD),
.priv_data_size = sizeof(MLPParseContext),
.parser_init = mlp_init,
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index 5a75e250d1..0bb63e1114 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -156,7 +156,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
return next;
}
-const AVCodecParser ff_mpeg4video_parser = {
+const FFCodecParser ff_mpeg4video_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG4),
.priv_data_size = sizeof(struct Mp4vParseContext),
.parser_init = mpeg4video_parse_init,
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 865d9298d3..6363f1f0a8 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -137,7 +137,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
}
-const AVCodecParser ff_mpegaudio_parser = {
+const FFCodecParser ff_mpegaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MP1, AV_CODEC_ID_MP2,
AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU),
.priv_data_size = sizeof(MpegAudioParseContext),
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index b80e70a740..48e0e31159 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -300,7 +300,7 @@ static av_cold int mpegvideo_parse_init(AVCodecParserContext *s)
return 0;
}
-const AVCodecParser ff_mpegvideo_parser = {
+const FFCodecParser ff_mpegvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO),
.priv_data_size = sizeof(struct MpvParseContext),
.parser_init = mpegvideo_parse_init,
diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index 1fe011724c..fe6a03c783 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -214,7 +214,7 @@ fail:
return buf_size;
}
-const AVCodecParser ff_opus_parser = {
+const FFCodecParser ff_opus_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_OPUS),
.priv_data_size = sizeof(OpusParserContext),
.parser_parse = opus_parse,
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index af966766ee..701a962a56 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -29,11 +29,13 @@
#include "libavutil/mem.h"
#include "parser.h"
+#include "parser_internal.h"
av_cold AVCodecParserContext *av_parser_init(int codec_id)
{
AVCodecParserContext *s = NULL;
const AVCodecParser *parser;
+ const FFCodecParser *ffparser;
void *i = 0;
int ret;
@@ -53,17 +55,18 @@ av_cold AVCodecParserContext *av_parser_init(int codec_id)
return NULL;
found:
+ ffparser = ffcodecparser(parser);
s = av_mallocz(sizeof(AVCodecParserContext));
if (!s)
goto err_out;
s->parser = parser;
- s->priv_data = av_mallocz(parser->priv_data_size);
+ s->priv_data = av_mallocz(ffparser->priv_data_size);
if (!s->priv_data)
goto err_out;
s->fetch_timestamp=1;
s->pict_type = AV_PICTURE_TYPE_I;
- if (parser->parser_init) {
- ret = parser->parser_init(s);
+ if (ffparser->parser_init) {
+ ret = ffparser->parser_init(s);
if (ret != 0)
goto err_out;
}
@@ -161,8 +164,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
ff_fetch_timestamp(s, 0, 0, 0);
}
/* WARNING: the returned index can be negative */
- index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
- poutbuf_size, buf, buf_size);
+ index = ffcodecparser(s->parser)->parser_parse(s, avctx, (const uint8_t **) poutbuf,
+ poutbuf_size, buf, buf_size);
av_assert0(index > -0x20000000); // The API does not allow returning AVERROR codes
#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -194,8 +197,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
av_cold void av_parser_close(AVCodecParserContext *s)
{
if (s) {
- if (s->parser->parser_close)
- s->parser->parser_close(s);
+ if (ffcodecparser(s->parser)->parser_close)
+ ffcodecparser(s->parser)->parser_close(s);
av_freep(&s->priv_data);
av_free(s);
}
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
index 81ccceeedf..69f72d9bf6 100644
--- a/libavcodec/parser_internal.h
+++ b/libavcodec/parser_internal.h
@@ -19,9 +19,44 @@
#ifndef AVCODEC_PARSER_INTERNAL_H
#define AVCODEC_PARSER_INTERNAL_H
+#include <stdint.h>
+
#include "libavutil/macros.h"
+#include "avcodec.h"
#include "codec_id.h"
+#if FF_API_PARSER_PRIVATE
+typedef union FFCodecParser {
+ struct {
+ int codec_ids[7]; /* several codec IDs are permitted */
+ int priv_data_size;
+ int (*parser_init)(AVCodecParserContext *s);
+ int (*parser_parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*parser_close)(AVCodecParserContext *s);
+ int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
+ };
+ AVCodecParser p;
+#else
+typedef struct FFCodecParser {
+ AVCodecParser p;
+ unsigned priv_data_size;
+ int (*parser_init)(AVCodecParserContext *s);
+ int (*parser_parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*parser_close)(AVCodecParserContext *s);
+#endif
+} FFCodecParser;
+
+static inline const FFCodecParser *ffcodecparser(const AVCodecParser *parser)
+{
+ return (const FFCodecParser*)parser;
+}
+
#define EIGTH_ARG(a,b,c,d,e,f,g,h,...) h
#define NO_FAIL
// Expands to nothing if <= 7 args; induces compilation failure if not.
@@ -32,7 +67,13 @@
#define FIRST_SEVEN2(a,b,c,d,e,f,g,...) a,b,c,d,e,f,g
#define FIRST_SEVEN(...) PASSTHROUGH(FIRST_SEVEN2(__VA_ARGS__))
#define TIMES_SEVEN(a) a,a,a,a,a,a,a
+
+#if FF_API_PARSER_PRIVATE
#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
+#else
+#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \
+ .p.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) }
+#endif
#endif /* AVCODEC_PARSER_INTERNAL_H */
diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index 824a1ccd55..ee3f9ab12e 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -19,83 +19,98 @@
#include <stdint.h>
#include "avcodec.h"
+#include "parser_internal.h"
-extern const AVCodecParser ff_aac_parser;
-extern const AVCodecParser ff_aac_latm_parser;
-extern const AVCodecParser ff_ac3_parser;
-extern const AVCodecParser ff_adx_parser;
-extern const AVCodecParser ff_ahx_parser;
-extern const AVCodecParser ff_amr_parser;
-extern const AVCodecParser ff_apv_parser;
-extern const AVCodecParser ff_av1_parser;
-extern const AVCodecParser ff_avs2_parser;
-extern const AVCodecParser ff_avs3_parser;
-extern const AVCodecParser ff_bmp_parser;
-extern const AVCodecParser ff_cavsvideo_parser;
-extern const AVCodecParser ff_cook_parser;
-extern const AVCodecParser ff_cri_parser;
-extern const AVCodecParser ff_dca_parser;
-extern const AVCodecParser ff_dirac_parser;
-extern const AVCodecParser ff_dnxhd_parser;
-extern const AVCodecParser ff_dnxuc_parser;
-extern const AVCodecParser ff_dolby_e_parser;
-extern const AVCodecParser ff_dpx_parser;
-extern const AVCodecParser ff_dvaudio_parser;
-extern const AVCodecParser ff_dvbsub_parser;
-extern const AVCodecParser ff_dvdsub_parser;
-extern const AVCodecParser ff_dvd_nav_parser;
-extern const AVCodecParser ff_evc_parser;
-extern const AVCodecParser ff_flac_parser;
-extern const AVCodecParser ff_ftr_parser;
-extern const AVCodecParser ff_ffv1_parser;
-extern const AVCodecParser ff_g723_1_parser;
-extern const AVCodecParser ff_g729_parser;
-extern const AVCodecParser ff_gif_parser;
-extern const AVCodecParser ff_gsm_parser;
-extern const AVCodecParser ff_h261_parser;
-extern const AVCodecParser ff_h263_parser;
-extern const AVCodecParser ff_h264_parser;
-extern const AVCodecParser ff_hevc_parser;
-extern const AVCodecParser ff_hdr_parser;
-extern const AVCodecParser ff_ipu_parser;
-extern const AVCodecParser ff_jpeg2000_parser;
-extern const AVCodecParser ff_jpegxl_parser;
-extern const AVCodecParser ff_misc4_parser;
-extern const AVCodecParser ff_mjpeg_parser;
-extern const AVCodecParser ff_mlp_parser;
-extern const AVCodecParser ff_mpeg4video_parser;
-extern const AVCodecParser ff_mpegaudio_parser;
-extern const AVCodecParser ff_mpegvideo_parser;
-extern const AVCodecParser ff_opus_parser;
-extern const AVCodecParser ff_prores_parser;
-extern const AVCodecParser ff_png_parser;
-extern const AVCodecParser ff_pnm_parser;
-extern const AVCodecParser ff_prores_raw_parser;
-extern const AVCodecParser ff_qoi_parser;
-extern const AVCodecParser ff_rv34_parser;
-extern const AVCodecParser ff_sbc_parser;
-extern const AVCodecParser ff_sipr_parser;
-extern const AVCodecParser ff_tak_parser;
-extern const AVCodecParser ff_vc1_parser;
-extern const AVCodecParser ff_vorbis_parser;
-extern const AVCodecParser ff_vp3_parser;
-extern const AVCodecParser ff_vp8_parser;
-extern const AVCodecParser ff_vp9_parser;
-extern const AVCodecParser ff_vvc_parser;
-extern const AVCodecParser ff_webp_parser;
-extern const AVCodecParser ff_xbm_parser;
-extern const AVCodecParser ff_xma_parser;
-extern const AVCodecParser ff_xwd_parser;
+#if FF_API_PARSER_PRIVATE
+#include <assert.h>
+#include <stddef.h>
+#define CHECK_OFFSET(field) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.field), "Wrong offsets")
+CHECK_OFFSET(codec_ids);
+CHECK_OFFSET(priv_data_size);
+CHECK_OFFSET(parser_init);
+CHECK_OFFSET(parser_parse);
+CHECK_OFFSET(parser_close);
+CHECK_OFFSET(split);
+#endif
+
+extern const FFCodecParser ff_aac_parser;
+extern const FFCodecParser ff_aac_latm_parser;
+extern const FFCodecParser ff_ac3_parser;
+extern const FFCodecParser ff_adx_parser;
+extern const FFCodecParser ff_ahx_parser;
+extern const FFCodecParser ff_amr_parser;
+extern const FFCodecParser ff_apv_parser;
+extern const FFCodecParser ff_av1_parser;
+extern const FFCodecParser ff_avs2_parser;
+extern const FFCodecParser ff_avs3_parser;
+extern const FFCodecParser ff_bmp_parser;
+extern const FFCodecParser ff_cavsvideo_parser;
+extern const FFCodecParser ff_cook_parser;
+extern const FFCodecParser ff_cri_parser;
+extern const FFCodecParser ff_dca_parser;
+extern const FFCodecParser ff_dirac_parser;
+extern const FFCodecParser ff_dnxhd_parser;
+extern const FFCodecParser ff_dnxuc_parser;
+extern const FFCodecParser ff_dolby_e_parser;
+extern const FFCodecParser ff_dpx_parser;
+extern const FFCodecParser ff_dvaudio_parser;
+extern const FFCodecParser ff_dvbsub_parser;
+extern const FFCodecParser ff_dvdsub_parser;
+extern const FFCodecParser ff_dvd_nav_parser;
+extern const FFCodecParser ff_evc_parser;
+extern const FFCodecParser ff_flac_parser;
+extern const FFCodecParser ff_ftr_parser;
+extern const FFCodecParser ff_ffv1_parser;
+extern const FFCodecParser ff_g723_1_parser;
+extern const FFCodecParser ff_g729_parser;
+extern const FFCodecParser ff_gif_parser;
+extern const FFCodecParser ff_gsm_parser;
+extern const FFCodecParser ff_h261_parser;
+extern const FFCodecParser ff_h263_parser;
+extern const FFCodecParser ff_h264_parser;
+extern const FFCodecParser ff_hevc_parser;
+extern const FFCodecParser ff_hdr_parser;
+extern const FFCodecParser ff_ipu_parser;
+extern const FFCodecParser ff_jpeg2000_parser;
+extern const FFCodecParser ff_jpegxl_parser;
+extern const FFCodecParser ff_misc4_parser;
+extern const FFCodecParser ff_mjpeg_parser;
+extern const FFCodecParser ff_mlp_parser;
+extern const FFCodecParser ff_mpeg4video_parser;
+extern const FFCodecParser ff_mpegaudio_parser;
+extern const FFCodecParser ff_mpegvideo_parser;
+extern const FFCodecParser ff_opus_parser;
+extern const FFCodecParser ff_prores_parser;
+extern const FFCodecParser ff_png_parser;
+extern const FFCodecParser ff_pnm_parser;
+extern const FFCodecParser ff_prores_raw_parser;
+extern const FFCodecParser ff_qoi_parser;
+extern const FFCodecParser ff_rv34_parser;
+extern const FFCodecParser ff_sbc_parser;
+extern const FFCodecParser ff_sipr_parser;
+extern const FFCodecParser ff_tak_parser;
+extern const FFCodecParser ff_vc1_parser;
+extern const FFCodecParser ff_vorbis_parser;
+extern const FFCodecParser ff_vp3_parser;
+extern const FFCodecParser ff_vp8_parser;
+extern const FFCodecParser ff_vp9_parser;
+extern const FFCodecParser ff_vvc_parser;
+extern const FFCodecParser ff_webp_parser;
+extern const FFCodecParser ff_xbm_parser;
+extern const FFCodecParser ff_xma_parser;
+extern const FFCodecParser ff_xwd_parser;
#include "libavcodec/parser_list.c"
const AVCodecParser *av_parser_iterate(void **opaque)
{
uintptr_t i = (uintptr_t)*opaque;
- const AVCodecParser *p = parser_list[i];
+ const FFCodecParser *p = parser_list[i];
- if (p)
+ if (p) {
*opaque = (void*)(i + 1);
+ return &p->p;
+ }
- return p;
+ return NULL;
}
diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index e4af1f2e09..76af53197b 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -111,7 +111,7 @@ flush:
return next;
}
-const AVCodecParser ff_png_parser = {
+const FFCodecParser ff_png_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PNG),
.priv_data_size = sizeof(PNGParseContext),
.parser_parse = png_parse,
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 65dbaf86f6..3f106ca1c4 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -134,7 +134,7 @@ end:
return next;
}
-const AVCodecParser ff_pnm_parser = {
+const FFCodecParser ff_pnm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PGM, AV_CODEC_ID_PGMYUV, AV_CODEC_ID_PPM,
AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
AV_CODEC_ID_PHM),
diff --git a/libavcodec/prores_parser.c b/libavcodec/prores_parser.c
index 9b66c3b415..c2c1729280 100644
--- a/libavcodec/prores_parser.c
+++ b/libavcodec/prores_parser.c
@@ -123,7 +123,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_prores_parser = {
+const FFCodecParser ff_prores_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES),
.parser_parse = parse,
};
diff --git a/libavcodec/prores_raw_parser.c b/libavcodec/prores_raw_parser.c
index a3470d8cce..d571925841 100644
--- a/libavcodec/prores_raw_parser.c
+++ b/libavcodec/prores_raw_parser.c
@@ -81,7 +81,7 @@ static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_prores_raw_parser = {
+const FFCodecParser ff_prores_raw_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES_RAW),
.parser_parse = prores_raw_parse,
};
diff --git a/libavcodec/qoi_parser.c b/libavcodec/qoi_parser.c
index 1c20d334d0..04c040c1ab 100644
--- a/libavcodec/qoi_parser.c
+++ b/libavcodec/qoi_parser.c
@@ -70,7 +70,7 @@ static int qoi_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_qoi_parser = {
+const FFCodecParser ff_qoi_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_QOI),
.priv_data_size = sizeof(QOIParseContext),
.parser_parse = qoi_parse,
diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c
index 3ce1abf60a..5d91b37d57 100644
--- a/libavcodec/rv34_parser.c
+++ b/libavcodec/rv34_parser.c
@@ -76,7 +76,7 @@ static int rv34_parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_rv34_parser = {
+const FFCodecParser ff_rv34_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RV30, AV_CODEC_ID_RV40),
.priv_data_size = sizeof(RV34ParseContext),
.parser_parse = rv34_parse,
diff --git a/libavcodec/sbc_parser.c b/libavcodec/sbc_parser.c
index 9cd225aa7b..35e37601bc 100644
--- a/libavcodec/sbc_parser.c
+++ b/libavcodec/sbc_parser.c
@@ -117,7 +117,7 @@ static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_sbc_parser = {
+const FFCodecParser ff_sbc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SBC),
.priv_data_size = sizeof(SBCParseContext),
.parser_parse = sbc_parse,
diff --git a/libavcodec/sipr_parser.c b/libavcodec/sipr_parser.c
index 89352663a5..d6e1ae295c 100644
--- a/libavcodec/sipr_parser.c
+++ b/libavcodec/sipr_parser.c
@@ -67,7 +67,7 @@ static int sipr_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_sipr_parser = {
+const FFCodecParser ff_sipr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SIPR),
.priv_data_size = sizeof(SiprParserContext),
.parser_parse = sipr_parse,
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
index 47931288b7..2c5af1019a 100644
--- a/libavcodec/tak_parser.c
+++ b/libavcodec/tak_parser.c
@@ -124,7 +124,7 @@ fail:
return buf_size + consumed;
}
-const AVCodecParser ff_tak_parser = {
+const FFCodecParser ff_tak_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_TAK),
.priv_data_size = sizeof(TAKParseContext),
.parser_parse = tak_parse,
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index 7215e84355..ef7878ef51 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -271,7 +271,7 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s)
return 0;
}
-const AVCodecParser ff_vc1_parser = {
+const FFCodecParser ff_vc1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VC1),
.priv_data_size = sizeof(VC1ParseContext),
.parser_init = vc1_parse_init,
diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h
index 97e4e12065..be95bafca0 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -45,6 +45,8 @@
#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63)
+#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63)
+
// reminder to remove the OMX encoder on next major bump
#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63)
// reminder to remove Sonic Lossy/Lossless encoders on next major bump
diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index a3b0a4e5c4..4290dd92ac 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -336,7 +336,7 @@ static av_cold void vorbis_parser_close(AVCodecParserContext *ctx)
av_vorbis_parse_free(&s->vp);
}
-const AVCodecParser ff_vorbis_parser = {
+const FFCodecParser ff_vorbis_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS),
.priv_data_size = sizeof(VorbisParseContext),
.parser_parse = vorbis_parse,
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index 9be3f70596..e5030c445d 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -36,7 +36,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_vp3_parser = {
+const FFCodecParser ff_vp3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A),
.parser_parse = parse,
diff --git a/libavcodec/vp8_parser.c b/libavcodec/vp8_parser.c
index 14c0c1462b..a6b01722fb 100644
--- a/libavcodec/vp8_parser.c
+++ b/libavcodec/vp8_parser.c
@@ -74,7 +74,7 @@ static int parse(AVCodecParserContext *s,
return buf_size;
}
-const AVCodecParser ff_vp8_parser = {
+const FFCodecParser ff_vp8_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP8),
.parser_parse = parse,
};
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index 7e1a06201a..007889220b 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -64,7 +64,7 @@ static int parse(AVCodecParserContext *ctx,
return size;
}
-const AVCodecParser ff_vp9_parser = {
+const FFCodecParser ff_vp9_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP9),
.parser_parse = parse,
};
diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index 4453aaa61d..f134ab6df6 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -506,7 +506,7 @@ static av_cold void vvc_parser_close(AVCodecParserContext *s)
av_freep(&ctx->pc.buffer);
}
-const AVCodecParser ff_vvc_parser = {
+const FFCodecParser ff_vvc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VVC),
.priv_data_size = sizeof(VVCParserContext),
.parser_init = vvc_parser_init,
diff --git a/libavcodec/webp_parser.c b/libavcodec/webp_parser.c
index e3edc348e4..155af28f6c 100644
--- a/libavcodec/webp_parser.c
+++ b/libavcodec/webp_parser.c
@@ -105,7 +105,7 @@ flush:
return next;
}
-const AVCodecParser ff_webp_parser = {
+const FFCodecParser ff_webp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_WEBP),
.priv_data_size = sizeof(WebPParseContext),
.parser_parse = webp_parse,
diff --git a/libavcodec/xbm_parser.c b/libavcodec/xbm_parser.c
index c7e7ce9282..936612d30f 100644
--- a/libavcodec/xbm_parser.c
+++ b/libavcodec/xbm_parser.c
@@ -101,7 +101,7 @@ static int xbm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_xbm_parser = {
+const FFCodecParser ff_xbm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XBM),
.priv_data_size = sizeof(XBMParseContext),
.parser_init = xbm_init,
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index eae39fd031..c2eea37833 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -56,7 +56,7 @@ static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
return buf_size;
}
-const AVCodecParser ff_xma_parser = {
+const FFCodecParser ff_xma_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XMA2),
.priv_data_size = sizeof(XMAParserContext),
.parser_parse = xma_parse,
diff --git a/libavcodec/xwd_parser.c b/libavcodec/xwd_parser.c
index cc554c3c97..1368283b21 100644
--- a/libavcodec/xwd_parser.c
+++ b/libavcodec/xwd_parser.c
@@ -96,7 +96,7 @@ static int xwd_parse(AVCodecParserContext *s, AVCodecContext *avctx,
return next;
}
-const AVCodecParser ff_xwd_parser = {
+const FFCodecParser ff_xwd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XWD),
.priv_data_size = sizeof(XWDParseContext),
.parser_parse = xwd_parse,
--
2.49.1
>From 0ff910feb0e9414c00991f25469d43568b76b822 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 26 Oct 2025 14:42:59 +0100
Subject: [PATCH 4/5] avcodec/parser_internal: Remove prefix from
parser_{init,parse,close}
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
libavcodec/aac_parser.c | 6 +++---
libavcodec/ac3_parser.c | 6 +++---
libavcodec/adx_parser.c | 4 ++--
libavcodec/ahx_parser.c | 4 ++--
libavcodec/amr_parser.c | 6 +++---
libavcodec/apv_parser.c | 6 +++---
libavcodec/av1_parser.c | 6 +++---
libavcodec/avs2_parser.c | 4 ++--
libavcodec/avs3_parser.c | 4 ++--
libavcodec/bmp_parser.c | 4 ++--
libavcodec/cavs_parser.c | 4 ++--
libavcodec/cook_parser.c | 2 +-
libavcodec/cri_parser.c | 4 ++--
libavcodec/dca_parser.c | 6 +++---
libavcodec/dirac_parser.c | 4 ++--
libavcodec/dnxhd_parser.c | 4 ++--
libavcodec/dnxuc_parser.c | 4 ++--
libavcodec/dolby_e_parser.c | 2 +-
libavcodec/dpx_parser.c | 4 ++--
libavcodec/dvaudio_parser.c | 2 +-
libavcodec/dvbsub_parser.c | 2 +-
libavcodec/dvd_nav_parser.c | 4 ++--
libavcodec/dvdsub_parser.c | 4 ++--
libavcodec/evc_parser.c | 4 ++--
libavcodec/ffv1_parser.c | 4 ++--
libavcodec/flac_parser.c | 6 +++---
libavcodec/ftr_parser.c | 4 ++--
libavcodec/g723_1_parser.c | 4 ++--
libavcodec/g729_parser.c | 4 ++--
libavcodec/gif_parser.c | 4 ++--
libavcodec/gsm_parser.c | 4 ++--
libavcodec/h261_parser.c | 4 ++--
libavcodec/h263_parser.c | 4 ++--
libavcodec/h264_parser.c | 6 +++---
libavcodec/hdr_parser.c | 4 ++--
libavcodec/hevc/parser.c | 4 ++--
libavcodec/ipu_parser.c | 4 ++--
libavcodec/jpeg2000_parser.c | 4 ++--
libavcodec/jpegxl_parser.c | 4 ++--
libavcodec/latm_parser.c | 4 ++--
libavcodec/misc4_parser.c | 4 ++--
libavcodec/mjpeg_parser.c | 4 ++--
libavcodec/mlp_parser.c | 6 +++---
libavcodec/mpeg4video_parser.c | 6 +++---
libavcodec/mpegaudio_parser.c | 4 ++--
libavcodec/mpegvideo_parser.c | 6 +++---
libavcodec/opus/parser.c | 4 ++--
libavcodec/parser.c | 12 ++++++------
libavcodec/parser_internal.h | 24 ++++++++++++------------
libavcodec/parsers.c | 14 +++++++-------
libavcodec/png_parser.c | 4 ++--
libavcodec/pnm_parser.c | 4 ++--
libavcodec/prores_parser.c | 2 +-
libavcodec/prores_raw_parser.c | 2 +-
libavcodec/qoi_parser.c | 4 ++--
libavcodec/rv34_parser.c | 2 +-
libavcodec/sbc_parser.c | 4 ++--
libavcodec/sipr_parser.c | 4 ++--
libavcodec/tak_parser.c | 4 ++--
libavcodec/vc1_parser.c | 6 +++---
libavcodec/vorbis_parser.c | 4 ++--
libavcodec/vp3_parser.c | 2 +-
libavcodec/vp8_parser.c | 2 +-
libavcodec/vp9_parser.c | 2 +-
libavcodec/vvc_parser.c | 6 +++---
libavcodec/webp_parser.c | 4 ++--
libavcodec/xbm_parser.c | 6 +++---
libavcodec/xma_parser.c | 2 +-
libavcodec/xwd_parser.c | 4 ++--
69 files changed, 160 insertions(+), 160 deletions(-)
diff --git a/libavcodec/aac_parser.c b/libavcodec/aac_parser.c
index a58c07cae5..cad36d8171 100644
--- a/libavcodec/aac_parser.c
+++ b/libavcodec/aac_parser.c
@@ -55,7 +55,7 @@ static av_cold int aac_parse_init(AVCodecParserContext *s1)
const FFCodecParser ff_aac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC),
.priv_data_size = sizeof(AACAC3ParseContext),
- .parser_init = aac_parse_init,
- .parser_parse = ff_aac_ac3_parse,
- .parser_close = ff_parse_close,
+ .init = aac_parse_init,
+ .parse = ff_aac_ac3_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index de3f6938eb..232c96d517 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -481,9 +481,9 @@ static av_cold int ac3_parse_init(AVCodecParserContext *s1)
const FFCodecParser ff_ac3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3),
.priv_data_size = sizeof(AACAC3ParseContext),
- .parser_init = ac3_parse_init,
- .parser_parse = ff_aac_ac3_parse,
- .parser_close = ff_parse_close,
+ .init = ac3_parse_init,
+ .parse = ff_aac_ac3_parse,
+ .close = ff_parse_close,
};
#else
diff --git a/libavcodec/adx_parser.c b/libavcodec/adx_parser.c
index 480b915c23..c897ba223a 100644
--- a/libavcodec/adx_parser.c
+++ b/libavcodec/adx_parser.c
@@ -101,6 +101,6 @@ static int adx_parse(AVCodecParserContext *s1,
const FFCodecParser ff_adx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_ADPCM_ADX),
.priv_data_size = sizeof(ADXParseContext),
- .parser_parse = adx_parse,
- .parser_close = ff_parse_close,
+ .parse = adx_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/ahx_parser.c b/libavcodec/ahx_parser.c
index 0e7b9b6e19..2aeaf8b56e 100644
--- a/libavcodec/ahx_parser.c
+++ b/libavcodec/ahx_parser.c
@@ -74,6 +74,6 @@ static int ahx_parse(AVCodecParserContext *s1,
const FFCodecParser ff_ahx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AHX),
.priv_data_size = sizeof(AHXParseContext),
- .parser_parse = ahx_parse,
- .parser_close = ff_parse_close,
+ .parse = ahx_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/amr_parser.c b/libavcodec/amr_parser.c
index 821c04c625..5ee1829c49 100644
--- a/libavcodec/amr_parser.c
+++ b/libavcodec/amr_parser.c
@@ -126,7 +126,7 @@ static int amr_parse(AVCodecParserContext *s1,
const FFCodecParser ff_amr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AMR_NB, AV_CODEC_ID_AMR_WB),
.priv_data_size = sizeof(AMRParseContext),
- .parser_init = amr_parse_init,
- .parser_parse = amr_parse,
- .parser_close = ff_parse_close,
+ .init = amr_parse_init,
+ .parse = amr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/apv_parser.c b/libavcodec/apv_parser.c
index 02791bceda..dbecbb5a5e 100644
--- a/libavcodec/apv_parser.c
+++ b/libavcodec/apv_parser.c
@@ -144,7 +144,7 @@ static av_cold void close(AVCodecParserContext *s)
const FFCodecParser ff_apv_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_APV),
.priv_data_size = sizeof(APVParseContext),
- .parser_init = init,
- .parser_parse = parse,
- .parser_close = close,
+ .init = init,
+ .parse = parse,
+ .close = close,
};
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c
index 87510dfbb5..32135a23cb 100644
--- a/libavcodec/av1_parser.c
+++ b/libavcodec/av1_parser.c
@@ -213,7 +213,7 @@ static av_cold void av1_parser_close(AVCodecParserContext *ctx)
const FFCodecParser ff_av1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AV1),
.priv_data_size = sizeof(AV1ParseContext),
- .parser_init = av1_parser_init,
- .parser_close = av1_parser_close,
- .parser_parse = av1_parser_parse,
+ .init = av1_parser_init,
+ .close = av1_parser_close,
+ .parse = av1_parser_parse,
};
diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index b96faddabb..68b6f20c18 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -193,6 +193,6 @@ static int avs2_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_avs2_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS2),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = avs2_parse,
- .parser_close = ff_parse_close,
+ .parse = avs2_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/avs3_parser.c b/libavcodec/avs3_parser.c
index c7cfe67b20..825eae0526 100644
--- a/libavcodec/avs3_parser.c
+++ b/libavcodec/avs3_parser.c
@@ -176,6 +176,6 @@ static int avs3_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_avs3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AVS3),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = avs3_parse,
- .parser_close = ff_parse_close,
+ .parse = avs3_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/bmp_parser.c b/libavcodec/bmp_parser.c
index a4bdf6a025..5a6e957623 100644
--- a/libavcodec/bmp_parser.c
+++ b/libavcodec/bmp_parser.c
@@ -109,6 +109,6 @@ flush:
const FFCodecParser ff_bmp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_BMP),
.priv_data_size = sizeof(BMPParseContext),
- .parser_parse = bmp_parse,
- .parser_close = ff_parse_close,
+ .parse = bmp_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/cavs_parser.c b/libavcodec/cavs_parser.c
index ea36896f5c..13fbd009c8 100644
--- a/libavcodec/cavs_parser.c
+++ b/libavcodec/cavs_parser.c
@@ -100,6 +100,6 @@ static int cavsvideo_parse(AVCodecParserContext *s,
const FFCodecParser ff_cavsvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CAVS),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = cavsvideo_parse,
- .parser_close = ff_parse_close,
+ .parse = cavsvideo_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/cook_parser.c b/libavcodec/cook_parser.c
index a8d4081235..8e8f6db4c6 100644
--- a/libavcodec/cook_parser.c
+++ b/libavcodec/cook_parser.c
@@ -57,5 +57,5 @@ static int cook_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_cook_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_COOK),
.priv_data_size = sizeof(CookParseContext),
- .parser_parse = cook_parse,
+ .parse = cook_parse,
};
diff --git a/libavcodec/cri_parser.c b/libavcodec/cri_parser.c
index ecf4145cae..cd0c45f415 100644
--- a/libavcodec/cri_parser.c
+++ b/libavcodec/cri_parser.c
@@ -101,6 +101,6 @@ static int cri_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_cri_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_CRI),
.priv_data_size = sizeof(CRIParser),
- .parser_parse = cri_parse,
- .parser_close = ff_parse_close,
+ .parse = cri_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dca_parser.c b/libavcodec/dca_parser.c
index 61b188a902..aaf4f42221 100644
--- a/libavcodec/dca_parser.c
+++ b/libavcodec/dca_parser.c
@@ -347,7 +347,7 @@ static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_dca_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DTS),
.priv_data_size = sizeof(DCAParseContext),
- .parser_init = dca_parse_init,
- .parser_parse = dca_parse,
- .parser_close = ff_parse_close,
+ .init = dca_parse_init,
+ .parse = dca_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index f5ac808d70..d9cf44383a 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -278,6 +278,6 @@ static av_cold void dirac_parse_close(AVCodecParserContext *s)
const FFCodecParser ff_dirac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DIRAC),
.priv_data_size = sizeof(DiracParseContext),
- .parser_parse = dirac_parse,
- .parser_close = dirac_parse_close,
+ .parse = dirac_parse,
+ .close = dirac_parse_close,
};
diff --git a/libavcodec/dnxhd_parser.c b/libavcodec/dnxhd_parser.c
index a51f05d458..3ab08d0974 100644
--- a/libavcodec/dnxhd_parser.c
+++ b/libavcodec/dnxhd_parser.c
@@ -142,6 +142,6 @@ static int dnxhd_parse(AVCodecParserContext *s,
const FFCodecParser ff_dnxhd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXHD),
.priv_data_size = sizeof(DNXHDParserContext),
- .parser_parse = dnxhd_parse,
- .parser_close = ff_parse_close,
+ .parse = dnxhd_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dnxuc_parser.c b/libavcodec/dnxuc_parser.c
index 6c41e3139d..b14cd519ab 100644
--- a/libavcodec/dnxuc_parser.c
+++ b/libavcodec/dnxuc_parser.c
@@ -85,6 +85,6 @@ static int dnxuc_parse(AVCodecParserContext *s,
const FFCodecParser ff_dnxuc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DNXUC),
.priv_data_size = sizeof(DNxUcParseContext),
- .parser_parse = dnxuc_parse,
- .parser_close = ff_parse_close,
+ .parse = dnxuc_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dolby_e_parser.c b/libavcodec/dolby_e_parser.c
index c685e30ddb..b7150795c0 100644
--- a/libavcodec/dolby_e_parser.c
+++ b/libavcodec/dolby_e_parser.c
@@ -69,5 +69,5 @@ end:
const FFCodecParser ff_dolby_e_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DOLBY_E),
.priv_data_size = sizeof(DBEParseContext),
- .parser_parse = dolby_e_parse,
+ .parse = dolby_e_parse,
};
diff --git a/libavcodec/dpx_parser.c b/libavcodec/dpx_parser.c
index d87ae38348..2b21d0f7ac 100644
--- a/libavcodec/dpx_parser.c
+++ b/libavcodec/dpx_parser.c
@@ -112,6 +112,6 @@ flush:
const FFCodecParser ff_dpx_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DPX),
.priv_data_size = sizeof(DPXParseContext),
- .parser_parse = dpx_parse,
- .parser_close = ff_parse_close,
+ .parse = dpx_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/dvaudio_parser.c b/libavcodec/dvaudio_parser.c
index 7463db35c0..4edd254a2f 100644
--- a/libavcodec/dvaudio_parser.c
+++ b/libavcodec/dvaudio_parser.c
@@ -43,5 +43,5 @@ static int dvaudio_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_dvaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVAUDIO),
- .parser_parse = dvaudio_parse,
+ .parse = dvaudio_parse,
};
diff --git a/libavcodec/dvbsub_parser.c b/libavcodec/dvbsub_parser.c
index 396b4d90f0..4527e4dd75 100644
--- a/libavcodec/dvbsub_parser.c
+++ b/libavcodec/dvbsub_parser.c
@@ -167,5 +167,5 @@ static int dvbsub_parse(AVCodecParserContext *s,
const FFCodecParser ff_dvbsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVB_SUBTITLE),
.priv_data_size = sizeof(DVBSubParseContext),
- .parser_parse = dvbsub_parse,
+ .parse = dvbsub_parse,
};
diff --git a/libavcodec/dvd_nav_parser.c b/libavcodec/dvd_nav_parser.c
index 69e6d828eb..ec4aba18fb 100644
--- a/libavcodec/dvd_nav_parser.c
+++ b/libavcodec/dvd_nav_parser.c
@@ -111,6 +111,6 @@ static int dvd_nav_parse(AVCodecParserContext *s,
const FFCodecParser ff_dvd_nav_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_NAV),
.priv_data_size = sizeof(DVDNavParseContext),
- .parser_init = dvd_nav_parse_init,
- .parser_parse = dvd_nav_parse,
+ .init = dvd_nav_parse_init,
+ .parse = dvd_nav_parse,
};
diff --git a/libavcodec/dvdsub_parser.c b/libavcodec/dvdsub_parser.c
index cf86b67944..e728c8120d 100644
--- a/libavcodec/dvdsub_parser.c
+++ b/libavcodec/dvdsub_parser.c
@@ -88,6 +88,6 @@ static av_cold void dvdsub_parse_close(AVCodecParserContext *s)
const FFCodecParser ff_dvdsub_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_DVD_SUBTITLE),
.priv_data_size = sizeof(DVDSubParseContext),
- .parser_parse = dvdsub_parse,
- .parser_close = dvdsub_parse_close,
+ .parse = dvdsub_parse,
+ .close = dvdsub_parse_close,
};
diff --git a/libavcodec/evc_parser.c b/libavcodec/evc_parser.c
index 8f858c9be8..f08006d005 100644
--- a/libavcodec/evc_parser.c
+++ b/libavcodec/evc_parser.c
@@ -375,6 +375,6 @@ static av_cold void evc_parser_close(AVCodecParserContext *s)
const FFCodecParser ff_evc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_EVC),
.priv_data_size = sizeof(EVCParserContext),
- .parser_parse = evc_parse,
- .parser_close = evc_parser_close,
+ .parse = evc_parse,
+ .close = evc_parser_close,
};
diff --git a/libavcodec/ffv1_parser.c b/libavcodec/ffv1_parser.c
index f444461647..f378970bff 100644
--- a/libavcodec/ffv1_parser.c
+++ b/libavcodec/ffv1_parser.c
@@ -84,6 +84,6 @@ static av_cold void ffv1_close(AVCodecParserContext *s)
const FFCodecParser ff_ffv1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FFV1),
.priv_data_size = sizeof(FFV1ParseContext),
- .parser_parse = parse,
- .parser_close = ffv1_close,
+ .parse = parse,
+ .close = ffv1_close,
};
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index 340ff68f25..9a5f5fd03a 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -906,7 +906,7 @@ static av_cold void flac_parse_close(AVCodecParserContext *c)
const FFCodecParser ff_flac_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FLAC),
.priv_data_size = sizeof(FLACParseContext),
- .parser_init = flac_parse_init,
- .parser_parse = flac_parse,
- .parser_close = flac_parse_close,
+ .init = flac_parse_init,
+ .parse = flac_parse,
+ .close = flac_parse_close,
};
diff --git a/libavcodec/ftr_parser.c b/libavcodec/ftr_parser.c
index 24ef405488..a45edcf457 100644
--- a/libavcodec/ftr_parser.c
+++ b/libavcodec/ftr_parser.c
@@ -100,6 +100,6 @@ static int ftr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_ftr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_FTR),
.priv_data_size = sizeof(FTRParseContext),
- .parser_parse = ftr_parse,
- .parser_close = ff_parse_close,
+ .parse = ftr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/g723_1_parser.c b/libavcodec/g723_1_parser.c
index 70a83e3e1b..e2fba33ca6 100644
--- a/libavcodec/g723_1_parser.c
+++ b/libavcodec/g723_1_parser.c
@@ -56,6 +56,6 @@ static int g723_1_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_g723_1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G723_1),
.priv_data_size = sizeof(G723_1ParseContext),
- .parser_parse = g723_1_parse,
- .parser_close = ff_parse_close,
+ .parse = g723_1_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/g729_parser.c b/libavcodec/g729_parser.c
index 17b8415584..5e085aab28 100644
--- a/libavcodec/g729_parser.c
+++ b/libavcodec/g729_parser.c
@@ -88,6 +88,6 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_g729_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_G729, AV_CODEC_ID_ACELP_KELVIN),
.priv_data_size = sizeof(G729ParseContext),
- .parser_parse = g729_parse,
- .parser_close = ff_parse_close,
+ .parse = g729_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/gif_parser.c b/libavcodec/gif_parser.c
index c95e9430fd..7204d71d55 100644
--- a/libavcodec/gif_parser.c
+++ b/libavcodec/gif_parser.c
@@ -204,6 +204,6 @@ static int gif_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_gif_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GIF),
.priv_data_size = sizeof(GIFParseContext),
- .parser_parse = gif_parse,
- .parser_close = ff_parse_close,
+ .parse = gif_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/gsm_parser.c b/libavcodec/gsm_parser.c
index 1823ff3188..5d448cc3e2 100644
--- a/libavcodec/gsm_parser.c
+++ b/libavcodec/gsm_parser.c
@@ -87,6 +87,6 @@ static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_gsm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS),
.priv_data_size = sizeof(GSMParseContext),
- .parser_parse = gsm_parse,
- .parser_close = ff_parse_close,
+ .parse = gsm_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/h261_parser.c b/libavcodec/h261_parser.c
index cedcdfe038..c08cff3344 100644
--- a/libavcodec/h261_parser.c
+++ b/libavcodec/h261_parser.c
@@ -90,6 +90,6 @@ static int h261_parse(AVCodecParserContext *s,
const FFCodecParser ff_h261_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H261),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = h261_parse,
- .parser_close = ff_parse_close,
+ .parse = h261_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/h263_parser.c b/libavcodec/h263_parser.c
index 939a839e8e..3fc969c331 100644
--- a/libavcodec/h263_parser.c
+++ b/libavcodec/h263_parser.c
@@ -91,6 +91,6 @@ static int h263_parse(AVCodecParserContext *s,
const FFCodecParser ff_h263_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H263),
.priv_data_size = sizeof(ParseContext),
- .parser_parse = h263_parse,
- .parser_close = ff_parse_close,
+ .parse = h263_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index baed7a3e34..040739a1d4 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -686,7 +686,7 @@ static av_cold int init(AVCodecParserContext *s)
const FFCodecParser ff_h264_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_H264),
.priv_data_size = sizeof(H264ParseContext),
- .parser_init = init,
- .parser_parse = h264_parse,
- .parser_close = h264_close,
+ .init = init,
+ .parse = h264_parse,
+ .close = h264_close,
};
diff --git a/libavcodec/hdr_parser.c b/libavcodec/hdr_parser.c
index eb34803c73..0fdfcb5c5a 100644
--- a/libavcodec/hdr_parser.c
+++ b/libavcodec/hdr_parser.c
@@ -75,6 +75,6 @@ static int hdr_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_hdr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RADIANCE_HDR),
.priv_data_size = sizeof(HDRParseContext),
- .parser_parse = hdr_parse,
- .parser_close = ff_parse_close,
+ .parse = hdr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/hevc/parser.c b/libavcodec/hevc/parser.c
index 43f895ad57..62bcd91172 100644
--- a/libavcodec/hevc/parser.c
+++ b/libavcodec/hevc/parser.c
@@ -356,6 +356,6 @@ static void hevc_parser_close(AVCodecParserContext *s)
const FFCodecParser ff_hevc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_HEVC),
.priv_data_size = sizeof(HEVCParserContext),
- .parser_parse = hevc_parse,
- .parser_close = hevc_parser_close,
+ .parse = hevc_parse,
+ .close = hevc_parser_close,
};
diff --git a/libavcodec/ipu_parser.c b/libavcodec/ipu_parser.c
index d2ff23e7b2..324f0898e9 100644
--- a/libavcodec/ipu_parser.c
+++ b/libavcodec/ipu_parser.c
@@ -73,6 +73,6 @@ static int ipu_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_ipu_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_IPU),
.priv_data_size = sizeof(IPUParseContext),
- .parser_parse = ipu_parse,
- .parser_close = ff_parse_close,
+ .parse = ipu_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/jpeg2000_parser.c b/libavcodec/jpeg2000_parser.c
index 2e6d91ee59..a5dcc9c9f1 100644
--- a/libavcodec/jpeg2000_parser.c
+++ b/libavcodec/jpeg2000_parser.c
@@ -215,6 +215,6 @@ static int jpeg2000_parse(AVCodecParserContext *s,
const FFCodecParser ff_jpeg2000_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEG2000),
.priv_data_size = sizeof(JPEG2000ParserContext),
- .parser_parse = jpeg2000_parse,
- .parser_close = ff_parse_close,
+ .parse = jpeg2000_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/jpegxl_parser.c b/libavcodec/jpegxl_parser.c
index 8a6bafdf92..a16a2733f9 100644
--- a/libavcodec/jpegxl_parser.c
+++ b/libavcodec/jpegxl_parser.c
@@ -1549,6 +1549,6 @@ flush:
const FFCodecParser ff_jpegxl_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_JPEGXL, AV_CODEC_ID_JPEGXL_ANIM),
.priv_data_size = sizeof(JXLParseContext),
- .parser_parse = jpegxl_parse,
- .parser_close = ff_parse_close,
+ .parse = jpegxl_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/latm_parser.c b/libavcodec/latm_parser.c
index 6cd1eb3379..c77bcbaa22 100644
--- a/libavcodec/latm_parser.c
+++ b/libavcodec/latm_parser.c
@@ -108,6 +108,6 @@ static int latm_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_aac_latm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_AAC_LATM),
.priv_data_size = sizeof(LATMParseContext),
- .parser_parse = latm_parse,
- .parser_close = ff_parse_close
+ .parse = latm_parse,
+ .close = ff_parse_close
};
diff --git a/libavcodec/misc4_parser.c b/libavcodec/misc4_parser.c
index 332e79875e..df1bbd07b4 100644
--- a/libavcodec/misc4_parser.c
+++ b/libavcodec/misc4_parser.c
@@ -77,6 +77,6 @@ static int misc4_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_misc4_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MISC4),
.priv_data_size = sizeof(MISC4Context),
- .parser_parse = misc4_parse,
- .parser_close = ff_parse_close,
+ .parse = misc4_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mjpeg_parser.c b/libavcodec/mjpeg_parser.c
index 99ac75771e..66f364d8f9 100644
--- a/libavcodec/mjpeg_parser.c
+++ b/libavcodec/mjpeg_parser.c
@@ -132,6 +132,6 @@ static int jpeg_parse(AVCodecParserContext *s,
const FFCodecParser ff_mjpeg_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MJPEG, AV_CODEC_ID_JPEGLS),
.priv_data_size = sizeof(MJPEGParserContext),
- .parser_parse = jpeg_parse,
- .parser_close = ff_parse_close,
+ .parse = jpeg_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mlp_parser.c b/libavcodec/mlp_parser.c
index 20d01db943..4f348c5d4d 100644
--- a/libavcodec/mlp_parser.c
+++ b/libavcodec/mlp_parser.c
@@ -208,7 +208,7 @@ lost_sync:
const FFCodecParser ff_mlp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MLP, AV_CODEC_ID_TRUEHD),
.priv_data_size = sizeof(MLPParseContext),
- .parser_init = mlp_init,
- .parser_parse = mlp_parse,
- .parser_close = ff_parse_close,
+ .init = mlp_init,
+ .parse = mlp_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mpeg4video_parser.c b/libavcodec/mpeg4video_parser.c
index 0bb63e1114..fe6d333fc9 100644
--- a/libavcodec/mpeg4video_parser.c
+++ b/libavcodec/mpeg4video_parser.c
@@ -159,7 +159,7 @@ static int mpeg4video_parse(AVCodecParserContext *s,
const FFCodecParser ff_mpeg4video_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG4),
.priv_data_size = sizeof(struct Mp4vParseContext),
- .parser_init = mpeg4video_parse_init,
- .parser_parse = mpeg4video_parse,
- .parser_close = ff_parse_close,
+ .init = mpeg4video_parse_init,
+ .parse = mpeg4video_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c
index 6363f1f0a8..8c33d36dfe 100644
--- a/libavcodec/mpegaudio_parser.c
+++ b/libavcodec/mpegaudio_parser.c
@@ -141,6 +141,6 @@ const FFCodecParser ff_mpegaudio_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MP1, AV_CODEC_ID_MP2,
AV_CODEC_ID_MP3, AV_CODEC_ID_MP3ADU),
.priv_data_size = sizeof(MpegAudioParseContext),
- .parser_parse = mpegaudio_parse,
- .parser_close = ff_parse_close,
+ .parse = mpegaudio_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/mpegvideo_parser.c b/libavcodec/mpegvideo_parser.c
index 48e0e31159..1afb695d09 100644
--- a/libavcodec/mpegvideo_parser.c
+++ b/libavcodec/mpegvideo_parser.c
@@ -303,7 +303,7 @@ static av_cold int mpegvideo_parse_init(AVCodecParserContext *s)
const FFCodecParser ff_mpegvideo_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_MPEG1VIDEO, AV_CODEC_ID_MPEG2VIDEO),
.priv_data_size = sizeof(struct MpvParseContext),
- .parser_init = mpegvideo_parse_init,
- .parser_parse = mpegvideo_parse,
- .parser_close = ff_parse_close,
+ .init = mpegvideo_parse_init,
+ .parse = mpegvideo_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/opus/parser.c b/libavcodec/opus/parser.c
index fe6a03c783..ae3d66592c 100644
--- a/libavcodec/opus/parser.c
+++ b/libavcodec/opus/parser.c
@@ -217,6 +217,6 @@ fail:
const FFCodecParser ff_opus_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_OPUS),
.priv_data_size = sizeof(OpusParserContext),
- .parser_parse = opus_parse,
- .parser_close = ff_parse_close
+ .parse = opus_parse,
+ .close = ff_parse_close
};
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 701a962a56..789bd9d1f1 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -65,8 +65,8 @@ found:
goto err_out;
s->fetch_timestamp=1;
s->pict_type = AV_PICTURE_TYPE_I;
- if (ffparser->parser_init) {
- ret = ffparser->parser_init(s);
+ if (ffparser->init) {
+ ret = ffparser->init(s);
if (ret != 0)
goto err_out;
}
@@ -164,8 +164,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
ff_fetch_timestamp(s, 0, 0, 0);
}
/* WARNING: the returned index can be negative */
- index = ffcodecparser(s->parser)->parser_parse(s, avctx, (const uint8_t **) poutbuf,
- poutbuf_size, buf, buf_size);
+ index = ffcodecparser(s->parser)->parse(s, avctx, (const uint8_t **) poutbuf,
+ poutbuf_size, buf, buf_size);
av_assert0(index > -0x20000000); // The API does not allow returning AVERROR codes
#define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name
if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
@@ -197,8 +197,8 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
av_cold void av_parser_close(AVCodecParserContext *s)
{
if (s) {
- if (ffcodecparser(s->parser)->parser_close)
- ffcodecparser(s->parser)->parser_close(s);
+ if (ffcodecparser(s->parser)->close)
+ ffcodecparser(s->parser)->close(s);
av_freep(&s->priv_data);
av_free(s);
}
diff --git a/libavcodec/parser_internal.h b/libavcodec/parser_internal.h
index 69f72d9bf6..cb1995de8b 100644
--- a/libavcodec/parser_internal.h
+++ b/libavcodec/parser_internal.h
@@ -30,12 +30,12 @@ typedef union FFCodecParser {
struct {
int codec_ids[7]; /* several codec IDs are permitted */
int priv_data_size;
- int (*parser_init)(AVCodecParserContext *s);
- int (*parser_parse)(AVCodecParserContext *s,
- AVCodecContext *avctx,
- const uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size);
- void (*parser_close)(AVCodecParserContext *s);
+ int (*init)(AVCodecParserContext *s);
+ int (*parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*close)(AVCodecParserContext *s);
int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size);
};
AVCodecParser p;
@@ -43,12 +43,12 @@ typedef union FFCodecParser {
typedef struct FFCodecParser {
AVCodecParser p;
unsigned priv_data_size;
- int (*parser_init)(AVCodecParserContext *s);
- int (*parser_parse)(AVCodecParserContext *s,
- AVCodecContext *avctx,
- const uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size);
- void (*parser_close)(AVCodecParserContext *s);
+ int (*init)(AVCodecParserContext *s);
+ int (*parse)(AVCodecParserContext *s,
+ AVCodecContext *avctx,
+ const uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size);
+ void (*close)(AVCodecParserContext *s);
#endif
} FFCodecParser;
diff --git a/libavcodec/parsers.c b/libavcodec/parsers.c
index ee3f9ab12e..c3460a3b86 100644
--- a/libavcodec/parsers.c
+++ b/libavcodec/parsers.c
@@ -24,13 +24,13 @@
#if FF_API_PARSER_PRIVATE
#include <assert.h>
#include <stddef.h>
-#define CHECK_OFFSET(field) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.field), "Wrong offsets")
-CHECK_OFFSET(codec_ids);
-CHECK_OFFSET(priv_data_size);
-CHECK_OFFSET(parser_init);
-CHECK_OFFSET(parser_parse);
-CHECK_OFFSET(parser_close);
-CHECK_OFFSET(split);
+#define CHECK_OFFSET(field, public_prefix) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.public_prefix ## field), "Wrong offsets")
+CHECK_OFFSET(codec_ids,);
+CHECK_OFFSET(priv_data_size,);
+CHECK_OFFSET(init, parser_);
+CHECK_OFFSET(parse, parser_);
+CHECK_OFFSET(close, parser_);
+CHECK_OFFSET(split,);
#endif
extern const FFCodecParser ff_aac_parser;
diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c
index 76af53197b..fbeae1103b 100644
--- a/libavcodec/png_parser.c
+++ b/libavcodec/png_parser.c
@@ -114,6 +114,6 @@ flush:
const FFCodecParser ff_png_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PNG),
.priv_data_size = sizeof(PNGParseContext),
- .parser_parse = png_parse,
- .parser_close = ff_parse_close,
+ .parse = png_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index 3f106ca1c4..27030f8512 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -139,6 +139,6 @@ const FFCodecParser ff_pnm_parser = {
AV_CODEC_ID_PBM, AV_CODEC_ID_PAM, AV_CODEC_ID_PFM,
AV_CODEC_ID_PHM),
.priv_data_size = sizeof(PNMParseContext),
- .parser_parse = pnm_parse,
- .parser_close = ff_parse_close,
+ .parse = pnm_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/prores_parser.c b/libavcodec/prores_parser.c
index c2c1729280..aadf76d793 100644
--- a/libavcodec/prores_parser.c
+++ b/libavcodec/prores_parser.c
@@ -125,5 +125,5 @@ static int parse(AVCodecParserContext *s,
const FFCodecParser ff_prores_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/prores_raw_parser.c b/libavcodec/prores_raw_parser.c
index d571925841..52650e71a5 100644
--- a/libavcodec/prores_raw_parser.c
+++ b/libavcodec/prores_raw_parser.c
@@ -83,5 +83,5 @@ static int prores_raw_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_prores_raw_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_PRORES_RAW),
- .parser_parse = prores_raw_parse,
+ .parse = prores_raw_parse,
};
diff --git a/libavcodec/qoi_parser.c b/libavcodec/qoi_parser.c
index 04c040c1ab..f7bf2a05bb 100644
--- a/libavcodec/qoi_parser.c
+++ b/libavcodec/qoi_parser.c
@@ -73,6 +73,6 @@ static int qoi_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_qoi_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_QOI),
.priv_data_size = sizeof(QOIParseContext),
- .parser_parse = qoi_parse,
- .parser_close = ff_parse_close,
+ .parse = qoi_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/rv34_parser.c b/libavcodec/rv34_parser.c
index 5d91b37d57..c3aa8357df 100644
--- a/libavcodec/rv34_parser.c
+++ b/libavcodec/rv34_parser.c
@@ -79,5 +79,5 @@ static int rv34_parse(AVCodecParserContext *s,
const FFCodecParser ff_rv34_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_RV30, AV_CODEC_ID_RV40),
.priv_data_size = sizeof(RV34ParseContext),
- .parser_parse = rv34_parse,
+ .parse = rv34_parse,
};
diff --git a/libavcodec/sbc_parser.c b/libavcodec/sbc_parser.c
index 35e37601bc..58150885e2 100644
--- a/libavcodec/sbc_parser.c
+++ b/libavcodec/sbc_parser.c
@@ -120,6 +120,6 @@ static int sbc_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_sbc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SBC),
.priv_data_size = sizeof(SBCParseContext),
- .parser_parse = sbc_parse,
- .parser_close = ff_parse_close,
+ .parse = sbc_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/sipr_parser.c b/libavcodec/sipr_parser.c
index d6e1ae295c..82a37c690b 100644
--- a/libavcodec/sipr_parser.c
+++ b/libavcodec/sipr_parser.c
@@ -70,6 +70,6 @@ static int sipr_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_sipr_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_SIPR),
.priv_data_size = sizeof(SiprParserContext),
- .parser_parse = sipr_parse,
- .parser_close = ff_parse_close,
+ .parse = sipr_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/tak_parser.c b/libavcodec/tak_parser.c
index 2c5af1019a..060a90fac1 100644
--- a/libavcodec/tak_parser.c
+++ b/libavcodec/tak_parser.c
@@ -127,6 +127,6 @@ fail:
const FFCodecParser ff_tak_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_TAK),
.priv_data_size = sizeof(TAKParseContext),
- .parser_parse = tak_parse,
- .parser_close = ff_parse_close,
+ .parse = tak_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c
index ef7878ef51..4e7d3de165 100644
--- a/libavcodec/vc1_parser.c
+++ b/libavcodec/vc1_parser.c
@@ -274,7 +274,7 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s)
const FFCodecParser ff_vc1_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VC1),
.priv_data_size = sizeof(VC1ParseContext),
- .parser_init = vc1_parse_init,
- .parser_parse = vc1_parse,
- .parser_close = ff_parse_close,
+ .init = vc1_parse_init,
+ .parse = vc1_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/vorbis_parser.c b/libavcodec/vorbis_parser.c
index 4290dd92ac..88b81fcb53 100644
--- a/libavcodec/vorbis_parser.c
+++ b/libavcodec/vorbis_parser.c
@@ -339,7 +339,7 @@ static av_cold void vorbis_parser_close(AVCodecParserContext *ctx)
const FFCodecParser ff_vorbis_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS),
.priv_data_size = sizeof(VorbisParseContext),
- .parser_parse = vorbis_parse,
- .parser_close = vorbis_parser_close,
+ .parse = vorbis_parse,
+ .close = vorbis_parser_close,
};
#endif /* CONFIG_VORBIS_PARSER */
diff --git a/libavcodec/vp3_parser.c b/libavcodec/vp3_parser.c
index e5030c445d..1cd12b9e58 100644
--- a/libavcodec/vp3_parser.c
+++ b/libavcodec/vp3_parser.c
@@ -39,5 +39,5 @@ static int parse(AVCodecParserContext *s,
const FFCodecParser ff_vp3_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_THEORA, AV_CODEC_ID_VP3,
AV_CODEC_ID_VP6, AV_CODEC_ID_VP6F, AV_CODEC_ID_VP6A),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/vp8_parser.c b/libavcodec/vp8_parser.c
index a6b01722fb..f99a414f53 100644
--- a/libavcodec/vp8_parser.c
+++ b/libavcodec/vp8_parser.c
@@ -76,5 +76,5 @@ static int parse(AVCodecParserContext *s,
const FFCodecParser ff_vp8_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP8),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/vp9_parser.c b/libavcodec/vp9_parser.c
index 007889220b..4caa730f4f 100644
--- a/libavcodec/vp9_parser.c
+++ b/libavcodec/vp9_parser.c
@@ -66,5 +66,5 @@ static int parse(AVCodecParserContext *ctx,
const FFCodecParser ff_vp9_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VP9),
- .parser_parse = parse,
+ .parse = parse,
};
diff --git a/libavcodec/vvc_parser.c b/libavcodec/vvc_parser.c
index f134ab6df6..6a96dc086b 100644
--- a/libavcodec/vvc_parser.c
+++ b/libavcodec/vvc_parser.c
@@ -509,7 +509,7 @@ static av_cold void vvc_parser_close(AVCodecParserContext *s)
const FFCodecParser ff_vvc_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_VVC),
.priv_data_size = sizeof(VVCParserContext),
- .parser_init = vvc_parser_init,
- .parser_close = vvc_parser_close,
- .parser_parse = vvc_parser_parse,
+ .init = vvc_parser_init,
+ .close = vvc_parser_close,
+ .parse = vvc_parser_parse,
};
diff --git a/libavcodec/webp_parser.c b/libavcodec/webp_parser.c
index 155af28f6c..86c9bad8d9 100644
--- a/libavcodec/webp_parser.c
+++ b/libavcodec/webp_parser.c
@@ -108,6 +108,6 @@ flush:
const FFCodecParser ff_webp_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_WEBP),
.priv_data_size = sizeof(WebPParseContext),
- .parser_parse = webp_parse,
- .parser_close = ff_parse_close,
+ .parse = webp_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/xbm_parser.c b/libavcodec/xbm_parser.c
index 936612d30f..50e4480809 100644
--- a/libavcodec/xbm_parser.c
+++ b/libavcodec/xbm_parser.c
@@ -104,7 +104,7 @@ static int xbm_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_xbm_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XBM),
.priv_data_size = sizeof(XBMParseContext),
- .parser_init = xbm_init,
- .parser_parse = xbm_parse,
- .parser_close = ff_parse_close,
+ .init = xbm_init,
+ .parse = xbm_parse,
+ .close = ff_parse_close,
};
diff --git a/libavcodec/xma_parser.c b/libavcodec/xma_parser.c
index c2eea37833..5768b603da 100644
--- a/libavcodec/xma_parser.c
+++ b/libavcodec/xma_parser.c
@@ -59,5 +59,5 @@ static int xma_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
const FFCodecParser ff_xma_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XMA2),
.priv_data_size = sizeof(XMAParserContext),
- .parser_parse = xma_parse,
+ .parse = xma_parse,
};
diff --git a/libavcodec/xwd_parser.c b/libavcodec/xwd_parser.c
index 1368283b21..5d7b2f10bd 100644
--- a/libavcodec/xwd_parser.c
+++ b/libavcodec/xwd_parser.c
@@ -99,6 +99,6 @@ static int xwd_parse(AVCodecParserContext *s, AVCodecContext *avctx,
const FFCodecParser ff_xwd_parser = {
PARSER_CODEC_LIST(AV_CODEC_ID_XWD),
.priv_data_size = sizeof(XWDParseContext),
- .parser_parse = xwd_parse,
- .parser_close = ff_parse_close,
+ .parse = xwd_parse,
+ .close = ff_parse_close,
};
--
2.49.1
>From 469a79bde5d561effc889deacd23a98be36ed512 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Sun, 26 Oct 2025 17:40:02 +0100
Subject: [PATCH 5/5] avcodec/avcodec: Schedule parser API to use enum
AVCodecID for codec ids
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
doc/APIchanges | 4 ++++
libavcodec/avcodec.h | 8 ++++++++
libavcodec/parser.c | 4 ++++
libavcodec/parser_internal.h | 4 ++++
libavcodec/version_major.h | 1 +
5 files changed, 21 insertions(+)
diff --git a/doc/APIchanges b/doc/APIchanges
index 654f1646a4..8f94a72d41 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-10-xx - xxxxxxxxxx - lavc 62.xx.100 - avcodec.h
+ Schedule AVCodecParser and av_parser_init() to use enum AVCodecID
+ for codec ids on the next major version bump.
+
2025-10-xx - xxxxxxxxxx - lavc 62.xx.100 - avcodec.h
AVCodecParser fields priv_data_size, parser_init, parser_parse,
parser_close, split will be removed from the public API
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index e681b7affe..9481888792 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_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)
--
2.49.1
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-10-26 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-26 23:13 [FFmpeg-devel] [PATCH] Schedule semi-private AVCodecParser fields for removal from avcodec.h (PR #20757) mkver via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git