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).
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -278,14 +278,16 @@ int ff_append_outpad_free_name(AVFilterContext *f, AVFilterPad *p); · 277 unmodified lines | |||
| 278 | */ | 278 | */ |
| 279 | int ff_request_frame(AVFilterLink *link); | 279 | int ff_request_frame(AVFilterLink *link); |
| 280 | 280 | ||
| 281 | #define AVFILTER_DEFINE_CLASS(fname) \ | 281 | #define AVFILTER_DEFINE_CLASS_EXT(name, desc, options) \ |
| 282 | static const AVClass fname##_class = { \ | 282 | static const AVClass name##_class = { \ |
| 283 | .class_name = #fname, \ | 283 | .class_name = desc, \ |
| 284 | .item_name = av_default_item_name, \ | 284 | .item_name = av_default_item_name, \ |
| 285 | .option = fname##_options, \ | 285 | .option = options, \ |
| 286 | .version = LIBAVUTIL_VERSION_INT, \ | 286 | .version = LIBAVUTIL_VERSION_INT, \ |
| 287 | .category = AV_CLASS_CATEGORY_FILTER, \ | 287 | .category = AV_CLASS_CATEGORY_FILTER, \ |
| 288 | } | 288 | } |
| 289 | #define AVFILTER_DEFINE_CLASS(fname) \ | ||
| 290 | AVFILTER_DEFINE_CLASS_EXT(fname, #fname, fname##_options) | ||
| 289 | 291 | ||
| 290 | /** | 292 | /** |
| 291 | * Find the index of a link. | 293 | * Find the index of a link. |