#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
use std::{ffi::c_void, mem::MaybeUninit};
use crate::{common::LPCWSTR, plugin2::EDIT_SECTION};
pub type OBJECT_HANDLE = *mut c_void;
#[repr(C)]
pub union FILTER_ITEM {
pub track: FILTER_ITEM_TRACK,
pub track_group: FILTER_ITEM_TRACK_GROUP,
pub checkbox: FILTER_ITEM_CHECKBOX,
pub check_section: FILTER_ITEM_CHECK_SECTION,
pub color: FILTER_ITEM_COLOR,
pub select: FILTER_ITEM_SELECT,
pub file: FILTER_ITEM_FILE,
pub data: FILTER_ITEM_DATA,
pub group: FILTER_ITEM_GROUP,
pub button: FILTER_ITEM_BUTTON,
pub string: FILTER_ITEM_STRING,
pub text: FILTER_ITEM_TEXT,
pub folder: FILTER_ITEM_FOLDER,
pub separator: FILTER_ITEM_SEPARATOR,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_TRACK {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: f64,
pub s: f64,
pub e: f64,
pub step: f64,
pub zero_display: LPCWSTR,
pub slider_ratio: f64,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_TRACK_GROUP {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub tracks: *mut *mut FILTER_ITEM_TRACK,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_CHECKBOX {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: bool,
}
pub type FILTER_ITEM_CHECK = FILTER_ITEM_CHECKBOX;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_CHECK_SECTION {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_COLOR {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: FILTER_ITEM_COLOR_VALUE,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union FILTER_ITEM_COLOR_VALUE {
pub code: u32,
pub bgrx: [u8; 4],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_SELECT {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: i32,
pub items: *const FILTER_ITEM_SELECT_ITEM,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_SELECT_ITEM {
pub name: LPCWSTR,
pub value: i32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_FILE {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: LPCWSTR,
pub filefilter: LPCWSTR,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_DATA {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: *mut c_void,
pub size: i32,
pub default_value: [MaybeUninit<u8>; 1024],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_GROUP {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub default_visible: bool,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_BUTTON {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub callback: extern "C" fn(edit_section: *mut EDIT_SECTION),
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_STRING {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: LPCWSTR,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_TEXT {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: LPCWSTR,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_FOLDER {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
pub value: LPCWSTR,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FILTER_ITEM_SEPARATOR {
pub r#type: LPCWSTR,
pub name: LPCWSTR,
}
#[repr(C)]
pub struct VERTEX_COLOR {
pub x: f32,
pub y: f32,
pub z: f32,
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}
#[repr(C)]
pub struct VERTEX_COLOR_NORM {
pub x: f32,
pub y: f32,
pub z: f32,
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
pub vx: f32,
pub vy: f32,
pub vz: f32,
}
#[repr(C)]
pub struct VERTEX_TEXTURE {
pub x: f32,
pub y: f32,
pub z: f32,
pub u: f32,
pub v: f32,
pub a: f32,
}
#[repr(C)]
pub struct VERTEX_TEXTURE_NORM {
pub x: f32,
pub y: f32,
pub z: f32,
pub u: f32,
pub v: f32,
pub a: f32,
pub vx: f32,
pub vy: f32,
pub vz: f32,
}
#[repr(i32)]
pub enum VERTEX_TYPE {
TRIANGLE_COLOR = 1,
TRIANGLE_COLOR_NORM = 2,
TRIANGLE_TEXTURE = 3,
TRIANGLE_TEXTURE_NORM = 4,
QUAD_COLOR = 5,
QUAD_COLOR_NORM = 6,
QUAD_TEXTURE = 7,
QUAD_TEXTURE_NORM = 8,
}
#[repr(i32)]
pub enum SAMPLER_MODE {
CLIP = 0,
CLAMP = 1,
LOOP = 2,
MIRROR = 3,
DOT = 4,
}
#[repr(i32)]
pub enum BLEND_MODE {
NONE = 0,
ADD = 1,
SUB = 2,
MUL = 3,
SCREEN = 4,
OVERLAY = 5,
LIGHT = 6,
DARK = 7,
BRIGHTNESS = 8,
CHROMA = 9,
SHADOW = 10,
LIGHT_DARK = 11,
DIFF = 12,
}
#[repr(i32)]
pub enum BILLBOARD_MODE {
NONE = 0,
SIDE = 1,
DIRECTION = 2,
CAMERA = 3,
}
#[repr(i32)]
pub enum BLEND_STATE_MODE {
COPY = 0,
MASK = 1,
DRAW = 2,
ADD = 3,
}
#[repr(i32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum INPUT_PIXEL_FORMAT {
RGBA = 28,
BGRA = 87,
BGR = 88,
PA64 = 11,
HF64 = 10,
YUY2 = 107,
YC48 = 13,
}
#[repr(i32)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum OUTPUT_PIXEL_FORMAT {
RGBA = 28,
PA64 = 11,
HF64 = 10,
}
#[repr(C)]
pub struct PIXEL_RGBA {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}
#[repr(C)]
pub struct SCENE_INFO {
pub width: i32,
pub height: i32,
pub rate: i32,
pub scale: i32,
pub sample_rate: i32,
}
#[repr(C)]
pub struct OBJECT_INFO {
pub id: i64,
pub frame: i32,
pub frame_total: i32,
pub time: f64,
pub time_total: f64,
pub width: i32,
pub height: i32,
pub sample_index: i64,
pub sample_total: i64,
pub sample_num: i32,
pub channel_num: i32,
pub effect_id: i64,
pub flag: i32,
pub layer: i32,
pub index: i32,
pub num: i32,
}
impl OBJECT_INFO {
pub const FLAG_FILTER_OBJECT: i32 = 1;
}
#[repr(C)]
pub struct OBJECT_IMAGE_PARAM {
pub x: f32,
pub y: f32,
pub z: f32,
pub rx: f32,
pub ry: f32,
pub rz: f32,
pub sx: f32,
pub sy: f32,
pub sz: f32,
pub cx: f32,
pub cy: f32,
pub cz: f32,
pub alpha: f32,
}
#[repr(C)]
pub struct OBJECT_AUDIO_PARAM {
pub vol_l: f32,
pub vol_r: f32,
}
#[repr(C)]
pub struct FILTER_PROC_VIDEO {
pub scene: *const SCENE_INFO,
pub object: *const OBJECT_INFO,
pub get_image_data: unsafe extern "C" fn(buffer: *mut PIXEL_RGBA),
pub set_image_data: unsafe extern "C" fn(buffer: *const PIXEL_RGBA, width: i32, height: i32),
pub get_image_texture2d: unsafe extern "C" fn() -> *mut c_void,
pub get_framebuffer_texture2d: unsafe extern "C" fn() -> *mut c_void,
pub edit: *mut EDIT_SECTION,
pub param: *mut OBJECT_IMAGE_PARAM,
pub get_output_image_param: unsafe extern "C" fn(
object: OBJECT_HANDLE,
offset: f64,
param: *mut OBJECT_IMAGE_PARAM,
param_size: i32,
) -> bool,
pub get_image_object: unsafe extern "C" fn(layer: i32, offset: f64) -> OBJECT_HANDLE,
pub draw_image: unsafe extern "C" fn(
image: LPCWSTR,
x: f32,
y: f32,
z: f32,
rx: f32,
ry: f32,
rz: f32,
sx: f32,
sy: f32,
sz: f32,
alpha: f32,
) -> bool,
pub draw_poly: unsafe extern "C" fn(
vertex_type: VERTEX_TYPE,
vertex_list: *const c_void,
vertex_num: i32,
image: LPCWSTR,
) -> bool,
pub set_default_anchor: unsafe extern "C" fn(width: i32, height: i32),
pub set_blend_mode: unsafe extern "C" fn(blend: BLEND_MODE),
pub set_material_shine: unsafe extern "C" fn(shine: f32),
pub set_sampler_mode: unsafe extern "C" fn(sampler: SAMPLER_MODE),
pub set_culling_state: unsafe extern "C" fn(culling: bool),
pub set_billboard_mode: unsafe extern "C" fn(billboard: BILLBOARD_MODE),
pub create_image_resource:
unsafe extern "C" fn(image: LPCWSTR, buffer: *const PIXEL_RGBA, width: i32, height: i32),
pub get_image_resource_texture2d: unsafe extern "C" fn(resource: LPCWSTR) -> *mut c_void,
pub copy_image_resource:
unsafe extern "C" fn(dst_resource: LPCWSTR, src_resource: LPCWSTR) -> bool,
pub clear_image_resource: unsafe extern "C" fn(resource: LPCWSTR, color: PIXEL_RGBA) -> bool,
pub draw_image_to_resource: unsafe extern "C" fn(
dst_resource: LPCWSTR,
src_resource: LPCWSTR,
x: f32,
y: f32,
z: f32,
rx: f32,
ry: f32,
rz: f32,
sx: f32,
sy: f32,
sz: f32,
alpha: f32,
) -> bool,
pub draw_poly_to_resource: unsafe extern "C" fn(
dst_resource: LPCWSTR,
vertex_type: VERTEX_TYPE,
vertex_list: *const c_void,
vertex_num: i32,
src_resource: LPCWSTR,
) -> bool,
pub exec_pixelshader_file: unsafe extern "C" fn(
cso_file: LPCWSTR,
target: LPCWSTR,
resource_list: *mut LPCWSTR,
resource_num: i32,
constant: *mut c_void,
constant_size: i32,
blend_state: *mut c_void,
sampler_state: *mut c_void,
) -> bool,
pub exec_computeshader_file: unsafe extern "C" fn(
cso_file: LPCWSTR,
target_list: *mut LPCWSTR,
target_num: i32,
resource_list: *mut LPCWSTR,
resource_num: i32,
constant: *mut c_void,
constant_size: i32,
count_x: i32,
count_y: i32,
count_z: i32,
sampler_state: *mut c_void,
) -> bool,
pub get_blend_state: unsafe extern "C" fn(blend: BLEND_STATE_MODE) -> *mut c_void,
pub get_sampler_state: unsafe extern "C" fn(sampler: SAMPLER_MODE) -> *mut c_void,
pub exec_pixelshader_data: unsafe extern "C" fn(
data: *const u8,
data_size: i32,
target: LPCWSTR,
resource_list: *mut LPCWSTR,
resource_num: i32,
constant: *mut c_void,
constant_size: i32,
blend_state: *mut c_void,
sampler_state: *mut c_void,
) -> bool,
pub exec_computeshader_data: unsafe extern "C" fn(
data: *const u8,
data_size: i32,
target_list: *mut LPCWSTR,
target_num: i32,
resource_list: *mut LPCWSTR,
resource_num: i32,
constant: *mut c_void,
constant_size: i32,
count_x: i32,
count_y: i32,
count_z: i32,
sampler_state: *mut c_void,
) -> bool,
pub get_image_resource_size:
unsafe extern "C" fn(resource: LPCWSTR, width: *mut i32, height: *mut i32) -> bool,
pub get_image_resource_data: unsafe extern "C" fn(
resource: LPCWSTR,
buffer: *mut c_void,
width: i32,
height: i32,
pitch: i32,
format: OUTPUT_PIXEL_FORMAT,
) -> bool,
pub set_image_resource_data: unsafe extern "C" fn(
resource: LPCWSTR,
buffer: *const c_void,
width: i32,
height: i32,
pitch: i32,
format: INPUT_PIXEL_FORMAT,
) -> bool,
}
#[repr(C)]
pub struct FILTER_PROC_AUDIO {
pub scene: *const SCENE_INFO,
pub object: *const OBJECT_INFO,
pub get_sample_data: unsafe extern "C" fn(buffer: *mut f32, channel: i32),
pub set_sample_data: unsafe extern "C" fn(buffer: *const f32, channel: i32),
pub edit: *mut EDIT_SECTION,
pub param: *mut OBJECT_AUDIO_PARAM,
pub get_output_audio_param: unsafe extern "C" fn(
object: OBJECT_HANDLE,
offset: f64,
param: *mut OBJECT_AUDIO_PARAM,
param_size: i32,
) -> bool,
pub get_audio_object: unsafe extern "C" fn(layer: i32, offset: f64) -> OBJECT_HANDLE,
}
impl FILTER_PLUGIN_TABLE {
pub const FLAG_VIDEO: i32 = 1;
pub const FLAG_AUDIO: i32 = 2;
pub const FLAG_INPUT: i32 = 4;
pub const FLAG_FILTER: i32 = 8;
}
#[repr(C)]
pub struct FILTER_PLUGIN_TABLE {
pub flag: i32,
pub name: LPCWSTR,
pub label: LPCWSTR,
pub information: LPCWSTR,
pub items: *const *const c_void,
pub func_proc_video: Option<extern "C" fn(video: *mut FILTER_PROC_VIDEO) -> bool>,
pub func_proc_audio: Option<extern "C" fn(audio: *mut FILTER_PROC_AUDIO) -> bool>,
}