4 个版本 (破坏性更新)
0.4.0 | 2024 年 7 月 28 日 |
---|---|
0.3.0 | 2024 年 7 月 26 日 |
0.2.0 | 2024 年 7 月 25 日 |
0.1.0 | 2024 年 7 月 24 日 |
#59 在 视频
每月 892 次下载
28KB
485 行
高效的 Rust 代码礼物
围绕 Cadeau 库的惯用包装:性能原语和媒体基础。
可以选择在构建时动态加载库或常规静态/动态链接,总共有三种选项。有关更多信息,请参阅 xmf-sys。
示例:从 PNG 图像生成 WebM 文件
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(())
}
依赖项
~0–5MB