1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! # nokhwa
//! Nokhwa(녹화): Korean word meaning "to record".
//!
//! A Simple-to-use, cross-platform Rust Webcam Capture Library
//!
//! ## Using nokhwa
//! You will need the latest stable Rust and Cargo.
//!
//! Nokhwa can be added to your crate by adding it to your `Cargo.toml`:
//! ```.ignore
//! [dependencies.nokhwa]
//! // TODO: replace the "*" with the latest version of `nokhwa`
//! version = "*"
//! // TODO: add some features
//! features = [""]
//! ```
//!
//! Most likely, you will only use functionality provided by the `Camera` struct. If you need lower-level access, you may instead opt to use the raw capture backends found at `nokhwa::backends::capture::*`.
//! ## API Support
//! The table below lists current Nokhwa API support.
//! - The `Backend` column signifies the backend.
//! - The `Input` column signifies reading frames from the camera
//! - The `Query` column signifies system device list support
//! - The `Query-Device` column signifies reading device capabilities
//! - The `Platform` column signifies what Platform this is availible on.
//!
//! | Backend | Input | Query | Query-Device | Platform |
//! |-------------------------------------|--------------------|--------------------|--------------------|---------------------|
//! | `Video4Linux`(`input-v4l`) | YES | YES | YES | Linux |
//! | `libuvc`(`input-uvc`) | YES | YES | YES | Linux, Windows, Mac |
//! | `OpenCV`(`input-opencv`)^ | YES | NO | NO | Linux, Windows, Mac |
//! | `IPCamera`(`input-ipcam`/`OpenCV`)^ | YES | NO | NO | Linux, Windows, Mac |
//! | `GStreamer`(`input-gst`)^ | YES | YES | YES | Linux, Windows, Mac |
//! | `FFMpeg` | * | * | * | Linux, Windows, Mac |
//! | `AVFoundation` | * | * | * | Mac |
//! | MSMF | * | * | * | Windows |
//! | JS/WASM | * | * | * | Web |
//!
//! *: Planned/WIP
//!
//!
//! ^ = No CameraFormat setting support.
//!
//! ## Feature
//! The default feature includes nothing. Anything starting with `input-*` is a feature that enables the specific backend.
//! As a general rule of thumb, you would want to keep at least `input-uvc` or other backend that has querying enabled so you can get device information from `nokhwa`.
//!
//! `input-*` features:
//! - `input-v4l`: Enables the `Video4Linux` backend (linux)
//! - `input-uvc`: Enables the `libuvc` backend (cross-platform, libuvc statically-linked)
//! - `input-opencv`: Enables the `opencv` backend (cross-platform)
//! - `input-ipcam`: Enables the use of IP Cameras, please see the `NetworkCamera` struct. Note that this relies on `opencv`, so it will automatically enable the `input-opencv` feature.
//! - `input-gst`: Enables the `gstreamer` backend (cross-platform).
//!
//! Conversely, anything that starts with `output-*` controls a feature that controls the output of something (usually a frame from the camera)
//!
//! `output-*` features:
//! - `output-wgpu`: Enables the API to copy a frame directly into a `wgpu` texture.
//!
//! You many want to pick and choose to reduce bloat.
//! ## Example
//! ```.ignore
//! // set up the Camera
//! let mut camera = Camera::new(
//! 0, // index
//! Some(CameraFormat::new_from(640, 480, FrameFormat::MJPEG, 30)), // format
//! CaptureAPIBackend::AUTO, // what backend to use (let nokhwa decide for itself)
//! )
//! .unwrap();
//! // open stream
//! camera.open_stream().unwrap();
//! loop {
//! let frame = camera.get_frame().unwrap();
//! println!("{}, {}", frame.width(), frame.height());
//! }
//! ```
//! They can be found in the `examples` folder.
/// Raw access to each of Nokhwa's backends.
pub use Camera;
pub use *;
pub use NokhwaError;
pub use NetworkCamera;
pub use query_devices;
pub use *;