81 lines
1.9 KiB
Rust
81 lines
1.9 KiB
Rust
use oxforge::mdk::{
|
|
GlobalConfig, ModuleContract, OxideModule,
|
|
ParameterDescriptor, PortDeclaration, Ports, ProcessContext,
|
|
};
|
|
use std::any::Any;
|
|
use std::path::Path;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct PluginInfo {
|
|
pub name: String,
|
|
pub display_name: String,
|
|
pub path: std::path::PathBuf,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct FramebufferGuiBridge {
|
|
pub width: u32,
|
|
pub height: u32,
|
|
}
|
|
|
|
impl std::fmt::Debug for FramebufferGuiBridge {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.debug_struct("FramebufferGuiBridge")
|
|
.field("width", &self.width)
|
|
.field("height", &self.height)
|
|
.finish()
|
|
}
|
|
}
|
|
|
|
pub struct DynamicPlugin {
|
|
info: PluginInfo,
|
|
bridge: Option<FramebufferGuiBridge>,
|
|
}
|
|
|
|
impl DynamicPlugin {
|
|
pub fn load(_path: &Path, _config: &GlobalConfig) -> Option<(Self, PluginInfo)> {
|
|
None
|
|
}
|
|
|
|
pub fn info(&self) -> &PluginInfo {
|
|
&self.info
|
|
}
|
|
|
|
pub fn contract(&self) -> ModuleContract {
|
|
ModuleContract::default()
|
|
}
|
|
|
|
pub fn port_declarations(&self) -> Vec<PortDeclaration> {
|
|
Vec::new()
|
|
}
|
|
|
|
pub fn take_framebuffer_bridge(&mut self) -> Option<FramebufferGuiBridge> {
|
|
self.bridge.take()
|
|
}
|
|
}
|
|
|
|
impl OxideModule for DynamicPlugin {
|
|
fn new(_config: &GlobalConfig) -> Self where Self: Sized {
|
|
Self {
|
|
info: PluginInfo {
|
|
name: String::new(),
|
|
display_name: String::new(),
|
|
path: std::path::PathBuf::new(),
|
|
},
|
|
bridge: None,
|
|
}
|
|
}
|
|
|
|
fn process(&mut self, _ports: Ports, _context: &ProcessContext) {}
|
|
|
|
fn receive_data(&mut self, _key: &str, _data: Box<dyn Any + Send>) {}
|
|
|
|
fn param_descriptors(&self) -> Vec<ParameterDescriptor> {
|
|
Vec::new()
|
|
}
|
|
}
|
|
|
|
pub fn scan_all_plugins() -> Vec<PluginInfo> {
|
|
Vec::new()
|
|
}
|