Skip to content

Commit b67e12c

Browse files
WIP
1 parent 1d44f87 commit b67e12c

File tree

4 files changed

+232
-122
lines changed

4 files changed

+232
-122
lines changed

src/settings/manager.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ mod tests {
210210
use crate::stream::types::{
211211
CaptureConfiguration, StreamInformation, VideoCaptureConfiguration,
212212
};
213+
use crate::video::video_source_local::LocalSourceDevice;
213214
use crate::video::{
214215
types::{FrameInterval, VideoEncodeType, VideoSourceType},
215216
video_source_local::{VideoSourceLocal, VideoSourceLocalType},
@@ -267,7 +268,10 @@ mod tests {
267268
},
268269
video_source: VideoSourceType::Local(VideoSourceLocal {
269270
name: "Fake Potato Test Video Source Camera".into(),
270-
device_path: "/dev/potatovideo".into(),
271+
devices: vec![LocalSourceDevice {
272+
path: "/dev/potatovideo".into(),
273+
encodings: vec![VideoEncodeType::H264],
274+
}],
271275
typ: VideoSourceLocalType::Usb("usb-0420:08:47.42-77".into()),
272276
}),
273277
}];

src/stream/gst/pipeline_builder.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@ impl Pipeline {
8888
},
8989
VideoSourceType::Local(local_device) => match &local_device.typ {
9090
VideoSourceLocalType::Usb(_) | VideoSourceLocalType::LegacyRpiCam(_) => {
91-
format!("v4l2src device={}", &local_device.device_path)
91+
let device_path = local_device.get_device_path_for_encoding(
92+
&video_and_stream_information
93+
.stream_information
94+
.configuration,
95+
)?;
96+
97+
format!("v4l2src device={device_path}")
9298
}
9399
typ => {
94100
return Err(simple_error!(format!(

src/stream/stream_backend.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ fn create_stream(
299299
mod tests {
300300
use super::*;
301301
use crate::stream::types::CaptureConfiguration;
302+
use crate::video::video_source_local::LocalSourceDevice;
302303
use crate::video::{
303304
types::FrameInterval,
304305
video_source_local::{VideoSourceLocal, VideoSourceLocalType},
@@ -327,11 +328,16 @@ mod tests {
327328
},
328329
video_source: VideoSourceType::Local(VideoSourceLocal {
329330
name: "PotatoCam".into(),
330-
device_path: "/dev/video42".into(),
331+
devices: vec![LocalSourceDevice {
332+
path: "/dev/video42".into(),
333+
encodings: vec![video_encode_type.clone()],
334+
}],
331335
typ: VideoSourceLocalType::Usb("TestPotatoCam".into()),
332336
}),
333337
});
334338

339+
dbg!(&stream);
340+
335341
assert!(stream.is_ok());
336342
stream.unwrap()
337343
}
@@ -353,6 +359,8 @@ mod tests {
353359
StreamType::UDP(video_stream_udp) => video_stream_udp.pipeline(),
354360
_any_other_stream_type => panic!("Failed to create UDP stream: {stream:?}."),
355361
};
362+
dbg!(&pipeline);
363+
dbg!(&expected_pipeline);
356364
assert_eq!(&pipeline, expected_pipeline);
357365
}
358366
}
@@ -374,6 +382,8 @@ mod tests {
374382
StreamType::RTSP(video_stream_rtsp) => video_stream_rtsp.pipeline(),
375383
_any_other_stream_type => panic!("Failed to create RTSP stream: {stream:?}."),
376384
};
385+
dbg!(&pipeline);
386+
dbg!(&expected_pipeline);
377387
assert_eq!(&pipeline, expected_pipeline);
378388
}
379389
}
@@ -463,6 +473,8 @@ mod tests {
463473
StreamType::WEBRTC(video_stream_webrtc) => video_stream_webrtc.pipeline(),
464474
_any_other_stream_type => panic!("Failed to create WebRTC stream: {stream:?}."),
465475
};
476+
dbg!(&pipeline);
477+
dbg!(&expected_pipeline);
466478
assert_eq!(&pipeline, expected_pipeline);
467479
}
468480
}
@@ -484,6 +496,8 @@ mod tests {
484496
StreamType::WEBRTC(video_stream_webrtc) => video_stream_webrtc.pipeline(),
485497
_any_other_stream_type => panic!("Failed to create WebRTC stream: {stream:?}."),
486498
};
499+
dbg!(&pipeline);
500+
dbg!(&expected_pipeline);
487501
assert_eq!(&pipeline, expected_pipeline);
488502
}
489503
}

0 commit comments

Comments
 (0)