History

avfilter/framesync: Separate framesync AVClass and auxiliary functions

Will be useful for deduplication.

Andreas Rheinhardt committed 5 years ago

Commit b368a771 parent 6e260151 file · +23 −12Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/framesync.h+23−12
@@ -299,25 +299,36 @@ int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame * · 298 unmodified lines
299299
300300 const AVClass *ff_framesync_child_class_iterate(void **iter);
301301
302−#define FRAMESYNC_DEFINE_CLASS(name, context, field) \
303−static int name##_framesync_preinit(AVFilterContext *ctx) { \
302+#define FRAMESYNC_DEFINE_PURE_CLASS(name, desc, func_prefix, options) \
303+static const AVClass name##_class = { \
304+ .class_name = desc, \
305+ .item_name = av_default_item_name, \
306+ .option = options, \
307+ .version = LIBAVUTIL_VERSION_INT, \
308+ .category = AV_CLASS_CATEGORY_FILTER, \
309+ .child_class_iterate = ff_framesync_child_class_iterate, \
310+ .child_next = func_prefix##_child_next, \
311+}
312+
313+#define FRAMESYNC_AUXILIARY_FUNCS(func_prefix, context, field) \
314+static int func_prefix##_framesync_preinit(AVFilterContext *ctx) \
315+{ \
304316 context *s = ctx->priv; \
305317 ff_framesync_preinit(&s->field); \
306318 return 0; \
307319 } \
308−static void *name##_child_next(void *obj, void *prev) { \
320+static void *func_prefix##_child_next(void *obj, void *prev) \
321+{ \
309322 context *s = obj; \
310323 s->fs.class = ff_framesync_get_class(); /* FIXME */ \
311324 return prev ? NULL : &s->field; \
312−} \
313−static const AVClass name##_class = { \
314− .class_name = #name, \
315− .item_name = av_default_item_name, \
316− .option = name##_options, \
317− .version = LIBAVUTIL_VERSION_INT, \
318− .category = AV_CLASS_CATEGORY_FILTER, \
319− .child_class_iterate = ff_framesync_child_class_iterate, \
320− .child_next = name##_child_next, \
321325 }
322326
327+#define FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, options) \
328+FRAMESYNC_AUXILIARY_FUNCS(name, context, field) \
329+FRAMESYNC_DEFINE_PURE_CLASS(name, #name, name, options)
330+
331+#define FRAMESYNC_DEFINE_CLASS(name, context, field) \
332+FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, name##_options)
333+
323334 #endif /* AVFILTER_FRAMESYNC_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t