1#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
2
3use std::ffi::c_void;
4
5use crate::{
6 common::LPCWSTR,
7 filter2::{INPUT_PIXEL_FORMAT, PIXEL_RGBA},
8};
9
10#[repr(C)]
14pub struct CACHE_REFERENCE {
15 pub func_release: Option<unsafe extern "C" fn(instance: *mut c_void)>,
16 pub cache_instance: *mut c_void,
17}
18
19impl Drop for CACHE_REFERENCE {
20 fn drop(&mut self) {
21 if let Some(func_release) = self.func_release
22 && !self.cache_instance.is_null()
23 {
24 unsafe {
25 func_release(self.cache_instance);
26 }
27 }
28 }
29}
30
31#[repr(C)]
33pub struct CACHE_IMAGE {
34 pub reference: CACHE_REFERENCE,
35 pub buffer: *mut PIXEL_RGBA,
37 pub width: i32,
39 pub height: i32,
40}
41
42#[repr(C)]
44pub struct CACHE_AUDIO {
45 pub reference: CACHE_REFERENCE,
46 pub buffer0: *mut f32,
48 pub buffer1: *mut f32,
50 pub sample_num: i32,
52 pub channel_num: i32,
54}
55
56#[repr(C)]
58pub struct CACHE_FILE_IMAGE {
59 pub reference: CACHE_REFERENCE,
60 pub buffer: *const c_void,
62 pub width: i32,
64 pub height: i32,
65 pub pitch: i32,
67 pub format: INPUT_PIXEL_FORMAT,
69}
70
71#[repr(C)]
73pub struct VIDEO_INFO {
74 pub total_time: f64,
76 pub frame_num: i32,
78 pub track_num: i32,
80 pub width: i32,
82 pub height: i32,
83 pub rate: i32,
85 pub scale: i32,
86}
87
88#[repr(C)]
90pub struct AUDIO_INFO {
91 pub total_time: f64,
93 pub sample_num: i64,
95 pub track_num: i32,
97 pub rate: i32,
99 pub channel: i32,
101}
102
103#[repr(C)]
105pub struct CACHE_HANDLE {
106 pub get_image_cache:
108 unsafe extern "C" fn(identifier: *mut c_void, name: LPCWSTR) -> CACHE_IMAGE,
109
110 pub create_image_cache: unsafe extern "C" fn(
112 identifier: *mut c_void,
113 name: LPCWSTR,
114 width: i32,
115 height: i32,
116 ) -> CACHE_IMAGE,
117
118 pub get_audio_cache:
120 unsafe extern "C" fn(identifier: *mut c_void, name: LPCWSTR) -> CACHE_AUDIO,
121
122 pub create_audio_cache: unsafe extern "C" fn(
124 identifier: *mut c_void,
125 name: LPCWSTR,
126 sample_num: i32,
127 channel_num: i32,
128 ) -> CACHE_AUDIO,
129
130 pub deprecated_get_image_file_cache: unsafe extern "C" fn(file: LPCWSTR) -> CACHE_IMAGE,
132
133 pub get_video_file_info:
135 unsafe extern "C" fn(file: LPCWSTR, info: *mut VIDEO_INFO, info_size: i32) -> bool,
136
137 pub get_audio_file_info:
139 unsafe extern "C" fn(file: LPCWSTR, info: *mut AUDIO_INFO, info_size: i32) -> bool,
140
141 pub get_image_file_cache: unsafe extern "C" fn(file: LPCWSTR) -> CACHE_FILE_IMAGE,
143
144 pub get_video_file_cache:
146 unsafe extern "C" fn(file: LPCWSTR, track: i32, frame: i32) -> CACHE_FILE_IMAGE,
147
148 pub get_video_file_cache_by_time:
150 unsafe extern "C" fn(file: LPCWSTR, track: i32, time: f64) -> CACHE_FILE_IMAGE,
151
152 pub get_audio_file_data: unsafe extern "C" fn(
154 file: LPCWSTR,
155 track: i32,
156 sample_index: i64,
157 sample_num: i32,
158 buffer0: *mut f32,
159 buffer1: *mut f32,
160 ) -> i32,
161
162 pub clear_image_cache: unsafe extern "C" fn(identifier: *mut c_void, name: LPCWSTR),
164
165 pub clear_audio_cache: unsafe extern "C" fn(identifier: *mut c_void, name: LPCWSTR),
167}