| 1 | # API overview |
| 2 | |
| 3 | frei0r API **1.2** is specified by |
| 4 | [`include/frei0r.h`](https://github.com/dyne/frei0r/blob/master/include/frei0r.h). |
| 5 | That header is authoritative. This page is a map for readers; the |
| 6 | [generated API reference](https://dyne.org/frei0r/codedoc/html/) renders the complete declarations and |
| 7 | comments. |
| 8 | |
| 9 | ## Design |
| 10 | |
| 11 | The interface is a C ABI for simple video sources, filters and mixers controlled |
| 12 | by a small set of parameter types. Hosts remain responsible for media decoding, |
| 13 | timelines, events, user interfaces and encoding. |
| 14 | |
| 15 | Each plugin is a shared library. A host loads the library, checks metadata, |
| 16 | constructs an instance for a frame size, sets parameters, calls an update |
| 17 | function for each frame, and destroys the instance. |
| 18 | |
| 19 | ## Plugin lifecycle |
| 20 | |
| 21 | | Function | Responsibility | |
| 22 | | --- | --- | |
| 23 | | `f0r_init` | Initialize process-wide plugin state | |
| 24 | | `f0r_get_plugin_info` | Return identity, type, color model, version and parameter count | |
| 25 | | `f0r_get_param_info` | Describe one parameter | |
| 26 | | `f0r_construct` | Create an instance for a width and height | |
| 27 | | `f0r_set_param_value` | Set one instance parameter | |
| 28 | | `f0r_get_param_value` | Read one instance parameter | |
| 29 | | `f0r_update` | Process a one-input API 1.0-compatible filter | |
| 30 | | `f0r_update2` | Process a source, filter, two-input mixer or three-input mixer | |
| 31 | | `f0r_destruct` | Destroy an instance | |
| 32 | | `f0r_deinit` | Release process-wide plugin state | |
| 33 | |
| 34 | [Browse the generated function list](https://dyne.org/frei0r/codedoc/html/globals_func.html). |
| 35 | |
| 36 | ## Plugin types |
| 37 | |
| 38 | - **Source:** no input frames; generates an output. |
| 39 | - **Filter:** one input frame. |
| 40 | - **Mixer2:** two input frames. |
| 41 | - **Mixer3:** three input frames. |
| 42 | |
| 43 | [Generated plugin-type reference](https://dyne.org/frei0r/codedoc/html/group___p_l_u_g_i_n___t_y_p_e.html) |
| 44 | |
| 45 | ## Parameter types |
| 46 | |
| 47 | The ABI supports Boolean, double, color, position and string parameters. |
| 48 | Parameters must be initialized during construction. Hosts use the metadata name, |
| 49 | type and explanation to build controls. |
| 50 | |
| 51 | [Generated parameter-type reference](https://dyne.org/frei0r/codedoc/html/group___p_a_r_a_m___t_y_p_e.html) |
| 52 | |
| 53 | ## Color models |
| 54 | |
| 55 | The plugin metadata declares how four bytes in each pixel are interpreted. |
| 56 | RGBA8888 is recommended for API 1.2 effects. BGRA8888 and packed 32-bit models |
| 57 | remain available for compatibility. |
| 58 | |
| 59 | [Generated color-model reference](https://dyne.org/frei0r/codedoc/html/group___c_o_l_o_r___m_o_d_e_l.html) |
| 60 | |
| 61 | ## Plugin locations |
| 62 | |
| 63 | Unix systems define standard system, local and user library locations under |
| 64 | `frei0r-1`. An optional vendor directory avoids name clashes. |
| 65 | `FREI0R_PATH` supplies a platform-separated search list when a host supports |
| 66 | custom locations. |
| 67 | |
| 68 | [Generated plugin-location reference](https://dyne.org/frei0r/codedoc/html/group__pluglocations.html) |
| 69 | |
| 70 | ## Icons |
| 71 | |
| 72 | An effect can install a PNG icon with the plugin name. Icon directories mirror |
| 73 | the library's vendor layout under the corresponding frei0r data directory. |
| 74 | |
| 75 | [Generated icon reference](https://dyne.org/frei0r/codedoc/html/group__icons.html) |
| 76 | |
| 77 | ## Concurrency |
| 78 | |
| 79 | Hosts may use separate instances concurrently. Plugin authors must follow the |
| 80 | header's rules for process-wide and instance state rather than assuming all |
| 81 | updates happen on one thread. |
| 82 | |
| 83 | [Generated concurrency reference](https://dyne.org/frei0r/codedoc/html/group__concurrency.html) |
| 84 | |
| 85 | ## C++ wrapper |
| 86 | |
| 87 | [`include/frei0r.hpp`](https://github.com/dyne/frei0r/blob/master/include/frei0r.hpp) |
| 88 | provides base classes and a `construct<T>` helper. It reduces boilerplate but |
| 89 | does not replace the C ABI. |
| 90 | |
| 91 | Continue with the [plugin development guide](/develop-plugin). |