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 check: FILTER_ITEM_CHECK,
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 pub hide_rule: FILTER_ITEM_HIDE_RULE,
30}
31
32#[repr(C)]
34#[derive(Clone, Copy)]
35pub struct FILTER_ITEM_TRACK {
36 pub r#type: LPCWSTR,
38 pub name: LPCWSTR,
40 pub value: f64,
42 pub s: f64,
44 pub e: f64,
46 pub step: f64,
48 pub zero_display: LPCWSTR,
50 pub slider_ratio: f64,
52}
53
54#[repr(C)]
56#[derive(Clone, Copy)]
57pub struct FILTER_ITEM_TRACK_GROUP {
58 pub r#type: LPCWSTR,
60 pub name: LPCWSTR,
62 pub tracks: *mut *mut FILTER_ITEM_TRACK,
64}
65
66#[repr(C)]
68#[derive(Clone, Copy)]
69pub struct FILTER_ITEM_CHECK {
70 pub r#type: LPCWSTR,
72 pub name: LPCWSTR,
74 pub value: bool,
76}
77
78#[repr(C)]
80#[derive(Clone, Copy)]
81pub struct FILTER_ITEM_CHECK_SECTION {
82 pub r#type: LPCWSTR,
84 pub name: LPCWSTR,
86 pub value: bool,
88 pub multi_section: bool,
90}
91
92#[repr(C)]
94#[derive(Clone, Copy)]
95pub struct FILTER_ITEM_COLOR {
96 pub r#type: LPCWSTR,
98 pub name: LPCWSTR,
100 pub value: FILTER_ITEM_COLOR_VALUE,
102}
103
104#[repr(C)]
106#[derive(Clone, Copy)]
107pub union FILTER_ITEM_COLOR_VALUE {
108 pub code: u32,
109 pub bgrx: [u8; 4],
110}
111
112#[repr(C)]
114#[derive(Clone, Copy)]
115pub struct FILTER_ITEM_SELECT {
116 pub r#type: LPCWSTR,
118 pub name: LPCWSTR,
120 pub value: i32,
122 pub items: *const FILTER_ITEM_SELECT_ITEM,
124}
125
126#[repr(C)]
128#[derive(Clone, Copy)]
129pub struct FILTER_ITEM_SELECT_ITEM {
130 pub name: LPCWSTR,
132 pub value: i32,
134}
135
136#[repr(C)]
138#[derive(Clone, Copy)]
139pub struct FILTER_ITEM_FILE {
140 pub r#type: LPCWSTR,
142 pub name: LPCWSTR,
144 pub value: LPCWSTR,
146 pub filefilter: LPCWSTR,
148}
149
150#[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)]
248#[derive(Clone, Copy)]
249pub struct FILTER_ITEM_HIDE_RULE {
250 pub r#type: LPCWSTR,
252 pub name: LPCWSTR,
254 pub condition_name: LPCWSTR,
261 pub condition_operator: FILTER_ITEM_HIDE_RULE_OPERATOR,
263 pub condition_value: i32,
265}
266
267#[repr(i32)]
269#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
270pub enum FILTER_ITEM_HIDE_RULE_OPERATOR {
271 EQUAL = 0,
273 NOT_EQUAL = 1,
275 GREATER = 2,
277 LESS = 3,
279}
280
281#[repr(C)]
283pub struct VERTEX_COLOR {
284 pub x: f32,
285 pub y: f32,
286 pub z: f32,
287 pub r: f32,
288 pub g: f32,
289 pub b: f32,
290 pub a: f32,
291}
292
293#[repr(C)]
295pub struct VERTEX_COLOR_NORM {
296 pub x: f32,
297 pub y: f32,
298 pub z: f32,
299 pub r: f32,
300 pub g: f32,
301 pub b: f32,
302 pub a: f32,
303 pub vx: f32,
304 pub vy: f32,
305 pub vz: f32,
306}
307
308#[repr(C)]
310pub struct VERTEX_TEXTURE {
311 pub x: f32,
312 pub y: f32,
313 pub z: f32,
314 pub u: f32,
315 pub v: f32,
316 pub a: f32,
317}
318
319#[repr(C)]
321pub struct VERTEX_TEXTURE_NORM {
322 pub x: f32,
323 pub y: f32,
324 pub z: f32,
325 pub u: f32,
326 pub v: f32,
327 pub a: f32,
328 pub vx: f32,
329 pub vy: f32,
330 pub vz: f32,
331}
332
333#[repr(i32)]
335pub enum VERTEX_TYPE {
336 TRIANGLE_COLOR = 1,
338 TRIANGLE_COLOR_NORM = 2,
340 TRIANGLE_TEXTURE = 3,
342 TRIANGLE_TEXTURE_NORM = 4,
344 QUAD_COLOR = 5,
346 QUAD_COLOR_NORM = 6,
348 QUAD_TEXTURE = 7,
350 QUAD_TEXTURE_NORM = 8,
352}
353
354#[repr(i32)]
356pub enum SAMPLER_MODE {
357 CLIP = 0,
359 CLAMP = 1,
361 LOOP = 2,
363 MIRROR = 3,
365 DOT = 4,
367}
368
369#[repr(i32)]
371pub enum BLEND_MODE {
372 NONE = 0,
374 ADD = 1,
376 SUB = 2,
378 MUL = 3,
380 SCREEN = 4,
382 OVERLAY = 5,
384 LIGHT = 6,
386 DARK = 7,
388 BRIGHTNESS = 8,
390 CHROMA = 9,
392 SHADOW = 10,
394 LIGHT_DARK = 11,
396 DIFF = 12,
398}
399
400#[repr(i32)]
402pub enum BILLBOARD_MODE {
403 NONE = 0,
405 SIDE = 1,
407 DIRECTION = 2,
409 CAMERA = 3,
411}
412
413#[repr(i32)]
415pub enum BLEND_STATE_MODE {
416 COPY = 0,
418 MASK = 1,
420 DRAW = 2,
422 ADD = 3,
424}
425
426#[repr(i32)]
428#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
429pub enum INPUT_PIXEL_FORMAT {
430 RGBA = 28,
432 BGRA = 87,
434 BGR = 88,
436 PA64 = 11,
438 HF64 = 10,
440 YUY2 = 107,
442 YC48 = 13,
444}
445
446#[repr(i32)]
448#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
449pub enum OUTPUT_PIXEL_FORMAT {
450 RGBA = 28,
452 PA64 = 11,
454 HF64 = 10,
456}
457
458#[repr(C)]
460pub struct PIXEL_RGBA {
461 pub r: u8,
462 pub g: u8,
463 pub b: u8,
464 pub a: u8,
465}
466
467#[repr(C)]
469pub struct SCENE_INFO {
470 pub width: i32,
472 pub height: i32,
474 pub rate: i32,
476 pub scale: i32,
478 pub sample_rate: i32,
480}
481
482#[repr(C)]
484pub struct OBJECT_INFO {
485 pub id: i64,
488 pub frame: i32,
490 pub frame_total: i32,
492 pub time: f64,
494 pub time_total: f64,
496 pub width: i32,
498 pub height: i32,
500 pub sample_index: i64,
502 pub sample_total: i64,
504 pub sample_num: i32,
506 pub channel_num: i32,
508 pub effect_id: i64,
511 pub flag: i32,
513 pub layer: i32,
515 pub index: i32,
517 pub num: i32,
519 pub frame_s: i32,
521 pub frame_e: i32,
523 pub effect_layer: i32,
525 pub origin_frame: i32,
527}
528
529impl OBJECT_INFO {
530 pub const FLAG_FILTER_OBJECT: i32 = 1;
532}
533
534#[repr(C)]
536pub struct OBJECT_IMAGE_PARAM {
537 pub x: f32,
539 pub y: f32,
540 pub z: f32,
541 pub rx: f32,
543 pub ry: f32,
544 pub rz: f32,
545 pub sx: f32,
547 pub sy: f32,
548 pub sz: f32,
549 pub cx: f32,
551 pub cy: f32,
552 pub cz: f32,
553 pub alpha: f32,
555}
556
557#[repr(C)]
559pub struct OBJECT_AUDIO_PARAM {
560 pub vol_l: f32,
562 pub vol_r: f32,
563}
564
565#[repr(C)]
567pub struct EFFECT_ITEM_PARAM {
568 pub name: LPCWSTR,
570 pub value: LPCSTR,
572}
573
574#[repr(C)]
576pub struct FILTER_PROC_VIDEO {
577 pub scene: *const SCENE_INFO,
579
580 pub object: *const OBJECT_INFO,
582
583 pub get_image_data: unsafe extern "C" fn(buffer: *mut PIXEL_RGBA),
586
587 pub set_image_data: unsafe extern "C" fn(buffer: *const PIXEL_RGBA, width: i32, height: i32),
591
592 pub get_image_texture2d: unsafe extern "C" fn() -> *mut c_void,
596
597 pub get_framebuffer_texture2d: unsafe extern "C" fn() -> *mut c_void,
601
602 pub edit: *mut EDIT_SECTION,
604
605 pub param: *mut OBJECT_IMAGE_PARAM,
607
608 pub get_output_image_param: unsafe extern "C" fn(
610 object: OBJECT_HANDLE,
611 offset: f64,
612 param: *mut OBJECT_IMAGE_PARAM,
613 param_size: i32,
614 ) -> bool,
615
616 pub get_image_object: unsafe extern "C" fn(layer: i32, offset: f64) -> OBJECT_HANDLE,
618
619 pub draw_image: unsafe extern "C" fn(
621 image: LPCWSTR,
622 x: f32,
623 y: f32,
624 z: f32,
625 rx: f32,
626 ry: f32,
627 rz: f32,
628 sx: f32,
629 sy: f32,
630 sz: f32,
631 alpha: f32,
632 ) -> bool,
633
634 pub draw_poly: unsafe extern "C" fn(
636 vertex_type: VERTEX_TYPE,
637 vertex_list: *const c_void,
638 vertex_num: i32,
639 image: LPCWSTR,
640 ) -> bool,
641
642 pub set_default_anchor: unsafe extern "C" fn(width: i32, height: i32),
644
645 pub set_blend_mode: unsafe extern "C" fn(blend: BLEND_MODE),
647
648 pub set_material_shine: unsafe extern "C" fn(shine: f32),
650
651 pub set_sampler_mode: unsafe extern "C" fn(sampler: SAMPLER_MODE),
653
654 pub set_culling_state: unsafe extern "C" fn(culling: bool),
656
657 pub set_billboard_mode: unsafe extern "C" fn(billboard: BILLBOARD_MODE),
659
660 pub create_image_resource:
662 unsafe extern "C" fn(image: LPCWSTR, buffer: *const PIXEL_RGBA, width: i32, height: i32),
663
664 pub get_image_resource_texture2d: unsafe extern "C" fn(resource: LPCWSTR) -> *mut c_void,
666
667 pub copy_image_resource:
669 unsafe extern "C" fn(dst_resource: LPCWSTR, src_resource: LPCWSTR) -> bool,
670
671 pub clear_image_resource: unsafe extern "C" fn(resource: LPCWSTR, color: PIXEL_RGBA) -> bool,
673
674 pub draw_image_to_resource: unsafe extern "C" fn(
676 dst_resource: LPCWSTR,
677 src_resource: LPCWSTR,
678 x: f32,
679 y: f32,
680 z: f32,
681 rx: f32,
682 ry: f32,
683 rz: f32,
684 sx: f32,
685 sy: f32,
686 sz: f32,
687 alpha: f32,
688 ) -> bool,
689
690 pub draw_poly_to_resource: unsafe extern "C" fn(
692 dst_resource: LPCWSTR,
693 vertex_type: VERTEX_TYPE,
694 vertex_list: *const c_void,
695 vertex_num: i32,
696 src_resource: LPCWSTR,
697 ) -> bool,
698
699 pub exec_pixelshader_file: unsafe extern "C" fn(
701 cso_file: LPCWSTR,
702 target: LPCWSTR,
703 resource_list: *mut LPCWSTR,
704 resource_num: i32,
705 constant: *mut c_void,
706 constant_size: i32,
707 blend_state: *mut c_void,
708 sampler_state: *mut c_void,
709 ) -> bool,
710
711 pub exec_computeshader_file: unsafe extern "C" fn(
713 cso_file: LPCWSTR,
714 target_list: *mut LPCWSTR,
715 target_num: i32,
716 resource_list: *mut LPCWSTR,
717 resource_num: i32,
718 constant: *mut c_void,
719 constant_size: i32,
720 count_x: i32,
721 count_y: i32,
722 count_z: i32,
723 sampler_state: *mut c_void,
724 ) -> bool,
725
726 pub get_blend_state: unsafe extern "C" fn(blend: BLEND_STATE_MODE) -> *mut c_void,
728
729 pub get_sampler_state: unsafe extern "C" fn(sampler: SAMPLER_MODE) -> *mut c_void,
731
732 pub exec_pixelshader_data: unsafe extern "C" fn(
734 data: *const u8,
735 data_size: i32,
736 target: LPCWSTR,
737 resource_list: *mut LPCWSTR,
738 resource_num: i32,
739 constant: *mut c_void,
740 constant_size: i32,
741 blend_state: *mut c_void,
742 sampler_state: *mut c_void,
743 ) -> bool,
744
745 pub exec_computeshader_data: unsafe extern "C" fn(
747 data: *const u8,
748 data_size: i32,
749 target_list: *mut LPCWSTR,
750 target_num: i32,
751 resource_list: *mut LPCWSTR,
752 resource_num: i32,
753 constant: *mut c_void,
754 constant_size: i32,
755 count_x: i32,
756 count_y: i32,
757 count_z: i32,
758 sampler_state: *mut c_void,
759 ) -> bool,
760
761 pub get_image_resource_size:
763 unsafe extern "C" fn(resource: LPCWSTR, width: *mut i32, height: *mut i32) -> bool,
764
765 pub get_image_resource_data: unsafe extern "C" fn(
767 resource: LPCWSTR,
768 buffer: *mut c_void,
769 width: i32,
770 height: i32,
771 pitch: i32,
772 format: OUTPUT_PIXEL_FORMAT,
773 ) -> bool,
774
775 pub set_image_resource_data: unsafe extern "C" fn(
777 resource: LPCWSTR,
778 buffer: *const c_void,
779 width: i32,
780 height: i32,
781 pitch: i32,
782 format: INPUT_PIXEL_FORMAT,
783 ) -> bool,
784
785 #[deprecated = "冗長なので廃止します ※EDIT_SECTIONに移動しました"]
787 pub deprecated_get_font: unsafe extern "C" fn(font: LPCWSTR) -> *mut c_void,
788
789 pub set_filter_item_data_size: unsafe extern "C" fn(filter_item_data: *mut c_void, size: i32),
791
792 pub userdata: *mut c_void,
794
795 pub release_image_resource: unsafe extern "C" fn(resource: LPCWSTR) -> bool,
797
798 pub exec_effect: unsafe extern "C" fn(
800 name: LPCWSTR,
801 param_list: *mut EFFECT_ITEM_PARAM,
802 param_num: i32,
803 resource: LPCWSTR,
804 ) -> bool,
805}
806
807#[repr(C)]
809pub struct FILTER_PROC_AUDIO {
810 pub scene: *const SCENE_INFO,
812
813 pub object: *const OBJECT_INFO,
815
816 pub get_sample_data: unsafe extern "C" fn(buffer: *mut f32, channel: i32),
820
821 pub set_sample_data: unsafe extern "C" fn(buffer: *const f32, channel: i32),
825
826 pub edit: *mut EDIT_SECTION,
828
829 pub param: *mut OBJECT_AUDIO_PARAM,
831
832 pub get_output_audio_param: unsafe extern "C" fn(
834 object: OBJECT_HANDLE,
835 offset: f64,
836 param: *mut OBJECT_AUDIO_PARAM,
837 param_size: i32,
838 ) -> bool,
839
840 pub get_audio_object: unsafe extern "C" fn(layer: i32, offset: f64) -> OBJECT_HANDLE,
842
843 pub set_filter_item_data_size: unsafe extern "C" fn(filter_item_data: *mut c_void, size: i32),
845
846 pub userdata: *mut c_void,
848}
849
850impl FILTER_PLUGIN_TABLE {
851 pub const FLAG_VIDEO: i32 = 1;
853 pub const FLAG_AUDIO: i32 = 2;
855 pub const FLAG_INPUT: i32 = 4;
857 pub const FLAG_FILTER: i32 = 8;
860 pub const FLAG_USERDATA: i32 = 16;
862}
863
864#[repr(C)]
866pub struct FILTER_PLUGIN_TABLE {
867 pub flag: i32,
870 pub name: LPCWSTR,
872 pub label: LPCWSTR,
874 pub information: LPCWSTR,
876
877 pub items: *const *const c_void,
879
880 pub func_proc_video: Option<extern "C" fn(video: *mut FILTER_PROC_VIDEO) -> bool>,
882
883 pub func_proc_audio: Option<extern "C" fn(audio: *mut FILTER_PROC_AUDIO) -> bool>,
885
886 pub func_create: Option<extern "C" fn(effect_id: i64) -> *mut c_void>,
888
889 pub func_destroy: Option<extern "C" fn(effect_id: i64, userdata: *mut c_void)>,
891}