Allow stream specification in config

This commit is contained in:
QuantumEntangledAndy committed 2020-06-30 11:41:19 +07:00
1 parent 826814abd7
commit 4ea20f0542
3 files changed
+10 -3

No files matched your search

+2 -2
View File
@@ -242,7 +242,7 @@ impl BcCamera {
Ok(())
}
pub fn start_video(&self, data_out: &mut dyn Write) -> Result<Never> {
pub fn start_video(&self, data_out: &mut dyn Write, stream: &String) -> Result<Never> {
let connection = self
.connection
.as_ref()
@@ -261,7 +261,7 @@ impl BcCamera {
version: xml_ver(),
channel_id: 0,
handle: 0,
stream_type: "mainStream".to_string(),
stream_type: stream.to_string(),
}),
..Default::default()
},
+7
View File
@@ -24,6 +24,9 @@ pub struct CameraConfig {
#[serde(default = "default_format")]
pub format: String,
#[serde(default = "default_stream")]
pub stream: String,
}
fn default_bind_addr() -> String {
@@ -33,3 +36,7 @@ fn default_bind_addr() -> String {
fn default_format() -> String {
"h265".to_string()
}
fn default_stream() -> String {
"mainStream".to_string()
}
+1 -1
View File
@@ -127,7 +127,7 @@ fn camera_main(camera_config: &CameraConfig, output: &mut dyn Write) -> Result<N
"{}: Connected to camera, starting video stream",
camera_config.name
);
camera.start_video(output)
camera.start_video(output, &camera_config.stream)
})()
.map_err(|err| CameraErr { connected, err })
}