From f1fa1eed2abdc8dfb0af318a43f5d293b81141bd Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Wed, 10 Jun 2015 14:29:07 +0100 Subject: [PATCH] mpegvideo: Expand macro Having this macro in an header only facilitates the use of such header. The code increase is minimal and files have one less dependency on mpegvideo.h. --- libavcodec/flvenc.c | 7 ++++++- libavcodec/h261enc.c | 7 ++++++- libavcodec/mpegvideo.h | 8 -------- libavcodec/mpegvideo_enc.c | 21 ++++++++++++++++++--- libavcodec/rv10enc.c | 7 ++++++- libavcodec/rv20enc.c | 7 ++++++- 6 files changed, 42 insertions(+), 15 deletions(-) diff --git a/libavcodec/flvenc.c b/libavcodec/flvenc.c index 994ea07604..ab89b25203 100644 --- a/libavcodec/flvenc.c +++ b/libavcodec/flvenc.c @@ -91,7 +91,12 @@ void ff_flv2_encode_ac_esc(PutBitContext *pb, int slevel, int level, } } -FF_MPV_GENERIC_CLASS(flv) +static const AVClass flv_class = { + .class_name = "flv encoder", + .item_name = av_default_item_name, + .option = ff_mpv_generic_options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_flv_encoder = { .name = "flv", diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c index ae61fc24c4..db81f832a7 100644 --- a/libavcodec/h261enc.c +++ b/libavcodec/h261enc.c @@ -324,7 +324,12 @@ av_cold void ff_h261_encode_init(MpegEncContext *s) s->c_dc_scale_table = ff_mpeg1_dc_scale_table; } -FF_MPV_GENERIC_CLASS(h261) +static const AVClass h261_class = { + .class_name = "h261 encoder", + .item_name = av_default_item_name, + .option = ff_mpv_generic_options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_h261_encoder = { .name = "h261", diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 372c6cfc20..f5bb58fe94 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -574,14 +574,6 @@ typedef struct MpegEncContext { extern const AVOption ff_mpv_generic_options[]; -#define FF_MPV_GENERIC_CLASS(name) \ -static const AVClass name ## _class = {\ - .class_name = #name " encoder",\ - .item_name = av_default_item_name,\ - .option = ff_mpv_generic_options,\ - .version = LIBAVUTIL_VERSION_INT,\ -}; - /** * Set the given MpegEncContext to common defaults (same for encoding * and decoding). The changed fields will not depend upon the prior diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index db392afcca..7975dd2277 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -4374,7 +4374,12 @@ AVCodec ff_h263p_encoder = { .priv_class = &h263p_class, }; -FF_MPV_GENERIC_CLASS(msmpeg4v2) +static const AVClass msmpeg4v2_class = { + .class_name = "msmpeg4v2 encoder", + .item_name = av_default_item_name, + .option = ff_mpv_generic_options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_msmpeg4v2_encoder = { .name = "msmpeg4v2", @@ -4389,7 +4394,12 @@ AVCodec ff_msmpeg4v2_encoder = { .priv_class = &msmpeg4v2_class, }; -FF_MPV_GENERIC_CLASS(msmpeg4v3) +static const AVClass msmpeg4v3_class = { + .class_name = "msmpeg4v3 encoder", + .item_name = av_default_item_name, + .option = ff_mpv_generic_options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_msmpeg4v3_encoder = { .name = "msmpeg4", @@ -4404,7 +4414,12 @@ AVCodec ff_msmpeg4v3_encoder = { .priv_class = &msmpeg4v3_class, }; -FF_MPV_GENERIC_CLASS(wmv1) +static const AVClass wmv1_class = { + .class_name = "wmv1 encoder", + .item_name = av_default_item_name, + .option = ff_mpv_generic_options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_wmv1_encoder = { .name = "wmv1", diff --git a/libavcodec/rv10enc.c b/libavcodec/rv10enc.c index 98cd06e3ee..9f4f7380c3 100644 --- a/libavcodec/rv10enc.c +++ b/libavcodec/rv10enc.c @@ -63,7 +63,12 @@ int ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number) return 0; } -FF_MPV_GENERIC_CLASS(rv10) +static const AVClass rv10_class = { + .class_name = "rv10 encoder", + .item_name = av_default_item_name, + .option = ff_mpv_generic_options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_rv10_encoder = { .name = "rv10", diff --git a/libavcodec/rv20enc.c b/libavcodec/rv20enc.c index 61e8a9d4c9..20090b14ef 100644 --- a/libavcodec/rv20enc.c +++ b/libavcodec/rv20enc.c @@ -60,7 +60,12 @@ void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number){ } } -FF_MPV_GENERIC_CLASS(rv20) +static const AVClass rv20_class = { + .class_name = "rv20 encoder", + .item_name = av_default_item_name, + .option = ff_mpv_generic_options, + .version = LIBAVUTIL_VERSION_INT, +}; AVCodec ff_rv20_encoder = { .name = "rv20",