summaryrefslogtreecommitdiff
path: root/libavfilter/framesync.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-11 17:34:39 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2021-09-23 21:12:37 +0200
commitb368a774ddac8dc3e97d1206f6ee8c01a81edcab (patch)
treeb39da75bae443cc6bc26510e9a5823a0112a0265 /libavfilter/framesync.h
parent6e26015a6b34f954065d4be8a29ad7941334c490 (diff)
avfilter/framesync: Separate framesync AVClass and auxiliary functions
Will be useful for deduplication. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavfilter/framesync.h')
-rw-r--r--libavfilter/framesync.h35
1 files changed, 23 insertions, 12 deletions
diff --git a/libavfilter/framesync.h b/libavfilter/framesync.h
index fb85e8aec7..a1db87187e 100644
--- a/libavfilter/framesync.h
+++ b/libavfilter/framesync.h
@@ -299,25 +299,36 @@ int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame *
const AVClass *ff_framesync_child_class_iterate(void **iter);
-#define FRAMESYNC_DEFINE_CLASS(name, context, field) \
-static int name##_framesync_preinit(AVFilterContext *ctx) { \
+#define FRAMESYNC_DEFINE_PURE_CLASS(name, desc, func_prefix, options) \
+static const AVClass name##_class = { \
+ .class_name = desc, \
+ .item_name = av_default_item_name, \
+ .option = options, \
+ .version = LIBAVUTIL_VERSION_INT, \
+ .category = AV_CLASS_CATEGORY_FILTER, \
+ .child_class_iterate = ff_framesync_child_class_iterate, \
+ .child_next = func_prefix##_child_next, \
+}
+
+#define FRAMESYNC_AUXILIARY_FUNCS(func_prefix, context, field) \
+static int func_prefix##_framesync_preinit(AVFilterContext *ctx) \
+{ \
context *s = ctx->priv; \
ff_framesync_preinit(&s->field); \
return 0; \
} \
-static void *name##_child_next(void *obj, void *prev) { \
+static void *func_prefix##_child_next(void *obj, void *prev) \
+{ \
context *s = obj; \
s->fs.class = ff_framesync_get_class(); /* FIXME */ \
return prev ? NULL : &s->field; \
-} \
-static const AVClass name##_class = { \
- .class_name = #name, \
- .item_name = av_default_item_name, \
- .option = name##_options, \
- .version = LIBAVUTIL_VERSION_INT, \
- .category = AV_CLASS_CATEGORY_FILTER, \
- .child_class_iterate = ff_framesync_child_class_iterate, \
- .child_next = name##_child_next, \
}
+#define FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, options) \
+FRAMESYNC_AUXILIARY_FUNCS(name, context, field) \
+FRAMESYNC_DEFINE_PURE_CLASS(name, #name, name, options)
+
+#define FRAMESYNC_DEFINE_CLASS(name, context, field) \
+FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, name##_options)
+
#endif /* AVFILTER_FRAMESYNC_H */