From e9fe30ccd112239d1b93cabd890bdea1c907afcb Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 26 Oct 2025 13:16:27 +0100 Subject: [PATCH] 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.) Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt --- 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 #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 cc6b75319e..95efe28b0a 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, @@ -97,6 +98,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 05094d782f..f5bc8d7126 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" @@ -272,7 +273,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,