vidi_configs/
vidi_configs.rsuse clap::Parser;
use std::io;
use vidi;
use vidi::config::ConfigRequest;
#[derive(Parser)]
#[clap(about)]
struct Args {
#[arg(long)]
width: Option<u32>,
#[arg(long)]
height: Option<u32>,
#[arg(long)]
#[clap(value_parser = |s: &str| s.as_bytes().try_into().map(vidi::FourCC::new))]
fourcc: Option<vidi::FourCC>,
#[arg(long, default_value_t=32)]
count: usize,
}
fn main() -> io::Result<()> {
let cameras_list = vidi::actors::camera_list::spawn()?;
let cameras = cameras_list.cameras();
let camera = cameras_list.create(&cameras[0].info.id())
.expect("No such camera")
.expect("Failed to get camera");
dbg!(camera.get_id());
{
let mut camera = camera.acquire();
if let Ok(ref mut camera) = camera {
let db = camera.get_supported_configs()?;
let args = Args::parse();
let request = ConfigRequest {
width: args.width,
height: args.height,
fourcc: args.fourcc,
..ConfigRequest::default()
};
for (i, config) in db.query_configs(request).iter().enumerate() {
if i > args.count {
println!("More configs available...");
break;
}
println!("Config: {:?}", config);
}
}
}
Ok(())
}