Commit ec6402b7 authored by Anton Khirnov's avatar Anton Khirnov
Browse files

lavc: use designated initialisers for all codecs.

It's more readable and less prone to breakage.
parent 3ad16841
......@@ -866,15 +866,14 @@ static av_cold int decode_end(AVCodecContext *avctx){
}
AVCodec ff_fourxm_decoder = {
"4xm",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_4XM,
sizeof(FourXContext),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1,
.name = "4xm",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_4XM,
.priv_data_size = sizeof(FourXContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
};
......@@ -221,14 +221,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
AVCodec ff_eightbps_decoder = {
"8bps",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_8BPS,
sizeof(EightBpsContext),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1,
.name = "8bps",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_8BPS,
.priv_data_size = sizeof(EightBpsContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"),
};
......@@ -2539,14 +2539,13 @@ av_cold static int latm_decode_init(AVCodecContext *avctx)
AVCodec ff_aac_decoder = {
"aac",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_AAC,
sizeof(AACContext),
aac_decode_init,
NULL,
aac_decode_close,
aac_decode_frame,
.name = "aac",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_AAC,
.priv_data_size = sizeof(AACContext),
.init = aac_decode_init,
.close = aac_decode_close,
.decode = aac_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
......
......@@ -674,13 +674,13 @@ static const AVClass aacenc_class = {
};
AVCodec ff_aac_encoder = {
"aac",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_AAC,
sizeof(AACEncContext),
aac_encode_init,
aac_encode_frame,
aac_encode_end,
.name = "aac",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_AAC,
.priv_data_size = sizeof(AACEncContext),
.init = aac_encode_init,
.encode = aac_encode_frame,
.close = aac_encode_end,
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
......
......@@ -110,14 +110,13 @@ static av_cold int aasc_decode_end(AVCodecContext *avctx)
}
AVCodec ff_aasc_decoder = {
"aasc",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_AASC,
sizeof(AascContext),
aasc_decode_init,
NULL,
aasc_decode_end,
aasc_decode_frame,
CODEC_CAP_DR1,
.name = "aasc",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_AASC,
.priv_data_size = sizeof(AascContext),
.init = aasc_decode_init,
.close = aasc_decode_end,
.decode = aasc_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"),
};
......@@ -121,14 +121,13 @@ static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
AVCodec ff_ac3_fixed_encoder = {
"ac3_fixed",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_AC3,
sizeof(AC3EncodeContext),
ac3_fixed_encode_init,
ff_ac3_fixed_encode_frame,
ff_ac3_encode_close,
NULL,
.name = "ac3_fixed",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_AC3,
.priv_data_size = sizeof(AC3EncodeContext),
.init = ac3_fixed_encode_init,
.encode = ff_ac3_fixed_encode_frame,
.close = ff_ac3_encode_close,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
.priv_class = &ac3enc_class,
......
......@@ -121,14 +121,13 @@ static void clip_coefficients(DSPContext *dsp, float *coef, unsigned int len)
#if CONFIG_AC3_ENCODER
AVCodec ff_ac3_encoder = {
"ac3",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_AC3,
sizeof(AC3EncodeContext),
ff_ac3_encode_init,
ff_ac3_float_encode_frame,
ff_ac3_encode_close,
NULL,
.name = "ac3",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_AC3,
.priv_data_size = sizeof(AC3EncodeContext),
.init = ff_ac3_encode_init,
.encode = ff_ac3_float_encode_frame,
.close = ff_ac3_encode_close,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
.priv_class = &ac3enc_class,
......
......@@ -167,14 +167,12 @@ static int adx_decode_frame(AVCodecContext *avctx,
}
AVCodec ff_adpcm_adx_decoder = {
"adpcm_adx",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_ADPCM_ADX,
sizeof(ADXContext),
adx_decode_init,
NULL,
NULL,
adx_decode_frame,
.name = "adpcm_adx",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_ADPCM_ADX,
.priv_data_size = sizeof(ADXContext),
.init = adx_decode_init,
.decode = adx_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
};
......@@ -184,14 +184,13 @@ static int adx_encode_frame(AVCodecContext *avctx,
}
AVCodec ff_adpcm_adx_encoder = {
"adpcm_adx",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_ADPCM_ADX,
sizeof(ADXContext),
adx_encode_init,
adx_encode_frame,
adx_encode_close,
NULL,
.name = "adpcm_adx",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_ADPCM_ADX,
.priv_data_size = sizeof(ADXContext),
.init = adx_encode_init,
.encode = adx_encode_frame,
.close = adx_encode_close,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"),
};
......@@ -679,13 +679,12 @@ static av_cold int alac_decode_close(AVCodecContext *avctx)
}
AVCodec ff_alac_decoder = {
"alac",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_ALAC,
sizeof(ALACContext),
alac_decode_init,
NULL,
alac_decode_close,
alac_decode_frame,
.name = "alac",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_ALAC,
.priv_data_size = sizeof(ALACContext),
.init = alac_decode_init,
.close = alac_decode_close,
.decode = alac_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
};
......@@ -524,13 +524,13 @@ static av_cold int alac_encode_close(AVCodecContext *avctx)
}
AVCodec ff_alac_encoder = {
"alac",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_ALAC,
sizeof(AlacEncodeContext),
alac_encode_init,
alac_encode_frame,
alac_encode_close,
.name = "alac",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_ALAC,
.priv_data_size = sizeof(AlacEncodeContext),
.init = alac_encode_init,
.encode = alac_encode_frame,
.close = alac_encode_close,
.capabilities = CODEC_CAP_SMALL_LAST_FRAME,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
......
......@@ -1739,14 +1739,13 @@ static av_cold void flush(AVCodecContext *avctx)
AVCodec ff_als_decoder = {
"als",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_MP4ALS,
sizeof(ALSDecContext),
decode_init,
NULL,
decode_end,
decode_frame,
.name = "als",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_MP4ALS,
.priv_data_size = sizeof(ALSDecContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.flush = flush,
.capabilities = CODEC_CAP_SUBFRAMES,
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"),
......
......@@ -184,14 +184,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
}
AVCodec ff_anm_decoder = {
"anm",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_ANM,
sizeof(AnmContext),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1,
.name = "anm",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_ANM,
.priv_data_size = sizeof(AnmContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"),
};
......@@ -885,14 +885,13 @@ static void ape_flush(AVCodecContext *avctx)
}
AVCodec ff_ape_decoder = {
"ape",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_APE,
sizeof(APEContext),
ape_decode_init,
NULL,
ape_decode_close,
ape_decode_frame,
.name = "ape",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_APE,
.priv_data_size = sizeof(APEContext),
.init = ape_decode_init,
.close = ape_decode_close,
.decode = ape_decode_frame,
.capabilities = CODEC_CAP_SUBFRAMES,
.flush = ape_flush,
.long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"),
......
......@@ -603,39 +603,37 @@ static av_cold int decode_end(AVCodecContext *avctx){
}
AVCodec ff_asv1_decoder = {
"asv1",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_ASV1,
sizeof(ASV1Context),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1,
.name = "asv1",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_ASV1,
.priv_data_size = sizeof(ASV1Context),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
};
AVCodec ff_asv2_decoder = {
"asv2",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_ASV2,
sizeof(ASV1Context),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1,
.name = "asv2",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_ASV2,
.priv_data_size = sizeof(ASV1Context),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
};
#if CONFIG_ASV1_ENCODER
AVCodec ff_asv1_encoder = {
"asv1",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_ASV1,
sizeof(ASV1Context),
encode_init,
encode_frame,
.name = "asv1",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_ASV1,
.priv_data_size = sizeof(ASV1Context),
.init = encode_init,
.encode = encode_frame,
//encode_end,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("ASUS V1"),
......@@ -644,12 +642,12 @@ AVCodec ff_asv1_encoder = {
#if CONFIG_ASV2_ENCODER
AVCodec ff_asv2_encoder = {
"asv2",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_ASV2,
sizeof(ASV1Context),
encode_init,
encode_frame,
.name = "asv2",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_ASV2,
.priv_data_size = sizeof(ASV1Context),
.init = encode_init,
.encode = encode_frame,
//encode_end,
.pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV420P, PIX_FMT_NONE},
.long_name= NULL_IF_CONFIG_SMALL("ASUS V2"),
......
......@@ -123,16 +123,14 @@ static av_cold int aura_decode_end(AVCodecContext *avctx)
}
AVCodec ff_aura2_decoder = {
"aura2",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_AURA2,
sizeof(AuraDecodeContext),
aura_decode_init,
NULL,
aura_decode_end,
aura_decode_frame,
CODEC_CAP_DR1,
NULL,
.name = "aura2",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_AURA2,
.priv_data_size = sizeof(AuraDecodeContext),
.init = aura_decode_init,
.close = aura_decode_end,
.decode = aura_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"),
};
......@@ -151,14 +151,12 @@ static av_cold int avs_decode_init(AVCodecContext * avctx)
}
AVCodec ff_avs_decoder = {
"avs",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_AVS,
sizeof(AvsContext),
avs_decode_init,
NULL,
NULL,
avs_decode_frame,
CODEC_CAP_DR1,
.name = "avs",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_AVS,
.priv_data_size = sizeof(AvsContext),
.init = avs_decode_init,
.decode = avs_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"),
};
......@@ -1318,13 +1318,12 @@ static av_cold int decode_end(AVCodecContext *avctx)
}
AVCodec ff_bink_decoder = {
"binkvideo",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_BINKVIDEO,
sizeof(BinkContext),
decode_init,
NULL,
decode_end,
decode_frame,
.name = "binkvideo",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_BINKVIDEO,
.priv_data_size = sizeof(BinkContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Bink video"),
};
......@@ -292,25 +292,23 @@ static int decode_frame(AVCodecContext *avctx,
}
AVCodec ff_binkaudio_rdft_decoder = {
"binkaudio_rdft",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_BINKAUDIO_RDFT,
sizeof(BinkAudioContext),
decode_init,
NULL,
decode_end,
decode_frame,
.name = "binkaudio_rdft",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_BINKAUDIO_RDFT,
.priv_data_size = sizeof(BinkAudioContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)")
};
AVCodec ff_binkaudio_dct_decoder = {
"binkaudio_dct",
AVMEDIA_TYPE_AUDIO,
CODEC_ID_BINKAUDIO_DCT,
sizeof(BinkAudioContext),
decode_init,
NULL,
decode_end,
decode_frame,
.name = "binkaudio_dct",
.type = AVMEDIA_TYPE_AUDIO,
.id = CODEC_ID_BINKAUDIO_DCT,
.priv_data_size = sizeof(BinkAudioContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)")
};
......@@ -336,14 +336,13 @@ static av_cold int bmp_decode_end(AVCodecContext *avctx)
}
AVCodec ff_bmp_decoder = {
"bmp",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_BMP,
sizeof(BMPContext),
bmp_decode_init,
NULL,
bmp_decode_end,
bmp_decode_frame,
CODEC_CAP_DR1,
.name = "bmp",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_BMP,
.priv_data_size = sizeof(BMPContext),
.init = bmp_decode_init,
.close = bmp_decode_end,
.decode = bmp_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("BMP image"),
};
......@@ -150,13 +150,12 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
}
AVCodec ff_bmp_encoder = {
"bmp",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_BMP,
sizeof(BMPContext),
bmp_encode_init,
bmp_encode_frame,
NULL, //encode_end,
.name = "bmp",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_BMP,
.priv_data_size = sizeof(BMPContext),
.init = bmp_encode_init,
.encode = bmp_encode_frame,
.pix_fmts = (const enum PixelFormat[]){
PIX_FMT_BGR24,
PIX_FMT_RGB555, PIX_FMT_RGB565,
......
......@@ -243,14 +243,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
}
AVCodec ff_c93_decoder = {
"c93",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_C93,
sizeof(C93DecoderContext),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1,
.name = "c93",
.type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_C93,
.priv_data_size = sizeof(C93DecoderContext),
.init = decode_init,
.close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Interplay C93"),
};
......@@ -710,15 +710,14 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
}
AVCodec ff_cavs_decoder = {
"cavs",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_CAVS,
sizeof(AVSContext),
ff_cavs_init,
NULL,
ff_cavs_end,
cavs_decode_frame,
CODEC_CAP_DR1 | CODEC_CAP_DELAY,