cadeau

Crates.iocadeau
lib.rscadeau
version0.4.0
sourcesrc
created_at2024-07-24 19:29:44.628289
updated_at2024-07-28 17:27:13.739565
descriptionIdiomatic rust bindings to Cadeau library, performance primitives and media foundation functions
homepagehttps://github.com/Devolutions/cadeau
repositoryhttps://github.com/Devolutions/cadeau
max_upload_size
id1314272
size30,711
Marc-André Moreau (awakecoding)

documentation

README

An efficient and idiomatic cadeau to Rust

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.

Example: generate a WebM file from a PNG image

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(())
}
Commit count: 0

cargo fmt