Skip to content

Commit

Permalink
fix features
Browse files Browse the repository at this point in the history
  • Loading branch information
l1npengtul committed Dec 3, 2024
1 parent 368d15b commit 5a9874f
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exclude = ["examples/jscam"]
crate-type = ["cdylib", "rlib"]

[features]
default = ["flume", "decoding"]
default = ["decoding"]
serialize = ["serde", "nokhwa-core/serialize"]
decoding = ["nokhwa-core/mjpeg"]
input-avfoundation = ["nokhwa-bindings-macos"]
Expand Down Expand Up @@ -48,6 +48,7 @@ test-fail-warning = []
[dependencies]
thiserror = "1.0"
paste = "1.0"
flume = "0.11"

[dependencies.nokhwa-core]
version = "0.1"
Expand All @@ -57,10 +58,6 @@ path = "nokhwa-core"
version = "1.0"
optional = true

[dependencies.flume]
version = "0.11"
optional = true

[dependencies.image]
version = "0.25"
default-features = false
Expand Down
14 changes: 14 additions & 0 deletions examples/captesting/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "captesting"
version = "0.1.0"
edition = "2021"

[dependencies]

[dependencies.image]
version = "0.25"

[dependencies.nokhwa]
path = "../.."
# EDIT THIS!
features = ["input-native"]
15 changes: 15 additions & 0 deletions examples/captesting/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use nokhwa::Camera;
use nokhwa::pixel_format::RgbFormat;
use nokhwa::utils::{CameraIndex, RequestedFormat, RequestedFormatType};

fn main() {
let index: CameraIndex = CameraIndex::Index(50);
let requested: RequestedFormat<'_> = RequestedFormat::new::<RgbFormat>(RequestedFormatType::AbsoluteHighestResolution);
let mut camera = Camera::new(index, requested).unwrap();
println!("{}", camera.camera_format());
camera.open_stream().unwrap();
let frame = camera.frame().unwrap();
camera.stop_stream().unwrap();
let decoded = frame.decode_image::<RgbFormat>().unwrap();
decoded.save_with_format("turtle.jpeg", image::ImageFormat::Jpeg).unwrap()
}
22 changes: 22 additions & 0 deletions nokhwa-decoder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "nokhwa-decoder"
version = "0.1.0"
edition = "2021"

[dependencies]

[dependencies.nokhwa-core]
version = "0.2"
path = "../nokhwa-core"

[dependencies.dcv-color-primitives]
version = "0.6"
optional = true

[dependencies.yuvutils-rs]
version = "0.5"
optional = true

[dependencies.mozjpeg]
version = "0.10"
optional = true
14 changes: 14 additions & 0 deletions nokhwa-decoder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn add(left: u64, right: u64) -> u64 {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

0 comments on commit 5a9874f

Please sign in to comment.