| 56 | |
| 57 | |
| 58 | === Plugins === |
| 59 | |
| 60 | A plugin is a shared object with well-defined entry functions and a set of filter functions. A plugin must provide |
| 61 | |
| 62 | * `plugin_init(void)` initializing the plugin if needed, |
| 63 | * `plugin_destroy(void)` freeing any structures created by the plugin, |
| 64 | * `plugin_get_filter_names(void)` returning an array of filter names that are provided by the plugins and are also the corresponding function names to call, |
| 65 | * `plugin_get_filter_description(char *filter_name)` returning a human-readable description of the purpose of filter `filter_name` and |
| 66 | * `filter_foo(char *data, int32_t width, int32_t height, int32_t bytes_per_pixel)` to call the filter. |
| 67 | |
| 68 | On the UFO side a plugin is loaded by creating an UfoPlugin object and passing the name of the .so file. An UfoPlugin is a relatively thin wrapper that just calls `dlopen()` (or the respective equivalent on other operating systems) to load the shared object and returns UfoFilters by reading the function pointers according to the filter name. |