(path_or_url: &str)
| 356 | } |
| 357 | |
| 358 | pub fn file_source(path_or_url: &str) -> CameraSource { |
| 359 | let kind = if is_video_source(path_or_url) { |
| 360 | CameraSourceKind::Video |
| 361 | } else { |
| 362 | CameraSourceKind::Image |
| 363 | }; |
| 364 | CameraSource { |
| 365 | kind, |
| 366 | arg: Some(path_or_url.to_owned()), |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | fn is_url(value: &str) -> bool { |
| 371 | value.starts_with("http://") || value.starts_with("https://") || value.starts_with("file://") |
no test coverage detected