Crates.io | rscam |
lib.rs | rscam |
version | 0.5.5 |
source | src |
created_at | 2015-01-04 02:10:45.192868 |
updated_at | 2019-05-07 06:33:00.053985 |
description | Wrapper for v4l2. |
homepage | |
repository | https://github.com/loyd/rscam |
max_upload_size | |
id | 693 |
size | 104,923 |
Rust wrapper for v4l2.
let mut camera = rscam::new("/dev/video0").unwrap();
camera.start(&rscam::Config {
interval: (1, 30), // 30 fps.
resolution: (1280, 720),
format: b"MJPG",
..Default::default()
}).unwrap();
for i in 0..10 {
let frame = camera.capture().unwrap();
let mut file = fs::File::create(&format!("frame-{}.jpg", i)).unwrap();
file.write_all(&frame[..]).unwrap();
}
The wrapper uses v4l2 (e.g. v4l2_ioctl()
instead of ioctl()
) until feature no_wrapper
is enabled. The feature can be useful when it's desirable to avoid dependence on libv4l2 (for example, cross-compilation).
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.