From af6c30473519a64880d5d000e54639d44284d63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Cardoso?= Date: Fri, 2 Sep 2022 15:38:47 -0300 Subject: [PATCH] src: server: Add source_type to the v4l API. --- src/server/pages.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/pages.rs b/src/server/pages.rs index a9893b0b..40e1fbd5 100644 --- a/src/server/pages.rs +++ b/src/server/pages.rs @@ -25,6 +25,7 @@ use std::io::prelude::*; pub struct ApiVideoSource { name: String, source: String, + source_type: VideoSourceType, formats: Vec, controls: Vec, } @@ -110,22 +111,25 @@ pub async fn v4l() -> Json> { let cameras = video_source::cameras_available(); let cameras: Vec = cameras .iter() - .map(|cam| match cam { + .map(|video_source_type| match video_source_type { VideoSourceType::Local(cam) => ApiVideoSource { name: cam.name().clone(), source: cam.source_string().to_string(), + source_type: video_source_type.clone(), formats: cam.formats(), controls: cam.controls(), }, VideoSourceType::Gst(gst) => ApiVideoSource { name: gst.name().clone(), source: gst.source_string().to_string(), + source_type: video_source_type.clone(), formats: gst.formats(), controls: gst.controls(), }, VideoSourceType::Redirect(redirect) => ApiVideoSource { name: redirect.name().clone(), source: redirect.source_string().to_string(), + source_type: video_source_type.clone(), formats: redirect.formats(), controls: redirect.controls(), },