[FFmpeg-devel] [PATCH] lavfi: use designated initializers for AVClass

Paul B Mahol onemda at gmail.com
Sat Jun 16 17:12:48 CEST 2012


While here:
    - add missing .version and .category,
    - make .class_name consistent across filters,
    - align declarations.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavfilter/af_aformat.c       |    4 ++--
 libavfilter/af_amerge.c        |    4 +++-
 libavfilter/af_amix.c          |    3 ++-
 libavfilter/af_asetnsamples.c  |    8 +++++---
 libavfilter/af_asyncts.c       |    3 ++-
 libavfilter/af_channelsplit.c  |    3 ++-
 libavfilter/af_silencedetect.c |    4 +++-
 libavfilter/asrc_aevalsrc.c    |    8 +++++---
 libavfilter/asrc_anullsrc.c    |    8 +++++---
 libavfilter/avfilter.c         |    2 +-
 libavfilter/avfiltergraph.c    |    1 +
 libavfilter/src_movie.c        |    8 +++++---
 libavfilter/vf_ass.c           |    8 +++++---
 libavfilter/vf_blackdetect.c   |    4 +++-
 libavfilter/vf_delogo.c        |    4 +++-
 libavfilter/vf_drawtext.c      |    8 +++++---
 libavfilter/vf_fade.c          |    8 +++++---
 libavfilter/vf_fps.c           |    3 ++-
 libavfilter/vf_lut.c           |    8 +++++---
 libavfilter/vf_overlay.c       |    8 +++++---
 libavfilter/vsrc_cellauto.c    |    8 +++++---
 libavfilter/vsrc_life.c        |    8 +++++---
 libavfilter/vsrc_mandelbrot.c  |    8 +++++---
 libavfilter/vsrc_mptestsrc.c   |    8 +++++---
 libavfilter/vsrc_testsrc.c     |   12 +++++++++---
 25 files changed, 98 insertions(+), 53 deletions(-)

diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index cdd5d12..afe613b 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -54,11 +54,11 @@ static const AVOption options[] = {
 };
 
 static const AVClass aformat_class = {
-    .class_name = "aformat filter",
+    .class_name = "aformat",
     .item_name  = av_default_item_name,
     .option     = options,
     .version    = LIBAVUTIL_VERSION_INT,
-    .category = AV_CLASS_CATEGORY_FILTER,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 #define PARSE_FORMATS(str, type, list, add_to_list, get_fmt, none, desc)    \
diff --git a/libavfilter/af_amerge.c b/libavfilter/af_amerge.c
index a8942a1..5b41634 100644
--- a/libavfilter/af_amerge.c
+++ b/libavfilter/af_amerge.c
@@ -53,9 +53,11 @@ static const AVOption amerge_options[] = {
 };
 
 static const AVClass amerge_class = {
-    .class_name = "AMergeContext",
+    .class_name = "amerge",
     .item_name  = av_default_item_name,
     .option     = amerge_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static av_cold void uninit(AVFilterContext *ctx)
diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index 003a8e8..81586981 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -185,10 +185,11 @@ static const AVOption options[] = {
 };
 
 static const AVClass amix_class = {
-    .class_name = "amix filter",
+    .class_name = "amix",
     .item_name  = av_default_item_name,
     .option     = options,
     .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 
diff --git a/libavfilter/af_asetnsamples.c b/libavfilter/af_asetnsamples.c
index eb3c6a9..73ed534 100644
--- a/libavfilter/af_asetnsamples.c
+++ b/libavfilter/af_asetnsamples.c
@@ -51,9 +51,11 @@ static const AVOption asns_options[] = {
 };
 
 static const AVClass asns_class = {
-    "asetnsamples",
-    av_default_item_name,
-    asns_options
+    .class_name = "asetnsamples",
+    .item_name  = av_default_item_name,
+    .option     = asns_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c
index 252b322..6322b24 100644
--- a/libavfilter/af_asyncts.c
+++ b/libavfilter/af_asyncts.c
@@ -50,10 +50,11 @@ static const AVOption options[] = {
 };
 
 static const AVClass async_class = {
-    .class_name = "asyncts filter",
+    .class_name = "asyncts",
     .item_name  = av_default_item_name,
     .option     = options,
     .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
index c9b31fa..02e52ba 100644
--- a/libavfilter/af_channelsplit.c
+++ b/libavfilter/af_channelsplit.c
@@ -46,10 +46,11 @@ static const AVOption options[] = {
 };
 
 static const AVClass channelsplit_class = {
-    .class_name = "channelsplit filter",
+    .class_name = "channelsplit",
     .item_name  = av_default_item_name,
     .option     = options,
     .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static int init(AVFilterContext *ctx, const char *arg, void *opaque)
diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c
index 27191cd..dab9763 100644
--- a/libavfilter/af_silencedetect.c
+++ b/libavfilter/af_silencedetect.c
@@ -49,9 +49,11 @@ static const AVOption silencedetect_options[] = {
 };
 
 static const AVClass silencedetect_class = {
-    .class_name = "SilenceDetectContext",
+    .class_name = "silencedetect",
     .item_name  = av_default_item_name,
     .option     = silencedetect_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 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 59e5503..1570489 100644
--- a/libavfilter/asrc_aevalsrc.c
+++ b/libavfilter/asrc_aevalsrc.c
@@ -79,9 +79,11 @@ static const AVOption eval_options[]= {
 };
 
 static const AVClass eval_class = {
-    "AEvalSrcContext",
-    av_default_item_name,
-    eval_options
+    .class_name = "aevalsrc",
+    .item_name  = av_default_item_name,
+    .option     = eval_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
diff --git a/libavfilter/asrc_anullsrc.c b/libavfilter/asrc_anullsrc.c
index 473c6b6..69f7a62 100644
--- a/libavfilter/asrc_anullsrc.c
+++ b/libavfilter/asrc_anullsrc.c
@@ -55,9 +55,11 @@ static const AVOption anullsrc_options[]= {
 };
 
 static const AVClass anullsrc_class = {
-    "ANullSrcContext",
-    av_default_item_name,
-    anullsrc_options
+    .class_name = "anullsrc",
+    .item_name  = av_default_item_name,
+    .option     = anullsrc_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 6c2aaa3..7a395c2 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -426,7 +426,7 @@ static const AVClass avfilter_class = {
     .class_name = "AVFilter",
     .item_name  = default_filter_name,
     .version    = LIBAVUTIL_VERSION_INT,
-    .category = AV_CLASS_CATEGORY_FILTER,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name)
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 0f363b2..027d8a0 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -38,6 +38,7 @@ static const AVClass filtergraph_class = {
     .class_name = "AVFilterGraph",
     .item_name  = av_default_item_name,
     .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 AVFilterGraph *avfilter_graph_alloc(void)
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index eea2db3..51d398c 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -81,9 +81,11 @@ static const AVOption movie_options[]= {
 };
 
 static const AVClass movie_class = {
-    "MovieContext",
-    av_default_item_name,
-    movie_options
+    .class_name = "movie",
+    .item_name  = av_default_item_name,
+    .option     = movie_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, void *opaque,
diff --git a/libavfilter/vf_ass.c b/libavfilter/vf_ass.c
index d0e2049..69f4ed3 100644
--- a/libavfilter/vf_ass.c
+++ b/libavfilter/vf_ass.c
@@ -55,9 +55,11 @@ static const AVOption ass_options[] = {
 };
 
 static const AVClass ass_class = {
-    "AssContext",
-    av_default_item_name,
-    ass_options
+    .class_name = "ass",
+    .item_name  = av_default_item_name,
+    .option     = ass_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 /* libass supports a log level ranging from 0 to 7 */
diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c
index a53927b..a6673b5 100644
--- a/libavfilter/vf_blackdetect.c
+++ b/libavfilter/vf_blackdetect.c
@@ -58,9 +58,11 @@ static const AVOption blackdetect_options[] = {
 };
 
 static const AVClass blackdetect_class = {
-    .class_name = "BlackDetectContext",
+    .class_name = "blackdetect",
     .item_name  = av_default_item_name,
     .option     = blackdetect_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 #define YUVJ_FORMATS \
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index f52b896..d514178 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -152,9 +152,11 @@ static const AVOption delogo_options[]= {
 };
 
 static const AVClass delogo_class = {
-    .class_name = "DelogoContext",
+    .class_name = "delogo",
     .item_name  = av_default_item_name,
     .option     = delogo_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static int query_formats(AVFilterContext *ctx)
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 1754b2a..484916f 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -208,9 +208,11 @@ static const AVOption drawtext_options[]= {
 };
 
 static const AVClass drawtext_class = {
-    "DrawTextContext",
-    av_default_item_name,
-    drawtext_options
+    .class_name = "drawtext",
+    .item_name  = av_default_item_name,
+    .option     = drawtext_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 #undef __FTERRORS_H__
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index ed27a53..c73e99f 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -72,9 +72,11 @@ static const AVOption fade_options[] = {
 };
 
 static const AVClass fade_class = {
-    "FadeContext",
-    av_default_item_name,
-    fade_options
+    .class_name = "fade",
+    .item_name  = av_default_item_name,
+    .option     = fade_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 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 3fae82b..5f41f4b 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -61,10 +61,11 @@ static const AVOption options[] = {
 };
 
 static const AVClass class = {
-    .class_name = "FPS filter",
+    .class_name = "fps",
     .item_name  = av_default_item_name,
     .option     = options,
     .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index 9c8b412..fd6cd68 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -92,9 +92,11 @@ static const AVOption lut_options[] = {
 };
 
 static const AVClass lut_class = {
-    "LutContext",
-    av_default_item_name,
-    lut_options
+    .class_name = "lut",
+    .item_name  = av_default_item_name,
+    .option     = lut_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static int init(AVFilterContext *ctx, const char *args, void *opaque)
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 2c2275e..5055f8b 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -104,9 +104,11 @@ static const AVOption overlay_options[] = {
 };
 
 static const AVClass overlay_class = {
-    "OverlayContext",
-    av_default_item_name,
-    overlay_options
+    .class_name = "overlay",
+    .item_name  = av_default_item_name,
+    .option     = overlay_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 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 1f6ba6a..48ab17e 100644
--- a/libavfilter/vsrc_cellauto.c
+++ b/libavfilter/vsrc_cellauto.c
@@ -77,9 +77,11 @@ static const AVOption cellauto_options[] = {
 };
 
 static const AVClass cellauto_class = {
-    "CellAutoContext",
-    av_default_item_name,
-    cellauto_options
+    .class_name = "cellauto",
+    .item_name  = av_default_item_name,
+    .option     = cellauto_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 #ifdef DEBUG
diff --git a/libavfilter/vsrc_life.c b/libavfilter/vsrc_life.c
index 4846f5d..0e04b56 100644
--- a/libavfilter/vsrc_life.c
+++ b/libavfilter/vsrc_life.c
@@ -96,9 +96,11 @@ static const AVOption life_options[] = {
 };
 
 static const AVClass life_class = {
-    "LifeContext",
-    av_default_item_name,
-    life_options
+    .class_name = "life",
+    .item_name  = av_default_item_name,
+    .option     = life_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static int parse_rule(uint16_t *born_rule, uint16_t *stay_rule,
diff --git a/libavfilter/vsrc_mandelbrot.c b/libavfilter/vsrc_mandelbrot.c
index 2ecb03d..98d4adb 100644
--- a/libavfilter/vsrc_mandelbrot.c
+++ b/libavfilter/vsrc_mandelbrot.c
@@ -104,9 +104,11 @@ static const AVOption mandelbrot_options[] = {
 };
 
 static const AVClass mandelbrot_class = {
-    "MBContext",
-    av_default_item_name,
-    mandelbrot_options
+    .class_name = "mandelbrot",
+    .item_name  = av_default_item_name,
+    .option     = mandelbrot_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 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 98c7988..8744181 100644
--- a/libavfilter/vsrc_mptestsrc.c
+++ b/libavfilter/vsrc_mptestsrc.c
@@ -83,9 +83,11 @@ static const AVOption mptestsrc_options[]= {
 };
 
 static const AVClass mptestsrc_class = {
-    "MPTestContext",
-    av_default_item_name,
-    mptestsrc_options
+    .class_name = "mptestsrc",
+    .item_name  = av_default_item_name,
+    .option     = mptestsrc_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static double c[64];
diff --git a/libavfilter/vsrc_testsrc.c b/libavfilter/vsrc_testsrc.c
index 8334f3d..4b0e4b1 100644
--- a/libavfilter/vsrc_testsrc.c
+++ b/libavfilter/vsrc_testsrc.c
@@ -159,9 +159,11 @@ static int request_frame(AVFilterLink *outlink)
 #if CONFIG_NULLSRC_FILTER
 
 static const AVClass nullsrc_class = {
-    .class_name = "NullSourceContext",
+    .class_name = "nullsrc",
     .item_name  = av_default_item_name,
     .option     = testsrc_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 static void nullsrc_fill_picture(AVFilterContext *ctx, AVFilterBufferRef *picref) { }
@@ -194,9 +196,11 @@ AVFilter avfilter_vsrc_nullsrc = {
 #if CONFIG_TESTSRC_FILTER
 
 static const AVClass testsrc_class = {
-    .class_name = "TestSourceContext",
+    .class_name = "testsrc",
     .item_name  = av_default_item_name,
     .option     = testsrc_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 /**
@@ -416,9 +420,11 @@ AVFilter avfilter_vsrc_testsrc = {
 #if CONFIG_RGBTESTSRC_FILTER
 
 static const AVClass rgbtestsrc_class = {
-    .class_name = "RGBTestSourceContext",
+    .class_name = "rgbtestsrc",
     .item_name  = av_default_item_name,
     .option     = testsrc_options,
+    .version    = LIBAVUTIL_VERSION_INT,
+    .category   = AV_CLASS_CATEGORY_FILTER,
 };
 
 #define R 0
-- 
1.7.7



More information about the ffmpeg-devel mailing list