Will be useful for deduplication.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -299,25 +299,36 @@ int ff_framesync_dualinput_get_writable(FFFrameSync *fs, AVFrame **f0, AVFrame * · 298 unmodified lines | |||
| 299 | 299 | ||
| 300 | const AVClass *ff_framesync_child_class_iterate(void **iter); | 300 | const 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) \ |
| 303 | static int name##_framesync_preinit(AVFilterContext *ctx) { \ | 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 | { \ | ||
| 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 | } \ |
| 308 | static void *name##_child_next(void *obj, void *prev) { \ | 320 | static 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 | } \ | ||
| 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, \ | ||
| 321 | } | 325 | } |
| 322 | 326 | ||
| 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 | |||
| 323 | #endif /* AVFILTER_FRAMESYNC_H */ | 334 | #endif /* AVFILTER_FRAMESYNC_H */ |