Files
One-KVM/libs/ventoy-img-rs/src/lib.rs
mofeng-git 206594e292 feat(video): 事务化切换与前端统一编排,增强视频输入格式支持
- 后端:切换事务+transition_id,/stream/mode 返回 switching/transition_id 与实际 codec

- 事件:新增 mode_switching/mode_ready,config/webrtc_ready/mode_changed 关联事务

- 编码/格式:扩展 NV21/NV16/NV24/RGB/BGR 输入与转换链路,RKMPP direct input 优化

- 前端:useVideoSession 统一切换,失败回退真实切回 MJPEG,菜单格式同步修复

- 清理:useVideoStream 降级为 MJPEG-only
2026-01-11 10:41:57 +08:00

49 lines
1.3 KiB
Rust

//! Ventoy IMG Generator
//!
//! A Rust library for creating and managing Ventoy bootable IMG files
//! without requiring root privileges or loop devices.
//!
//! # Features
//!
//! - Create Ventoy IMG files with MBR partition table
//! - Format data partition as exFAT
//! - Add, list, read, and remove files in the data partition
//! - Load boot resources from external files
//!
//! # Example
//!
//! ```no_run
//! use ventoy_img::{VentoyImage, resources};
//! use std::path::Path;
//!
//! // Initialize resources from data directory
//! resources::init_resources(Path::new("/var/lib/one-kvm/ventoy")).unwrap();
//!
//! // Create a new 8GB Ventoy image
//! let mut image = VentoyImage::create(
//! Path::new("ventoy.img"),
//! "8G",
//! "Ventoy"
//! ).unwrap();
//!
//! // Add an ISO file
//! image.add_file(Path::new("/path/to/ubuntu.iso")).unwrap();
//!
//! // List files
//! for file in image.list_files().unwrap() {
//! println!("{}: {} bytes", file.name, file.size);
//! }
//! ```
pub mod error;
pub mod exfat;
pub mod image;
pub mod partition;
pub mod resources;
pub use error::{Result, VentoyError};
pub use exfat::FileInfo;
pub use image::VentoyImage;
pub use partition::{parse_size, PartitionLayout};
pub use resources::{get_resource_dir, init_resources, is_initialized, required_files};