[FFmpeg-cvslog] lavfi: define macro AVFILTER_DEFINE_CLASS

Stefano Sabatini git at videolan.org
Fri Jun 22 23:19:40 CEST 2012


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Fri Jun 22 14:33:09 2012 +0200| [c17808cebd2b9cf734dfa7f652ed49a3b3289386] | committer: Stefano Sabatini

lavfi: define macro AVFILTER_DEFINE_CLASS

The macro can be used to define consistently the internal class of a
filter, save some typing and factorize.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c17808cebd2b9cf734dfa7f652ed49a3b3289386
---

 libavfilter/af_aformat.c       |   10 ++--------
 libavfilter/af_amerge.c        |    8 +-------
 libavfilter/af_amix.c          |   11 ++---------
 libavfilter/af_asetnsamples.c  |   13 ++++---------
 libavfilter/af_asyncts.c       |   12 +++---------
 libavfilter/af_channelsplit.c  |   10 ++--------
 libavfilter/af_silencedetect.c |    9 ++-------
 libavfilter/asrc_aevalsrc.c    |   12 +++---------
 libavfilter/asrc_anullsrc.c    |    8 +-------
 libavfilter/avf_showwaves.c    |    9 ++-------
 libavfilter/buffersrc.c        |   22 +++++-----------------
 libavfilter/internal.h         |    9 +++++++++
 libavfilter/src_movie.c        |    8 +-------
 libavfilter/vf_ass.c           |    9 ++-------
 libavfilter/vf_blackdetect.c   |    8 +-------
 libavfilter/vf_delogo.c        |    8 +-------
 libavfilter/vf_drawtext.c      |    8 +-------
 libavfilter/vf_fade.c          |    8 +-------
 libavfilter/vf_fps.c           |   12 +++---------
 libavfilter/vf_lut.c           |    8 +-------
 libavfilter/vf_overlay.c       |    8 +-------
 libavfilter/vsrc_cellauto.c    |    9 ++-------
 libavfilter/vsrc_color.c       |    8 +-------
 libavfilter/vsrc_life.c        |    9 ++-------
 libavfilter/vsrc_mandelbrot.c  |    9 ++-------
 libavfilter/vsrc_mptestsrc.c   |    9 ++-------
 libavfilter/vsrc_testsrc.c     |    8 +-------
 27 files changed, 58 insertions(+), 204 deletions(-)

diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index afe613b..68a38f2 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -46,20 +46,14 @@ typedef struct AFormatContext {
 
 #define OFFSET(x) offsetof(AFormatContext, x)
 #define A AV_OPT_FLAG_AUDIO_PARAM
-static const AVOption options[] = {
+static const AVOption aformat_options[] = {
     { "sample_fmts",     "A comma-separated list of sample formats.",  OFFSET(formats_str),         AV_OPT_TYPE_STRING, .flags = A },
     { "sample_rates",    "A comma-separated list of sample rates.",    OFFSET(sample_rates_str),    AV_OPT_TYPE_STRING, .flags = A },
     { "channel_layouts", "A comma-separated list of channel layouts.", OFFSET(channel_layouts_str), AV_OPT_TYPE_STRING, .flags = A },
     { NULL },
 };
 
-static const AVClass aformat_class = {
-    .class_name = "aformat",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(aformat);
 
 #define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc)    \
 do {                                                                        \
diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index bd0437d..e71c55f 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -52,13 +52,7 @@ static const AVOption amerge_options[] = {
     {0}
 };
 
-static const AVClass amerge_class = {
-    .class_name = "amerge",
-    .item_name  = av_default_item_name,
-    .option     = amerge_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(amerge);
 
 static av_cold void uninit(AVFilterContext *ctx)
 {
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index dcfa5e4..2fc5d0e 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -173,7 +173,7 @@ typedef struct MixContext {
 
 #define OFFSET(x) offsetof(MixContext, x)
 #define A AV_OPT_FLAG_AUDIO_PARAM
-static const AVOption options[] = {
+static const AVOption amix_options[] = {
     { "inputs", "Number of inputs.",
             OFFSET(nb_inputs), AV_OPT_TYPE_INT, { 2 }, 1, 32, A },
     { "duration", "How to determine the end-of-stream.",
@@ -187,14 +187,7 @@ static const AVOption options[] = {
     { NULL },
 };
 
-static const AVClass amix_class = {
-    .class_name = "amix",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
-
+AVFILTER_DEFINE_CLASS(amix);
 
 /**
  * Update the scaling factors to apply to each input during mixing.
diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c
index 73ed534..b373fc2 100644
--- a/libavfilter/af_asetnsamples.c
+++ b/libavfilter/af_asetnsamples.c
@@ -29,6 +29,7 @@
 #include "libavutil/opt.h"
 #include "avfilter.h"
 #include "audio.h"
+#include "internal.h"
 #include "formats.h"
 
 typedef struct {
@@ -42,7 +43,7 @@ typedef struct {
 
 #define OFFSET(x) offsetof(ASNSContext, x)
 
-static const AVOption asns_options[] = {
+static const AVOption asetnsamples_options[] = {
 { "pad", "pad last frame with zeros", OFFSET(pad), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 },
 { "p",   "pad last frame with zeros", OFFSET(pad), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 },
 { "nb_out_samples", "set the number of per-frame output samples", OFFSET(nb_out_samples), AV_OPT_TYPE_INT, {.dbl=1024}, 1, INT_MAX },
@@ -50,20 +51,14 @@ static const AVOption asns_options[] = {
 { NULL }
 };
 
-static const AVClass asns_class = {
-    .class_name = "asetnsamples",
-    .item_name  = av_default_item_name,
-    .option     = asns_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(asetnsamples);
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     ASNSContext *asns = ctx->priv;
     int err;
 
-    asns->class = &asns_class;
+    asns->class = &asetnsamples_class;
     av_opt_set_defaults(asns);
 
     if ((err = av_set_options_string(asns, args, "=", ":")) < 0) {
diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index 6322b24..efe56d0 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -41,7 +41,7 @@ typedef struct ASyncContext {
 
 #define OFFSET(x) offsetof(ASyncContext, x)
 #define A AV_OPT_FLAG_AUDIO_PARAM
-static const AVOption options[] = {
+static const AVOption asyncts_options[] = {
     { "compensate", "Stretch/squeeze the data to make it match the timestamps", OFFSET(resample),      AV_OPT_TYPE_INT,   { 0 },   0, 1,       A },
     { "min_delta",  "Minimum difference between timestamps and audio data "
                     "(in seconds) to trigger padding/trimmin the data.",        OFFSET(min_delta_sec), AV_OPT_TYPE_FLOAT, { 0.1 }, 0, INT_MAX, A },
@@ -49,20 +49,14 @@ static const AVOption options[] = {
     { NULL },
 };
 
-static const AVClass async_class = {
-    .class_name = "asyncts",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(asyncts);
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     ASyncContext *s = ctx->priv;
     int ret;
 
-    s->class = &async_class;
+    s->class = &asyncts_class;
     av_opt_set_defaults(s);
 
     if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
index 02e52ba..1e2d011 100644
--- a/libavfilter/af_channelsplit.c
+++ b/libavfilter/af_channelsplit.c
@@ -40,18 +40,12 @@ typedef struct ChannelSplitContext {
 
 #define OFFSET(x) offsetof(ChannelSplitContext, x)
 #define A AV_OPT_FLAG_AUDIO_PARAM
-static const AVOption options[] = {
+static const AVOption channelsplit_options[] = {
     { "channel_layout", "Input channel layout.", OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, { .str = "stereo" }, .flags = A },
     { NULL },
 };
 
-static const AVClass channelsplit_class = {
-    .class_name = "channelsplit",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(channelsplit);
 
 static int init(AVFilterContext *ctx, const char *arg, void *opaque)
 {
diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c
index 83aa400..e8bf41b 100644
--- a/libavfilter/af_silencedetect.c
+++ b/libavfilter/af_silencedetect.c
@@ -28,6 +28,7 @@
 #include "audio.h"
 #include "formats.h"
 #include "avfilter.h"
+#include "internal.h"
 
 typedef struct {
     const AVClass *class;
@@ -48,13 +49,7 @@ static const AVOption silencedetect_options[] = {
     { NULL },
 };
 
-static const AVClass silencedetect_class = {
-    .class_name = "silencedetect",
-    .item_name  = av_default_item_name,
-    .option     = silencedetect_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(silencedetect);
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/asrc_aevalsrc.c b/libavfilter/asrc_aevalsrc.c
index 2abd2ea..ec58ab3 100644
--- a/libavfilter/asrc_aevalsrc.c
+++ b/libavfilter/asrc_aevalsrc.c
@@ -66,7 +66,7 @@ typedef struct {
 
 #define OFFSET(x) offsetof(EvalContext, x)
 
-static const AVOption eval_options[]= {
+static const AVOption aevalsrc_options[]= {
     { "nb_samples",  "set the number of samples per requested frame", OFFSET(nb_samples),      AV_OPT_TYPE_INT,    {.dbl = 1024},    0,        INT_MAX },
     { "n",           "set the number of samples per requested frame", OFFSET(nb_samples),      AV_OPT_TYPE_INT,    {.dbl = 1024},    0,        INT_MAX },
     { "sample_rate", "set the sample rate",                           OFFSET(sample_rate_str), AV_OPT_TYPE_STRING, {.str = "44100"}, CHAR_MIN, CHAR_MAX },
@@ -78,13 +78,7 @@ static const AVOption eval_options[]= {
 {NULL},
 };
 
-static const AVClass eval_class = {
-    .class_name = "aevalsrc",
-    .item_name  = av_default_item_name,
-    .option     = eval_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(aevalsrc);
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
@@ -93,7 +87,7 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
     char *expr, *buf, *bufptr;
     int ret, i;
 
-    eval->class = &eval_class;
+    eval->class = &aevalsrc_class;
     av_opt_set_defaults(eval);
 
     /* parse expressions */
diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c
index 69f7a62..feffb96 100644
--- a/libavfilter/asrc_anullsrc.c
+++ b/libavfilter/asrc_anullsrc.c
@@ -54,13 +54,7 @@ static const AVOption anullsrc_options[]= {
     { NULL },
 };
 
-static const AVClass anullsrc_class = {
-    .class_name = "anullsrc",
-    .item_name  = av_default_item_name,
-    .option     = anullsrc_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(anullsrc);
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 319f832..645065f 100644
--- a/libavfilter/avf_showwaves.c
+++ b/libavfilter/avf_showwaves.c
@@ -30,6 +30,7 @@
 #include "formats.h"
 #include "audio.h"
 #include "video.h"
+#include "internal.h"
 
 typedef struct {
     const AVClass *class;
@@ -54,13 +55,7 @@ static const AVOption showwaves_options[] = {
     { NULL },
 };
 
-static const AVClass showwaves_class = {
-    .class_name = "showwaves",
-    .item_name  = av_default_item_name,
-    .option     = showwaves_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(showwaves);
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index b50a5e1..4debd5f 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -219,7 +219,7 @@ unsigned av_buffersrc_get_nb_failed_requests(AVFilterContext *buffer_src)
 
 #define OFFSET(x) offsetof(BufferSourceContext, x)
 #define V AV_OPT_FLAG_VIDEO_PARAM
-static const AVOption video_options[] = {
+static const AVOption buffer_options[] = {
     { "time_base",      NULL, OFFSET(time_base),           AV_OPT_TYPE_RATIONAL,   { 0 }, 0, INT_MAX, V },
     { "frame_rate",     NULL, OFFSET(frame_rate),          AV_OPT_TYPE_RATIONAL,   { 0 }, 0, INT_MAX, V },
     { "video_size",     NULL, OFFSET(w),                   AV_OPT_TYPE_IMAGE_SIZE,           .flags = V },
@@ -230,13 +230,7 @@ static const AVOption video_options[] = {
 };
 #undef V
 
-static const AVClass vbuffer_class = {
-    .class_name = "vbuffer source",
-    .item_name  = av_default_item_name,
-    .option     = video_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(buffer);
 
 static av_cold int init_video(AVFilterContext *ctx, const char *args, void *opaque)
 {
@@ -244,7 +238,7 @@ static av_cold int init_video(AVFilterContext *ctx, const char *args, void *opaq
     char pix_fmt_str[128], sws_param[256] = "", *colon, *equal;
     int ret, n = 0;
 
-    c->class = &vbuffer_class;
+    c->class = &buffer_class;
 
     if (!args) {
         av_log(ctx, AV_LOG_ERROR, "Arguments required\n");
@@ -295,7 +289,7 @@ fail:
 }
 
 #define A AV_OPT_FLAG_AUDIO_PARAM
-static const AVOption audio_options[] = {
+static const AVOption abuffer_options[] = {
     { "time_base",      NULL, OFFSET(time_base),           AV_OPT_TYPE_RATIONAL, { 0 }, 0, INT_MAX, A },
     { "sample_rate",    NULL, OFFSET(sample_rate),         AV_OPT_TYPE_INT,      { 0 }, 0, INT_MAX, A },
     { "sample_fmt",     NULL, OFFSET(sample_fmt_str),      AV_OPT_TYPE_STRING,             .flags = A },
@@ -303,13 +297,7 @@ static const AVOption audio_options[] = {
     { NULL },
 };
 
-static const AVClass abuffer_class = {
-    .class_name = "abuffer source",
-    .item_name  = av_default_item_name,
-    .option     = audio_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(abuffer);
 
 static av_cold int init_audio(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 7e5cc1a..9a95da1 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -326,4 +326,13 @@ int ff_poll_frame(AVFilterLink *link);
  */
 int ff_request_frame(AVFilterLink *link);
 
+#define AVFILTER_DEFINE_CLASS(fname)            \
+    static const AVClass fname##_class = {      \
+        .class_name = #fname,                   \
+        .item_name  = av_default_item_name,     \
+        .option     = fname##_options,          \
+        .version    = LIBAVUTIL_VERSION_INT,    \
+        .category   = AV_CLASS_CATEGORY_FILTER, \
+    }
+
 #endif /* AVFILTER_INTERNAL_H */
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index f793ad0..1b83ecb 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -80,13 +80,7 @@ static const AVOption movie_options[]= {
 {NULL},
 };
 
-static const AVClass movie_class = {
-    .class_name = "movie",
-    .item_name  = av_default_item_name,
-    .option     = movie_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(movie);
 
 static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, void *opaque,
                                      enum AVMediaType type)
diff --git a/libavfilter/vf_ass.c b/libavfilter/vf_ass.c
index 6386092..7c34c48 100644
--- a/libavfilter/vf_ass.c
+++ b/libavfilter/vf_ass.c
@@ -34,6 +34,7 @@
 #include "libavutil/parseutils.h"
 #include "drawutils.h"
 #include "avfilter.h"
+#include "internal.h"
 #include "formats.h"
 #include "video.h"
 
@@ -56,13 +57,7 @@ static const AVOption ass_options[] = {
     {NULL},
 };
 
-static const AVClass ass_class = {
-    .class_name = "ass",
-    .item_name  = av_default_item_name,
-    .option     = ass_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(ass);
 
 /* libass supports a log level ranging from 0 to 7 */
 int ass_libav_log_level_map[] = {
diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index 9968549..28020a4 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -58,13 +58,7 @@ static const AVOption blackdetect_options[] = {
     { NULL },
 };
 
-static const AVClass blackdetect_class = {
-    .class_name = "blackdetect",
-    .item_name  = av_default_item_name,
-    .option     = blackdetect_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(blackdetect);
 
 #define YUVJ_FORMATS \
     PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index d514178..78258ee 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -151,13 +151,7 @@ static const AVOption delogo_options[]= {
     {NULL},
 };
 
-static const AVClass delogo_class = {
-    .class_name = "delogo",
-    .item_name  = av_default_item_name,
-    .option     = delogo_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(delogo);
 
 static int query_formats(AVFilterContext *ctx)
 {
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index df23d96..dc2e871 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -207,13 +207,7 @@ static const AVOption drawtext_options[]= {
 {NULL},
 };
 
-static const AVClass drawtext_class = {
-    .class_name = "drawtext",
-    .item_name  = av_default_item_name,
-    .option     = drawtext_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(drawtext);
 
 #undef __FTERRORS_H__
 #define FT_ERROR_START_LIST {
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index c73e99f..e7e8c87 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -71,13 +71,7 @@ static const AVOption fade_options[] = {
     {NULL},
 };
 
-static const AVClass fade_class = {
-    .class_name = "fade",
-    .item_name  = av_default_item_name,
-    .option     = fade_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(fade);
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index 5f41f4b..93a107a 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -55,25 +55,19 @@ typedef struct FPSContext {
 
 #define OFFSET(x) offsetof(FPSContext, x)
 #define V AV_OPT_FLAG_VIDEO_PARAM
-static const AVOption options[] = {
+static const AVOption fps_options[] = {
     { "fps", "A string describing desired output framerate", OFFSET(fps), AV_OPT_TYPE_STRING, { .str = "25" }, .flags = V },
     { NULL },
 };
 
-static const AVClass class = {
-    .class_name = "fps",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(fps);
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
     FPSContext *s = ctx->priv;
     int ret;
 
-    s->class = &class;
+    s->class = &fps_class;
     av_opt_set_defaults(s);
 
     if ((ret = av_set_options_string(s, args, "=", ":")) < 0) {
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 1155578..47dd7f3 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -91,13 +91,7 @@ static const AVOption lut_options[] = {
     {NULL},
 };
 
-static const AVClass lut_class = {
-    .class_name = "lut",
-    .item_name  = av_default_item_name,
-    .option     = lut_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(lut);
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 5055f8b..dbf0fbc 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -103,13 +103,7 @@ static const AVOption overlay_options[] = {
     {NULL},
 };
 
-static const AVClass overlay_class = {
-    .class_name = "overlay",
-    .item_name  = av_default_item_name,
-    .option     = overlay_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(overlay);
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/vsrc_cellauto.c b/libavfilter/vsrc_cellauto.c
index 117a660..1fd43ee 100644
--- a/libavfilter/vsrc_cellauto.c
+++ b/libavfilter/vsrc_cellauto.c
@@ -31,6 +31,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/random_seed.h"
 #include "avfilter.h"
+#include "internal.h"
 #include "formats.h"
 #include "video.h"
 
@@ -78,13 +79,7 @@ static const AVOption cellauto_options[] = {
     { NULL },
 };
 
-static const AVClass cellauto_class = {
-    .class_name = "cellauto",
-    .item_name  = av_default_item_name,
-    .option     = cellauto_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(cellauto);
 
 #ifdef DEBUG
 static void show_cellauto_row(AVFilterContext *ctx)
diff --git a/libavfilter/vsrc_color.c b/libavfilter/vsrc_color.c
index ba10ebf..986b41b 100644
--- a/libavfilter/vsrc_color.c
+++ b/libavfilter/vsrc_color.c
@@ -59,13 +59,7 @@ static const AVOption color_options[]= {
     { NULL },
 };
 
-static const AVClass color_class = {
-    .class_name = "color",
-    .item_name  = av_default_item_name,
-    .option     = color_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(color);
 
 static av_cold int color_init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c
index 5b4dc99..dd35f2c 100644
--- a/libavfilter/vsrc_life.c
+++ b/libavfilter/vsrc_life.c
@@ -32,6 +32,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/random_seed.h"
 #include "avfilter.h"
+#include "internal.h"
 #include "formats.h"
 #include "video.h"
 
@@ -97,13 +98,7 @@ static const AVOption life_options[] = {
     { NULL },
 };
 
-static const AVClass life_class = {
-    .class_name = "life",
-    .item_name  = av_default_item_name,
-    .option     = life_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(life);
 
 static int parse_rule(uint16_t *born_rule, uint16_t *stay_rule,
                       const char *rule_str, void *log_ctx)
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 26b392d..7bf64d9 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -29,6 +29,7 @@
 #include "avfilter.h"
 #include "formats.h"
 #include "video.h"
+#include "internal.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
@@ -105,13 +106,7 @@ static const AVOption mandelbrot_options[] = {
     {NULL},
 };
 
-static const AVClass mandelbrot_class = {
-    .class_name = "mandelbrot",
-    .item_name  = av_default_item_name,
-    .option     = mandelbrot_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(mandelbrot);
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
 {
diff --git a/libavfilter/vsrc_mptestsrc.c b/libavfilter/vsrc_mptestsrc.c
index 485d44e..c0b9e43 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -28,6 +28,7 @@
 #include "libavutil/parseutils.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
+#include "internal.h"
 #include "formats.h"
 #include "video.h"
 
@@ -84,13 +85,7 @@ static const AVOption mptestsrc_options[]= {
     { NULL },
 };
 
-static const AVClass mptestsrc_class = {
-    .class_name = "mptestsrc",
-    .item_name  = av_default_item_name,
-    .option     = mptestsrc_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(mptestsrc);
 
 static double c[64];
 
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 08ed9be..6e706f0 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -194,13 +194,7 @@ AVFilter avfilter_vsrc_nullsrc = {
 
 #if CONFIG_TESTSRC_FILTER
 
-static const AVClass testsrc_class = {
-    .class_name = "testsrc",
-    .item_name  = av_default_item_name,
-    .option     = testsrc_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-    .category   = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(testsrc);
 
 /**
  * Fill a rectangle with value val.



More information about the ffmpeg-cvslog mailing list