Crates.io | cadeau |
lib.rs | cadeau |
version | 0.4.0 |
source | src |
created_at | 2024-07-24 19:29:44.628289 |
updated_at | 2024-07-28 17:27:13.739565 |
description | Idiomatic rust bindings to Cadeau library, performance primitives and media foundation functions |
homepage | https://github.com/Devolutions/cadeau |
repository | https://github.com/Devolutions/cadeau |
max_upload_size | |
id | 1314272 |
size | 30,711 |
Idiomatic wrapper around the Cadeau library: performance primitives and media foundation.
It’s possible to choose between dynamically loading the library and regular static / dynamic linking at build-time for a total of three options. See xmf-sys to learn more about this.
use cadeau::xmf::image::Image;
use cadeau::xmf::recorder::Recorder;
fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(feature = "dlopen")]
unsafe { cadeau::xmf::init("libxmf.so")? };
assert!(cadeau::xmf::is_init());
let frame = Image::load_file("frame.png")?;
let mut recorder = Recorder::builder(frame.width(), frame.height())
.frame_rate(10)
.init("output.webm")?;
recorder.update_frame(frame.data(), 0, 0, frame.width(), frame.height(), frame.step())?;
recorder.timeout();
Ok(())
}