#![allow(
non_upper_case_globals,
non_camel_case_types,
non_snake_case,
dead_code,
unsafe_op_in_unsafe_fn,
clippy::all
)]
pub mod bindings;
#[cfg(test)]
mod tests {
use super::bindings as b;
#[test]
fn encoder_handle_lifecycle() {
unsafe {
let mut handle: *mut b::EbComponentType = std::ptr::null_mut();
let mut config: b::EbSvtAv1EncConfiguration = std::mem::zeroed();
let err = b::svt_av1_enc_init_handle(&mut handle, &mut config);
assert_eq!(err, b::EbErrorType::EB_ErrorNone, "init_handle");
assert!(!handle.is_null());
config.source_width = 64;
config.source_height = 64;
config.enc_mode = 8;
config.encoder_bit_depth = 10;
config.force_key_frames = true;
config.avif = true;
let tune = std::ffi::CString::new("tune").unwrap();
let three = std::ffi::CString::new("3").unwrap();
assert_eq!(
b::svt_av1_enc_parse_parameter(&mut config, tune.as_ptr(), three.as_ptr()),
b::EbErrorType::EB_ErrorNone,
"tune=3"
);
let err = b::svt_av1_enc_set_parameter(handle, &mut config);
assert_eq!(err, b::EbErrorType::EB_ErrorNone, "set_parameter");
let err = b::svt_av1_enc_init(handle);
assert_eq!(err, b::EbErrorType::EB_ErrorNone, "enc_init");
let err = b::svt_av1_enc_deinit(handle);
assert_eq!(err, b::EbErrorType::EB_ErrorNone, "deinit");
let err = b::svt_av1_enc_deinit_handle(handle);
assert_eq!(err, b::EbErrorType::EB_ErrorNone, "deinit_handle");
}
}
}