mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
avcodec/mpegvideo_enc: Deduplicate ff_mpv_generic_options-based AVClasses
The child_class_next API relied on different AVCodecs to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
19d8077e31
commit
34ff543672
@ -91,18 +91,12 @@ void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level,
|
||||
}
|
||||
}
|
||||
|
||||
static const AVClass flv_class = {
|
||||
.class_name = "flv encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_flv_encoder = {
|
||||
.name = "flv",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_FLV1,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
@ -110,5 +104,4 @@ const AVCodec ff_flv_encoder = {
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_NONE},
|
||||
.priv_class = &flv_class,
|
||||
};
|
||||
|
@ -385,18 +385,12 @@ av_cold void ff_h261_encode_init(MpegEncContext *s)
|
||||
ff_thread_once(&init_static_once, h261_encode_init_static);
|
||||
}
|
||||
|
||||
static const AVClass h261_class = {
|
||||
.class_name = "h261 encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_h261_encoder = {
|
||||
.name = "h261",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("H.261"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_H261,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(H261Context),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
@ -404,5 +398,4 @@ const AVCodec ff_h261_encoder = {
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
|
||||
AV_PIX_FMT_NONE },
|
||||
.priv_class = &h261_class,
|
||||
};
|
||||
|
@ -680,7 +680,7 @@ FF_MPV_OPT_CMP_FUNC, \
|
||||
{ "brd_scale", "Deprecated, does nothing", FF_MPV_OFFSET(brd_scale), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 3, FF_MPV_OPT_FLAGS | AV_OPT_FLAG_DEPRECATED },
|
||||
#endif
|
||||
|
||||
extern const AVOption ff_mpv_generic_options[];
|
||||
extern const AVClass ff_mpv_enc_class;
|
||||
|
||||
/**
|
||||
* Set the given MpegEncContext to common defaults (same for encoding
|
||||
|
@ -85,7 +85,7 @@ static int dct_quantize_trellis_c(MpegEncContext *s, int16_t *block, int n, int
|
||||
static uint8_t default_mv_penalty[MAX_FCODE + 1][MAX_DMV * 2 + 1];
|
||||
static uint8_t default_fcode_tab[MAX_MV * 2 + 1];
|
||||
|
||||
const AVOption ff_mpv_generic_options[] = {
|
||||
static const AVOption mpv_generic_options[] = {
|
||||
FF_MPV_COMMON_OPTS
|
||||
#if FF_API_MPEGVIDEO_OPTS
|
||||
FF_MPV_DEPRECATED_MPEG_QUANT_OPT
|
||||
@ -96,6 +96,13 @@ const AVOption ff_mpv_generic_options[] = {
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
const AVClass ff_mpv_enc_class = {
|
||||
.class_name = "generic mpegvideo encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
void ff_convert_matrix(MpegEncContext *s, int (*qmat)[64],
|
||||
uint16_t (*qmat16)[2][64],
|
||||
const uint16_t *quant_matrix,
|
||||
@ -4648,32 +4655,18 @@ const AVCodec ff_h263p_encoder = {
|
||||
.priv_class = &h263p_class,
|
||||
};
|
||||
|
||||
static const AVClass msmpeg4v2_class = {
|
||||
.class_name = "msmpeg4v2 encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_msmpeg4v2_encoder = {
|
||||
.name = "msmpeg4v2",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_MSMPEG4V2,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
.close = ff_mpv_encode_end,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
|
||||
.priv_class = &msmpeg4v2_class,
|
||||
};
|
||||
|
||||
static const AVClass msmpeg4v3_class = {
|
||||
.class_name = "msmpeg4v3 encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_msmpeg4v3_encoder = {
|
||||
@ -4681,20 +4674,13 @@ const AVCodec ff_msmpeg4v3_encoder = {
|
||||
.long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_MSMPEG4V3,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
.close = ff_mpv_encode_end,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
|
||||
.priv_class = &msmpeg4v3_class,
|
||||
};
|
||||
|
||||
static const AVClass wmv1_class = {
|
||||
.class_name = "wmv1 encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_wmv1_encoder = {
|
||||
@ -4702,11 +4688,11 @@ const AVCodec ff_wmv1_encoder = {
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_WMV1,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
.close = ff_mpv_encode_end,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
|
||||
.priv_class = &wmv1_class,
|
||||
};
|
||||
|
@ -63,23 +63,16 @@ int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const AVClass rv10_class = {
|
||||
.class_name = "rv10 encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_rv10_encoder = {
|
||||
.name = "rv10",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_RV10,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
.close = ff_mpv_encode_end,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
|
||||
.priv_class = &rv10_class,
|
||||
};
|
||||
|
@ -60,23 +60,16 @@ void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number){
|
||||
}
|
||||
}
|
||||
|
||||
static const AVClass rv20_class = {
|
||||
.class_name = "rv20 encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_rv20_encoder = {
|
||||
.name = "rv20",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_RV20,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
.close = ff_mpv_encode_end,
|
||||
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
|
||||
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
|
||||
.priv_class = &rv20_class,
|
||||
};
|
||||
|
@ -265,18 +265,12 @@ int ff_speedhq_mb_y_order_to_mb(int mb_y_order, int mb_height, int *first_in_sli
|
||||
}
|
||||
|
||||
#if CONFIG_SPEEDHQ_ENCODER
|
||||
static const AVClass speedhq_class = {
|
||||
.class_name = "speedhq encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_speedhq_encoder = {
|
||||
.name = "speedhq",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("NewTek SpeedHQ"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_SPEEDHQ,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(MpegEncContext),
|
||||
.init = ff_mpv_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
@ -286,6 +280,5 @@ const AVCodec ff_speedhq_encoder = {
|
||||
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
|
||||
AV_PIX_FMT_NONE
|
||||
},
|
||||
.priv_class = &speedhq_class,
|
||||
};
|
||||
#endif
|
||||
|
@ -214,20 +214,13 @@ void ff_wmv2_encode_mb(MpegEncContext *s, int16_t block[6][64],
|
||||
s->p_tex_bits += get_bits_diff(s);
|
||||
}
|
||||
|
||||
static const AVClass wmv2_class = {
|
||||
.class_name = "wmv2 encoder",
|
||||
.item_name = av_default_item_name,
|
||||
.option = ff_mpv_generic_options,
|
||||
.version = LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
const AVCodec ff_wmv2_encoder = {
|
||||
.name = "wmv2",
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
|
||||
.type = AVMEDIA_TYPE_VIDEO,
|
||||
.id = AV_CODEC_ID_WMV2,
|
||||
.priv_class = &ff_mpv_enc_class,
|
||||
.priv_data_size = sizeof(Wmv2Context),
|
||||
.priv_class = &wmv2_class,
|
||||
.init = wmv2_encode_init,
|
||||
.encode2 = ff_mpv_encode_picture,
|
||||
.close = ff_mpv_encode_end,
|
||||
|
Loading…
x
Reference in New Issue
Block a user