Expand description
This module defines the interfaces to be implemented for a Phaneron plugin to be successfully loaded.
To create a plugin you must have a function annotated with the #[export_root_module]
from the abi_stable
crate.
This function should return a PhaneronPluginRootModule
which acts as the handle which can be used to initialize
your plugin. This first function should not perform any additional work such as loading assets etc. as your plugin will be given
an opportunity to initialize itself later.
You should then have a load
function that is annotated using the #[sabi_external_fn]
macro from the abi_stable
crate.
This function is the initializer for your plugin and is where you can load assets that are globally required and pre-allocate
large amounts of memory if required. This function is allowed to fail and will only be called once. If it fails then the plugin
will not be loaded and Phaneron will not attempt to load the plugin again. If failing, please return some useful error message.
#[export_root_module]
fn instantiate_root_module() -> PhaneronPluginRootModuleRef {
PhaneronPluginRootModule { load }.leak_into_prefix()
}
#[sabi_extern_fn]
pub fn load(context: PhaneronPluginContext) -> RResult<PhaneronPlugin, RString> {
log::set_logger(phaneron_plugin::get_logger(&context)).unwrap();
log::set_max_level(LevelFilter::Trace);
let plugin = DemoPlugin {};
ROk(PhaneronPlugin_TO::from_value(plugin, TD_Opaque))
}
The returned plugin
is of type DemoPlugin
in this instance, which implements the PhaneronPlugin
trait. This object will be
used to create nodes from your plugin and manage its lifecycle. Refer to the documentation of PhaneronPlugin
.
Modules§
- Phaneron
Logging Context_ trait - This module is generated by the
#[sabi_trait]
attribute on PhaneronLoggingContext - traits
- types
- This module provides aliases for the trait objects generated by
abi_stable
for traits annotated withsabi_trait
.
Structs§
- Audio
Frame With Id - An audio frame along with its associated output Id.
- Audio
Input Id - Audio
Output Id - Colour
Spec - Defines the transformation function for a colourspace. May be used to define custom colour spaces.
- Phaneron
Logging Context_ TO - The trait object for PhaneronLoggingContext.
- Phaneron
Plugin Context - Context passed to plugins, currently only serves as a way to provide a logging contet.
- Phaneron
Plugin Root Module - Describes the entrypoint for a plugin.
- Phaneron
Plugin Root Module Ref - This is the pointer to the prefix of
PhaneronPluginRootModule
. - Phaneron
Plugin Root Module_ Prefix - This is the prefix fields of
PhaneronPluginRootModule
, accessible throughPhaneronPluginRootModuleRef
, with.0.prefix()
. - Plugin
Logger - Provides logging to a plugin.
It can be set as the default logger for the
log
trait by callinginit
. - Shader
Params - Parameters to be passed to a process shader.
Each call to a
set_param_
function will push a parameter of that type to the arguments list, so calls should be made in the order in which parameters are required to be sent to the shader. - Video
Frame With Id - A video frame along with its associated output Id.
- Video
Input Id - Video
Output Id
Enums§
- Audio
Channel Layout - Supported audio channel layouts.
- Audio
Format - Supported audio I/O formats. Audio will be converted to 32 bit floating-point on input.
- Colour
Space - Built-in colour space definitions.
- Interlace
Mode - Supported interlacing modes.
- LogLevel
- This should not be used by plugins, it is consumed by Phaneron to carry log messages across the FFI boundary.
- Shader
Param - Available shader parameter types, these do not need to be directly consumed by plugins.
- Video
Format - Supported pixel packing formats.
Constants§
- COLOUR_
SPEC_ BT_ 709 - Colour space transformation for BT.709. Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.709-6-201506-I!!PDF-E.pdf
- COLOUR_
SPEC_ BT_ 601_ 525 - Colour space transformation for BT.601 (525 lines). Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf
- COLOUR_
SPEC_ BT_ 601_ 625 - Colour space transformation for BT.601 (625 lines). Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf
- COLOUR_
SPEC_ BT_ 2020 - Colour space transformation for BT.709. Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-2-201510-I!!PDF-E.pdf
- COLOUR_
SPEC_ SRGB - Colour space transformation for sRGB using kR and kB values from BT.709. Reference: https://en.wikipedia.org/wiki/SRGB
Traits§
- Phaneron
Logging Context - This trait is used to allow the logger to be used across the FFI boundary. It should not be consumed by plugins.
Functions§
- get_
logger - Returns the logger for a plugin which can then be used to pass log messages to Phaneron.
Type Aliases§
- Phaneron
Logging Context_ CTO - A type alias for the const-constructible
PhaneronLoggingContext_TO
.