[FFmpeg-devel] [PATCH] avfilter: use AVFILTER_DEFINE_CLASS()

Paul B Mahol onemda at gmail.com
Thu Jul 2 11:52:02 CEST 2015


Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavfilter/af_bs2b.c          |  9 ++-------
 libavfilter/vf_cover_rect.c    |  8 +-------
 libavfilter/vf_find_rect.c     | 12 +++---------
 libavfilter/vf_framepack.c     |  9 ++-------
 libavfilter/vf_shuffleplanes.c |  7 +------
 5 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/libavfilter/af_bs2b.c b/libavfilter/af_bs2b.c
index 592fdec..54d52c5 100644
--- a/libavfilter/af_bs2b.c
+++ b/libavfilter/af_bs2b.c
@@ -47,7 +47,7 @@ typedef struct Bs2bContext {
 #define OFFSET(x) offsetof(Bs2bContext, x)
 #define A AV_OPT_FLAG_AUDIO_PARAM
 
-static const AVOption options[] = {
+static const AVOption bs2b_options[] = {
     { "profile", "Apply a pre-defined crossfeed level",
             OFFSET(profile), AV_OPT_TYPE_INT, { .i64 = BS2B_DEFAULT_CLEVEL }, 0, INT_MAX, A, "profile" },
         { "default", "default profile", 0, AV_OPT_TYPE_CONST, { .i64 = BS2B_DEFAULT_CLEVEL }, 0, 0, A, "profile" },
@@ -60,12 +60,7 @@ static const AVOption options[] = {
     { NULL },
 };
 
-static const AVClass bs2b_class = {
-    .class_name = "bs2b filter",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-};
+AVFILTER_DEFINE_CLASS(bs2b);
 
 static av_cold int init(AVFilterContext *ctx)
 {
diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c
index c2020bb..5086a24 100644
--- a/libavfilter/vf_cover_rect.c
+++ b/libavfilter/vf_cover_rect.c
@@ -53,13 +53,7 @@ static const AVOption cover_rect_options[] = {
     { NULL }
 };
 
-static const AVClass cover_rect_class = {
-    .class_name       = "cover_rect",
-    .item_name        = av_default_item_name,
-    .option           = cover_rect_options,
-    .version          = LIBAVUTIL_VERSION_INT,
-    .category         = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(cover_rect);
 
 static int query_formats(AVFilterContext *ctx)
 {
diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c
index a4631de..cb79f4a 100644
--- a/libavfilter/vf_find_rect.c
+++ b/libavfilter/vf_find_rect.c
@@ -45,7 +45,7 @@ typedef struct FOCContext {
 
 #define OFFSET(x) offsetof(FOCContext, x)
 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
-static const AVOption foc_options[] = {
+static const AVOption find_rect_options[] = {
     { "object", "object bitmap filename", OFFSET(obj_filename), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = FLAGS },
     { "threshold", "set threshold", OFFSET(threshold), AV_OPT_TYPE_FLOAT, {.dbl = 0.5}, 0, 1.0, FLAGS },
     { "mipmaps", "set mipmaps", OFFSET(mipmaps), AV_OPT_TYPE_INT, {.i64 = 3}, 1, MAX_MIPMAPS, FLAGS },
@@ -56,13 +56,7 @@ static const AVOption foc_options[] = {
     { NULL }
 };
 
-static const AVClass foc_class = {
-    .class_name       = "find_rect",
-    .item_name        = av_default_item_name,
-    .option           = foc_options,
-    .version          = LIBAVUTIL_VERSION_INT,
-    .category         = AV_CLASS_CATEGORY_FILTER,
-};
+AVFILTER_DEFINE_CLASS(find_rect);
 
 static int query_formats(AVFilterContext *ctx)
 {
@@ -307,5 +301,5 @@ AVFilter ff_vf_find_rect = {
     .query_formats   = query_formats,
     .inputs          = foc_inputs,
     .outputs         = foc_outputs,
-    .priv_class      = &foc_class,
+    .priv_class      = &find_rect_class,
 };
diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c
index e9b9ed1..be85f85 100644
--- a/libavfilter/vf_framepack.c
+++ b/libavfilter/vf_framepack.c
@@ -315,7 +315,7 @@ static int request_frame(AVFilterLink *outlink)
 
 #define OFFSET(x) offsetof(FramepackContext, x)
 #define V AV_OPT_FLAG_VIDEO_PARAM
-static const AVOption options[] = {
+static const AVOption framepack_options[] = {
     { "format", "Frame pack output format", OFFSET(format), AV_OPT_TYPE_INT,
         { .i64 = AV_STEREO3D_SIDEBYSIDE }, 0, INT_MAX, .flags = V, .unit = "format" },
     { "sbs", "Views are packed next to each other", 0, AV_OPT_TYPE_CONST,
@@ -331,12 +331,7 @@ static const AVOption options[] = {
     { NULL },
 };
 
-static const AVClass framepack_class = {
-    .class_name = "framepack",
-    .item_name  = av_default_item_name,
-    .option     = options,
-    .version    = LIBAVUTIL_VERSION_INT,
-};
+AVFILTER_DEFINE_CLASS(framepack);
 
 static const AVFilterPad framepack_inputs[] = {
     {
diff --git a/libavfilter/vf_shuffleplanes.c b/libavfilter/vf_shuffleplanes.c
index 80085cd..45698ec 100644
--- a/libavfilter/vf_shuffleplanes.c
+++ b/libavfilter/vf_shuffleplanes.c
@@ -134,12 +134,7 @@ static const AVOption shuffleplanes_options[] = {
     { NULL },
 };
 
-static const AVClass shuffleplanes_class = {
-    .class_name = "shuffleplanes",
-    .item_name  = av_default_item_name,
-    .option     = shuffleplanes_options,
-    .version    = LIBAVUTIL_VERSION_INT,
-};
+AVFILTER_DEFINE_CLASS(shuffleplanes);
 
 static const AVFilterPad shuffleplanes_inputs[] = {
     {
-- 
1.7.11.2



More information about the ffmpeg-devel mailing list