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/framesync.h (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
299 299
300const AVClass *ff_framesync_child_class_iterate(void **iter);300const AVClass *ff_framesync_child_class_iterate(void **iter);
301 301
302#define FRAMESYNC_DEFINE_CLASS(name, context, field) \302#define FRAMESYNC_DEFINE_PURE_CLASS(name, desc, func_prefix, options) \
303static int name##_framesync_preinit(AVFilterContext *ctx) { \303static 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) \
314static int func_prefix##_framesync_preinit(AVFilterContext *ctx) \
315{ \
304 context *s = ctx->priv; \316 context *s = ctx->priv; \
305 ff_framesync_preinit(&s->field); \317 ff_framesync_preinit(&s->field); \
306 return 0; \318 return 0; \
307} \319} \
308static void *name##_child_next(void *obj, void *prev) { \320static void *func_prefix##_child_next(void *obj, void *prev) \
321{ \
309 context *s = obj; \322 context *s = obj; \
310 s->fs.class = ff_framesync_get_class(); /* FIXME */ \323 s->fs.class = ff_framesync_get_class(); /* FIXME */ \
311 return prev ? NULL : &s->field; \324 return prev ? NULL : &s->field; \
312} \
313static 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, \
321}325}
322 326
327#define FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, options) \
328FRAMESYNC_AUXILIARY_FUNCS(name, context, field) \
329FRAMESYNC_DEFINE_PURE_CLASS(name, #name, name, options)
330
331#define FRAMESYNC_DEFINE_CLASS(name, context, field) \
332FRAMESYNC_DEFINE_CLASS_EXT(name, context, field, name##_options)
333
323#endif /* AVFILTER_FRAMESYNC_H */334#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