mjpeg_rs

Crates.iomjpeg_rs
lib.rsmjpeg_rs
version0.0.1
sourcesrc
created_at2021-10-07 14:26:16.731128
updated_at2021-10-07 14:26:16.731128
descriptionrust编写的mjpeg服务器
homepagehttps://github.com/t924417424/mjpeg_rs
repositoryhttps://github.com/t924417424/mjpeg_rs
max_upload_size
id461811
size7,783
OldCat (t924417424)

documentation

README

mjpeg_rs

rust mjpeg server

// examples

use std::{sync::Arc, thread};

use mjpeg_rs::MJpeg;
use rascam::*;
fn main() {
    let info = info().unwrap();
    if info.cameras.len() < 1 {
        println!("Found 0 cameras. Exiting");
        // note that this doesn't run destructors
        ::std::process::exit(1);
    }
    println!("{}", info);
    let info = &info.cameras[0];
    let mut camera = SimpleCamera::new(info.clone()).unwrap();
    let settings = CameraSettings {
        encoding: MMAL_ENCODING_JPEG,
        width: 600,
        height: 600,
        iso: ISO_AUTO,
        zero_copy: false,
        use_encoder: true,
    };
    camera.configure(settings);
    camera.activate().unwrap();
    let m = Arc::new(MJpeg::new());
    let mrc = m.clone();
    thread::spawn(move || mrc.run("0.0.0.0:8088").unwrap());
    loop {
        let b = camera.take_one().unwrap();
        m.update_jpeg(b).unwrap();
    }
}

Commit count: 5

cargo fmt