1#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
2
3use std::{ffi::c_void, mem::MaybeUninit};
4
5use crate::{
6 common::LPCWSTR,
7 plugin2::{EDIT_SECTION, LPCSTR},
8};
9
10pub type OBJECT_HANDLE = *mut c_void;
12
13#[repr(C)]
14pub union FILTER_ITEM {
15 pub track: FILTER_ITEM_TRACK,
16 pub track_group: FILTER_ITEM_TRACK_GROUP,
17 pub checkbox: FILTER_ITEM_CHECKBOX,
18 pub check_section: FILTER_ITEM_CHECK_SECTION,
19 pub color: FILTER_ITEM_COLOR,
20 pub select: FILTER_ITEM_SELECT,
21 pub file: FILTER_ITEM_FILE,
22 pub data: FILTER_ITEM_DATA,
23 pub group: FILTER_ITEM_GROUP,
24 pub button: FILTER_ITEM_BUTTON,
25 pub string: FILTER_ITEM_STRING,
26 pub text: FILTER_ITEM_TEXT,
27 pub folder: FILTER_ITEM_FOLDER,
28 pub separator: FILTER_ITEM_SEPARATOR,
29}
30
31#[repr(C)]
33#[derive(Clone, Copy)]
34pub struct FILTER_ITEM_TRACK {
35 pub r#type: LPCWSTR,
37 pub name: LPCWSTR,
39 pub value: f64,
41 pub s: f64,
43 pub e: f64,
45 pub step: f64,
47 pub zero_display: LPCWSTR,
49 pub slider_ratio: f64,
51}
52
53#[repr(C)]
55#[derive(Clone, Copy)]
56pub struct FILTER_ITEM_TRACK_GROUP {
57 pub r#type: LPCWSTR,
59 pub name: LPCWSTR,
61 pub tracks: *mut *mut FILTER_ITEM_TRACK,
63}
64
65#[repr(C)]
67#[derive(Clone, Copy)]
68pub struct FILTER_ITEM_CHECKBOX {
69 pub r#type: LPCWSTR,
71 pub name: LPCWSTR,
73 pub value: bool,
75}
76
77pub type FILTER_ITEM_CHECK = FILTER_ITEM_CHECKBOX;
78
79#[repr(C)]
81#[derive(Clone, Copy)]
82pub struct FILTER_ITEM_CHECK_SECTION {
83 pub r#type: LPCWSTR,
85 pub name: LPCWSTR,
87 pub value: bool,
89 pub multi_section: bool,
91}
92
93#[repr(C)]
95#[derive(Clone, Copy)]
96pub struct FILTER_ITEM_COLOR {
97 pub r#type: LPCWSTR,
99 pub name: LPCWSTR,
101 pub value: FILTER_ITEM_COLOR_VALUE,
103}
104
105#[repr(C)]
107#[derive(Clone, Copy)]
108pub union FILTER_ITEM_COLOR_VALUE {
109 pub code: u32,
110 pub bgrx: [u8; 4],
111}
112
113#[repr(C)]
115#[derive(Clone, Copy)]
116pub struct FILTER_ITEM_SELECT {
117 pub r#type: LPCWSTR,
119 pub name: LPCWSTR,
121 pub value: i32,
123 pub items: *const FILTER_ITEM_SELECT_ITEM,
125}
126
127#[repr(C)]
129#[derive(Clone, Copy)]
130pub struct FILTER_ITEM_SELECT_ITEM {
131 pub name: LPCWSTR,
133 pub value: i32,
135}
136
137#[repr(C)]
139#[derive(Clone, Copy)]
140pub struct FILTER_ITEM_FILE {
141 pub r#type: LPCWSTR,
143 pub name: LPCWSTR,
145 pub value: LPCWSTR,
147 pub filefilter: LPCWSTR,
149}
150
151#[repr(C)]
155#[derive(Clone, Copy)]
156pub struct FILTER_ITEM_DATA {
157 pub r#type: LPCWSTR,
159 pub name: LPCWSTR,
161 pub value: *mut c_void,
163 pub size: i32,
165 pub default_value: [MaybeUninit<u8>; 16 * 1024],
167}
168
169#[repr(C)]
173#[derive(Clone, Copy)]
174pub struct FILTER_ITEM_GROUP {
175 pub r#type: LPCWSTR,
177 pub name: LPCWSTR,
179 pub default_visible: bool,
181}
182
183#[repr(C)]
187#[derive(Clone, Copy)]
188pub struct FILTER_ITEM_BUTTON {
189 pub r#type: LPCWSTR,
191 pub name: LPCWSTR,
193 pub callback: extern "C" fn(edit_section: *mut EDIT_SECTION),
195}
196
197#[repr(C)]
200#[derive(Clone, Copy)]
201pub struct FILTER_ITEM_STRING {
202 pub r#type: LPCWSTR,
204 pub name: LPCWSTR,
206 pub value: LPCWSTR,
208}
209
210#[repr(C)]
213#[derive(Clone, Copy)]
214pub struct FILTER_ITEM_TEXT {
215 pub r#type: LPCWSTR,
217 pub name: LPCWSTR,
219 pub value: LPCWSTR,
221}
222
223#[repr(C)]
225#[derive(Clone, Copy)]
226pub struct FILTER_ITEM_FOLDER {
227 pub r#type: LPCWSTR,
229 pub name: LPCWSTR,
231 pub value: LPCWSTR,
233}
234
235#[repr(C)]
237#[derive(Clone, Copy)]
238pub struct FILTER_ITEM_SEPARATOR {
239 pub r#type: LPCWSTR,
241 pub name: LPCWSTR,
243}
244
245#[repr(C)]
247pub struct VERTEX_COLOR {
248 pub x: f32,
249 pub y: f32,
250 pub z: f32,
251 pub r: f32,
252 pub g: f32,
253 pub b: f32,
254 pub a: f32,
255}
256
257#[repr(C)]
259pub struct VERTEX_COLOR_NORM {
260 pub x: f32,
261 pub y: f32,
262 pub z: f32,
263 pub r: f32,
264 pub g: f32,
265 pub b: f32,
266 pub a: f32,
267 pub vx: f32,
268 pub vy: f32,
269 pub vz: f32,
270}
271
272#[repr(C)]
274pub struct VERTEX_TEXTURE {
275 pub x: f32,
276 pub y: f32,
277 pub z: f32,
278 pub u: f32,
279 pub v: f32,
280 pub a: f32,
281}
282
283#[repr(C)]
285pub struct VERTEX_TEXTURE_NORM {
286 pub x: f32,
287 pub y: f32,
288 pub z: f32,
289 pub u: f32,
290 pub v: f32,
291 pub a: f32,
292 pub vx: f32,
293 pub vy: f32,
294 pub vz: f32,
295}
296
297#[repr(i32)]
299pub enum VERTEX_TYPE {
300 TRIANGLE_COLOR = 1,
302 TRIANGLE_COLOR_NORM = 2,
304 TRIANGLE_TEXTURE = 3,
306 TRIANGLE_TEXTURE_NORM = 4,
308 QUAD_COLOR = 5,
310 QUAD_COLOR_NORM = 6,
312 QUAD_TEXTURE = 7,
314 QUAD_TEXTURE_NORM = 8,
316}
317
318#[repr(i32)]
320pub enum SAMPLER_MODE {
321 CLIP = 0,
323 CLAMP = 1,
325 LOOP = 2,
327 MIRROR = 3,
329 DOT = 4,
331}
332
333#[repr(i32)]
335pub enum BLEND_MODE {
336 NONE = 0,
338 ADD = 1,
340 SUB = 2,
342 MUL = 3,
344 SCREEN = 4,
346 OVERLAY = 5,
348 LIGHT = 6,
350 DARK = 7,
352 BRIGHTNESS = 8,
354 CHROMA = 9,
356 SHADOW = 10,
358 LIGHT_DARK = 11,
360 DIFF = 12,
362}
363
364#[repr(i32)]
366pub enum BILLBOARD_MODE {
367 NONE = 0,
369 SIDE = 1,
371 DIRECTION = 2,
373 CAMERA = 3,
375}
376
377#[repr(i32)]
379pub enum BLEND_STATE_MODE {
380 COPY = 0,
382 MASK = 1,
384 DRAW = 2,
386 ADD = 3,
388}
389
390#[repr(i32)]
392#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
393pub enum INPUT_PIXEL_FORMAT {
394 RGBA = 28,
396 BGRA = 87,
398 BGR = 88,
400 PA64 = 11,
402 HF64 = 10,
404 YUY2 = 107,
406 YC48 = 13,
408}
409
410#[repr(i32)]
412#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
413pub enum OUTPUT_PIXEL_FORMAT {
414 RGBA = 28,
416 PA64 = 11,
418 HF64 = 10,
420}
421
422#[repr(C)]
424pub struct PIXEL_RGBA {
425 pub r: u8,
426 pub g: u8,
427 pub b: u8,
428 pub a: u8,
429}
430
431#[repr(C)]
433pub struct SCENE_INFO {
434 pub width: i32,
436 pub height: i32,
438 pub rate: i32,
440 pub scale: i32,
442 pub sample_rate: i32,
444}
445
446#[repr(C)]
448pub struct OBJECT_INFO {
449 pub id: i64,
452 pub frame: i32,
454 pub frame_total: i32,
456 pub time: f64,
458 pub time_total: f64,
460 pub width: i32,
462 pub height: i32,
464 pub sample_index: i64,
466 pub sample_total: i64,
468 pub sample_num: i32,
470 pub channel_num: i32,
472 pub effect_id: i64,
475 pub flag: i32,
477 pub layer: i32,
479 pub index: i32,
481 pub num: i32,
483 pub frame_s: i32,
485 pub frame_e: i32,
487 pub effect_layer: i32,
489 pub origin_frame: i32,
491}
492
493impl OBJECT_INFO {
494 pub const FLAG_FILTER_OBJECT: i32 = 1;
496}
497
498#[repr(C)]
500pub struct OBJECT_IMAGE_PARAM {
501 pub x: f32,
503 pub y: f32,
504 pub z: f32,
505 pub rx: f32,
507 pub ry: f32,
508 pub rz: f32,
509 pub sx: f32,
511 pub sy: f32,
512 pub sz: f32,
513 pub cx: f32,
515 pub cy: f32,
516 pub cz: f32,
517 pub alpha: f32,
519}
520
521#[repr(C)]
523pub struct OBJECT_AUDIO_PARAM {
524 pub vol_l: f32,
526 pub vol_r: f32,
527}
528
529#[repr(C)]
531pub struct EFFECT_ITEM_PARAM {
532 pub name: LPCWSTR,
534 pub value: LPCSTR,
536}
537
538#[repr(C)]
540pub struct FILTER_PROC_VIDEO {
541 pub scene: *const SCENE_INFO,
543
544 pub object: *const OBJECT_INFO,
546
547 pub get_image_data: unsafe extern "C" fn(buffer: *mut PIXEL_RGBA),
550
551 pub set_image_data: unsafe extern "C" fn(buffer: *const PIXEL_RGBA, width: i32, height: i32),
555
556 pub get_image_texture2d: unsafe extern "C" fn() -> *mut c_void,
560
561 pub get_framebuffer_texture2d: unsafe extern "C" fn() -> *mut c_void,
565
566 pub edit: *mut EDIT_SECTION,
568
569 pub param: *mut OBJECT_IMAGE_PARAM,
571
572 pub get_output_image_param: unsafe extern "C" fn(
574 object: OBJECT_HANDLE,
575 offset: f64,
576 param: *mut OBJECT_IMAGE_PARAM,
577 param_size: i32,
578 ) -> bool,
579
580 pub get_image_object: unsafe extern "C" fn(layer: i32, offset: f64) -> OBJECT_HANDLE,
582
583 pub draw_image: unsafe extern "C" fn(
585 image: LPCWSTR,
586 x: f32,
587 y: f32,
588 z: f32,
589 rx: f32,
590 ry: f32,
591 rz: f32,
592 sx: f32,
593 sy: f32,
594 sz: f32,
595 alpha: f32,
596 ) -> bool,
597
598 pub draw_poly: unsafe extern "C" fn(
600 vertex_type: VERTEX_TYPE,
601 vertex_list: *const c_void,
602 vertex_num: i32,
603 image: LPCWSTR,
604 ) -> bool,
605
606 pub set_default_anchor: unsafe extern "C" fn(width: i32, height: i32),
608
609 pub set_blend_mode: unsafe extern "C" fn(blend: BLEND_MODE),
611
612 pub set_material_shine: unsafe extern "C" fn(shine: f32),
614
615 pub set_sampler_mode: unsafe extern "C" fn(sampler: SAMPLER_MODE),
617
618 pub set_culling_state: unsafe extern "C" fn(culling: bool),
620
621 pub set_billboard_mode: unsafe extern "C" fn(billboard: BILLBOARD_MODE),
623
624 pub create_image_resource:
626 unsafe extern "C" fn(image: LPCWSTR, buffer: *const PIXEL_RGBA, width: i32, height: i32),
627
628 pub get_image_resource_texture2d: unsafe extern "C" fn(resource: LPCWSTR) -> *mut c_void,
630
631 pub copy_image_resource:
633 unsafe extern "C" fn(dst_resource: LPCWSTR, src_resource: LPCWSTR) -> bool,
634
635 pub clear_image_resource: unsafe extern "C" fn(resource: LPCWSTR, color: PIXEL_RGBA) -> bool,
637
638 pub draw_image_to_resource: unsafe extern "C" fn(
640 dst_resource: LPCWSTR,
641 src_resource: LPCWSTR,
642 x: f32,
643 y: f32,
644 z: f32,
645 rx: f32,
646 ry: f32,
647 rz: f32,
648 sx: f32,
649 sy: f32,
650 sz: f32,
651 alpha: f32,
652 ) -> bool,
653
654 pub draw_poly_to_resource: unsafe extern "C" fn(
656 dst_resource: LPCWSTR,
657 vertex_type: VERTEX_TYPE,
658 vertex_list: *const c_void,
659 vertex_num: i32,
660 src_resource: LPCWSTR,
661 ) -> bool,
662
663 pub exec_pixelshader_file: unsafe extern "C" fn(
665 cso_file: LPCWSTR,
666 target: LPCWSTR,
667 resource_list: *mut LPCWSTR,
668 resource_num: i32,
669 constant: *mut c_void,
670 constant_size: i32,
671 blend_state: *mut c_void,
672 sampler_state: *mut c_void,
673 ) -> bool,
674
675 pub exec_computeshader_file: unsafe extern "C" fn(
677 cso_file: LPCWSTR,
678 target_list: *mut LPCWSTR,
679 target_num: i32,
680 resource_list: *mut LPCWSTR,
681 resource_num: i32,
682 constant: *mut c_void,
683 constant_size: i32,
684 count_x: i32,
685 count_y: i32,
686 count_z: i32,
687 sampler_state: *mut c_void,
688 ) -> bool,
689
690 pub get_blend_state: unsafe extern "C" fn(blend: BLEND_STATE_MODE) -> *mut c_void,
692
693 pub get_sampler_state: unsafe extern "C" fn(sampler: SAMPLER_MODE) -> *mut c_void,
695
696 pub exec_pixelshader_data: unsafe extern "C" fn(
698 data: *const u8,
699 data_size: i32,
700 target: LPCWSTR,
701 resource_list: *mut LPCWSTR,
702 resource_num: i32,
703 constant: *mut c_void,
704 constant_size: i32,
705 blend_state: *mut c_void,
706 sampler_state: *mut c_void,
707 ) -> bool,
708
709 pub exec_computeshader_data: unsafe extern "C" fn(
711 data: *const u8,
712 data_size: i32,
713 target_list: *mut LPCWSTR,
714 target_num: i32,
715 resource_list: *mut LPCWSTR,
716 resource_num: i32,
717 constant: *mut c_void,
718 constant_size: i32,
719 count_x: i32,
720 count_y: i32,
721 count_z: i32,
722 sampler_state: *mut c_void,
723 ) -> bool,
724
725 pub get_image_resource_size:
727 unsafe extern "C" fn(resource: LPCWSTR, width: *mut i32, height: *mut i32) -> bool,
728
729 pub get_image_resource_data: unsafe extern "C" fn(
731 resource: LPCWSTR,
732 buffer: *mut c_void,
733 width: i32,
734 height: i32,
735 pitch: i32,
736 format: OUTPUT_PIXEL_FORMAT,
737 ) -> bool,
738
739 pub set_image_resource_data: unsafe extern "C" fn(
741 resource: LPCWSTR,
742 buffer: *const c_void,
743 width: i32,
744 height: i32,
745 pitch: i32,
746 format: INPUT_PIXEL_FORMAT,
747 ) -> bool,
748
749 #[deprecated = "冗長なので廃止します ※EDIT_SECTIONに移動しました"]
751 pub deprecated_get_font: unsafe extern "C" fn(font: LPCWSTR) -> *mut c_void,
752
753 pub set_filter_item_data_size: unsafe extern "C" fn(filter_item_data: *mut c_void, size: i32),
755
756 pub userdata: *mut c_void,
758
759 pub release_image_resource: unsafe extern "C" fn(resource: LPCWSTR) -> bool,
761
762 pub exec_effect: unsafe extern "C" fn(
764 name: LPCWSTR,
765 param_list: *mut EFFECT_ITEM_PARAM,
766 param_num: i32,
767 resource: LPCWSTR,
768 ) -> bool,
769}
770
771#[repr(C)]
773pub struct FILTER_PROC_AUDIO {
774 pub scene: *const SCENE_INFO,
776
777 pub object: *const OBJECT_INFO,
779
780 pub get_sample_data: unsafe extern "C" fn(buffer: *mut f32, channel: i32),
784
785 pub set_sample_data: unsafe extern "C" fn(buffer: *const f32, channel: i32),
789
790 pub edit: *mut EDIT_SECTION,
792
793 pub param: *mut OBJECT_AUDIO_PARAM,
795
796 pub get_output_audio_param: unsafe extern "C" fn(
798 object: OBJECT_HANDLE,
799 offset: f64,
800 param: *mut OBJECT_AUDIO_PARAM,
801 param_size: i32,
802 ) -> bool,
803
804 pub get_audio_object: unsafe extern "C" fn(layer: i32, offset: f64) -> OBJECT_HANDLE,
806
807 pub set_filter_item_data_size: unsafe extern "C" fn(filter_item_data: *mut c_void, size: i32),
809
810 pub userdata: *mut c_void,
812}
813
814impl FILTER_PLUGIN_TABLE {
815 pub const FLAG_VIDEO: i32 = 1;
817 pub const FLAG_AUDIO: i32 = 2;
819 pub const FLAG_INPUT: i32 = 4;
821 pub const FLAG_FILTER: i32 = 8;
824 pub const FLAG_USERDATA: i32 = 16;
826}
827
828#[repr(C)]
830pub struct FILTER_PLUGIN_TABLE {
831 pub flag: i32,
834 pub name: LPCWSTR,
836 pub label: LPCWSTR,
838 pub information: LPCWSTR,
840
841 pub items: *const *const c_void,
843
844 pub func_proc_video: Option<extern "C" fn(video: *mut FILTER_PROC_VIDEO) -> bool>,
846
847 pub func_proc_audio: Option<extern "C" fn(audio: *mut FILTER_PROC_AUDIO) -> bool>,
849
850 pub func_create: Option<extern "C" fn(effect_id: i64) -> *mut c_void>,
852
853 pub func_destroy: Option<extern "C" fn(effect_id: i64, userdata: *mut c_void)>,
855}