1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

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 <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-10-26 13:16:27 +01:00
parent 12f7a7724d
commit e9fe30ccd1
67 changed files with 174 additions and 72 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
};

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
};

View File

@@ -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,

View File

@@ -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,
};

View File

@@ -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,
};

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -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 */

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
};

View File

@@ -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,
};

View File

@@ -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,

View File

@@ -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,
};

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
};

View File

@@ -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,
};

View File

@@ -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,
};

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
};

View File

@@ -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,