From fcc7047ca2d7aafdb7ca7e0703d2cf0ea48c3cfc Mon Sep 17 00:00:00 2001 From: l1npengtul Date: Sat, 17 Jul 2021 18:03:01 +0900 Subject: [PATCH] fix example --- examples/README.md | 1 + examples/capture/src/main.rs | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/examples/README.md b/examples/README.md index 99c51e5..6552fcb 100644 --- a/examples/README.md +++ b/examples/README.md @@ -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. diff --git a/examples/capture/src/main.rs b/examples/capture/src/main.rs index 71d2973..8e83396 100644 --- a/examples/capture/src/main.rs +++ b/examples/capture/src/main.rs @@ -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!"); } });