#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
use std::ffi::c_void;
use crate::{
common::LPCWSTR,
filter2::{INPUT_PIXEL_FORMAT, PIXEL_RGBA},
};
#[repr(C)]
pub struct CACHE_REFERENCE {
pub func_release: Option<unsafe extern "C" fn(instance: *mut c_void)>,
pub cache_instance: *mut c_void,
}
impl Drop for CACHE_REFERENCE {
fn drop(&mut self) {
if let Some(func_release) = self.func_release
&& !self.cache_instance.is_null()
{
unsafe {
func_release(self.cache_instance);
}
}
}
}
#[repr(C)]
pub struct CACHE_IMAGE {
pub reference: CACHE_REFERENCE,
pub buffer: *mut PIXEL_RGBA,
pub width: i32,
pub height: i32,
}
#[repr(C)]
pub struct CACHE_AUDIO {
pub reference: CACHE_REFERENCE,
pub buffer0: *mut f32,
pub buffer1: *mut f32,
pub sample_num: i32,
pub channel_num: i32,
}
#[repr(C)]
pub struct CACHE_FILE_IMAGE {
pub reference: CACHE_REFERENCE,
pub buffer: *const c_void,
pub width: i32,
pub height: i32,
pub pitch: i32,
pub format: INPUT_PIXEL_FORMAT,
}
#[repr(C)]
pub struct VIDEO_INFO {
pub total_time: f64,
pub frame_num: i32,
pub track_num: i32,
pub width: i32,
pub height: i32,
pub rate: i32,
pub scale: i32,
}
#[repr(C)]
pub struct AUDIO_INFO {
pub total_time: f64,
pub sample_num: i64,
pub track_num: i32,
pub rate: i32,
pub channel: i32,
}
#[repr(C)]
pub struct CACHE_HANDLE {
pub get_image_cache:
unsafe extern "C" fn(identifier: *mut c_void, name: LPCWSTR) -> CACHE_IMAGE,
pub create_image_cache: unsafe extern "C" fn(
identifier: *mut c_void,
name: LPCWSTR,
width: i32,
height: i32,
) -> CACHE_IMAGE,
pub get_audio_cache:
unsafe extern "C" fn(identifier: *mut c_void, name: LPCWSTR) -> CACHE_AUDIO,
pub create_audio_cache: unsafe extern "C" fn(
identifier: *mut c_void,
name: LPCWSTR,
sample_num: i32,
channel_num: i32,
) -> CACHE_AUDIO,
pub deprecated_get_image_file_cache: unsafe extern "C" fn(file: LPCWSTR) -> CACHE_IMAGE,
pub get_video_file_info:
unsafe extern "C" fn(file: LPCWSTR, info: *mut VIDEO_INFO, info_size: i32) -> bool,
pub get_audio_file_info:
unsafe extern "C" fn(file: LPCWSTR, info: *mut AUDIO_INFO, info_size: i32) -> bool,
pub get_image_file_cache: unsafe extern "C" fn(file: LPCWSTR) -> CACHE_FILE_IMAGE,
pub get_video_file_cache:
unsafe extern "C" fn(file: LPCWSTR, track: i32, frame: i32) -> CACHE_FILE_IMAGE,
pub get_video_file_cache_by_time:
unsafe extern "C" fn(file: LPCWSTR, track: i32, time: f64) -> CACHE_FILE_IMAGE,
pub get_audio_file_data: unsafe extern "C" fn(
file: LPCWSTR,
track: i32,
sample_index: i64,
sample_num: i32,
buffer0: *mut f32,
buffer1: *mut f32,
) -> i32,
}