pub async fn v4l(req: HttpRequest) -> Json<Vec<ApiVideoSource>> {
    debug!("{:#?}", req);

    let cameras = video_source::cameras_available();
    let cameras: Vec<ApiVideoSource> = cameras
        .iter()
        .map(|cam| match cam {
            VideoSourceType::Local(cam) => ApiVideoSource {
                name: cam.name().clone(),
                source: cam.source_string().to_string(),
                formats: cam.formats(),
                controls: cam.controls(),
            },
            VideoSourceType::Gst(gst) => ApiVideoSource {
                name: gst.name().clone(),
                source: gst.source_string().to_string(),
                formats: gst.formats(),
                controls: gst.controls(),
            },
            VideoSourceType::Redirect(redirect) => ApiVideoSource {
                name: redirect.name().clone(),
                source: redirect.source_string().to_string(),
                formats: redirect.formats(),
                controls: redirect.controls(),
            },
        })
        .collect();

    Json(cameras)
}
/// Provides list of all video sources, with controls and formats
Provides list of all video sources, with controls and formats
Provides list of all video sources with controls and formats
pub async fn v4l(req: HttpRequest) -> Json<Vec<ApiVideoSource>> {
    debug!("{:#?}", req);
    let cameras = video_source::cameras_available();
    let cameras: Vec<ApiVideoSource> = cameras
        .iter()
        .map(|cam| match cam {
            VideoSourceType::Local(cam) => ApiVideoSource {
                name: cam.name().clone(),
                source: cam.source_string().to_string(),
                formats: cam.formats(),
                controls: cam.controls(),
            },
            VideoSourceType::Gst(gst) => ApiVideoSource {
                name: gst.name().clone(),
                source: gst.source_string().to_string(),
                formats: gst.formats(),
                controls: gst.controls(),
            },
            VideoSourceType::Redirect(redirect) => ApiVideoSource {
                name: redirect.name().clone(),
                source: redirect.source_string().to_string(),
                formats: redirect.formats(),
                controls: redirect.controls(),
            },
        })
        .collect();
    Json(cameras)
}
pub async fn v4l ( req : HttpRequest ) -> Json < Vec < ApiVideoSource > > { debug ! ( " " req ) ; let cameras = video_source :: cameras_available ( ) ; let cameras : Vec < ApiVideoSource > = cameras . iter ( ) . map ( | cam | match cam { VideoSourceType :: Local ( cam ) => ApiVideoSource { name : cam . name ( ) . clone ( ) , source : cam . source_string ( ) . to_string ( ) , formats : cam . formats ( ) , controls : cam . controls ( ) , } , VideoSourceType :: Gst ( gst ) => ApiVideoSource { name : gst . name ( ) . clone ( ) , source : gst . source_string ( ) . to_string ( ) , formats : gst . formats ( ) , controls : gst . controls ( ) , } , VideoSourceType :: Redirect ( redirect ) => ApiVideoSource { name : redirect . name ( ) . clone ( ) , source : redirect . source_string ( ) . to_string ( ) , formats : redirect . formats ( ) , controls : redirect . controls ( ) , } , } ) . collect ( ) ; Json ( cameras ) }
Provides list of all video sources, with controls and formats
Provides list of all video sources with controls and formats
req
HttpRequest