fix example

This commit is contained in:
l1npengtul
2021-07-17 18:03:01 +09:00
parent 0b29eb9842
commit fcc7047ca2
2 changed files with 18 additions and 16 deletions
+1
View File
@@ -3,6 +3,7 @@
## capture
Capture is a command line application designed to test features of backends to see if they are implemented correctly.
For the UVC backend, you may need to run the app as admin.
NOTE: Network Camera support is currently broken.
### Capture - Usage
`<>` indicates an optional parameter. `[]` indicates a mandatory one.
+17 -16
View File
@@ -4,7 +4,7 @@ use glium::{
IndexBuffer, Surface, Texture2d, VertexBuffer,
};
use glutin::{event_loop::EventLoop, window::WindowBuilder, ContextBuilder};
use nokhwa::{query_devices, Camera, CaptureAPIBackend, FrameFormat, NetworkCamera};
use nokhwa::{query_devices, Camera, CaptureAPIBackend, FrameFormat};
use std::time::Instant;
#[derive(Copy, Clone)]
@@ -195,21 +195,22 @@ fn main() {
}
// IP Camera
else {
let ip_camera =
NetworkCamera::new(matches_clone.value_of("capture").unwrap().to_string())
.expect("Invalid IP!");
ip_camera.open_stream().unwrap();
loop {
let frame = ip_camera.frame().unwrap();
println!(
"Captured frame {}x{} @ {}FPS size {}",
frame.width(),
frame.height(),
fps,
frame.len()
);
send.send(frame).unwrap();
}
// let ip_camera =
// NetworkCamera::new(matches_clone.value_of("capture").unwrap().to_string())
// .expect("Invalid IP!");
// ip_camera.open_stream().unwrap();
// loop {
// let frame = ip_camera.frame().unwrap();
// println!(
// "Captured frame {}x{} @ {}FPS size {}",
// frame.width(),
// frame.height(),
// fps,
// frame.len()
// );
// send.send(frame).unwrap();
// }
panic!("Network camera support is currently not implemented!");
}
});