diff mbox series

[FFmpeg-devel,02/39] avfilter/internal: Add AVFILTER_DEFINE_CLASS_EXT

Message ID AM7PR03MB666053287D8B4CF5491CBB268FD79@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 441b292592075b771dff7ee46293157eeb804252
Headers show
Series [FFmpeg-devel,01/39] avfilter/vf_maskedminmax: Simplify init | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 11, 2021, 11:40 p.m. UTC
This macro will allow to share options between AVClasses without
having to redefine the option name (as is currently done) and will
also allow to share the AVClasses itself (which is possible now
that AVClass.child_class_next is gone).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/internal.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Paul B Mahol Sept. 13, 2021, 11:53 a.m. UTC | #1
lgtm
diff mbox series

Patch

diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index 6ddf024d93..e7c154aff0 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -278,14 +278,16 @@  int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p);
  */
 int ff_request_frame(AVFilterLink *link);
 
-#define AVFILTER_DEFINE_CLASS(fname)            \
-    static const AVClass fname##_class = {      \
-        .class_name = #fname,                   \
+#define AVFILTER_DEFINE_CLASS_EXT(name, desc, options) \
+    static const AVClass name##_class = {       \
+        .class_name = desc,                     \
         .item_name  = av_default_item_name,     \
-        .option     = fname##_options,          \
+        .option     = options,                  \
         .version    = LIBAVUTIL_VERSION_INT,    \
         .category   = AV_CLASS_CATEGORY_FILTER, \
     }
+#define AVFILTER_DEFINE_CLASS(fname) \
+    AVFILTER_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
 
 /**
  * Find the index of a link.