From c65504a2bae72f611a09dfa1a67922b61c7cd096 Mon Sep 17 00:00:00 2001 From: l1npengtul Date: Mon, 19 Dec 2022 16:24:27 +0900 Subject: [PATCH] rc6 --- Cargo.toml | 12 ++++++------ nokhwa-bindings-linux/Cargo.toml | 4 ++-- nokhwa-bindings-macos/Cargo.toml | 4 ++-- nokhwa-bindings-windows/Cargo.toml | 4 ++-- nokhwa-core/Cargo.toml | 2 +- nokhwa-core/src/buffer.rs | 9 ++++++--- nokhwa-core/src/types.rs | 2 -- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cd2abea..f227992 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nokhwa" -version = "0.10.0-rc.5" +version = "0.10.0-rc.6" authors = ["l1npengtul "] edition = "2021" description = "A Simple-to-use, cross-platform Rust Webcam Capture Library" @@ -34,7 +34,7 @@ output-wgpu = ["wgpu", "nokhwa-core/wgpu-types"] output-threaded = [] small-wasm = [] docs-only = ["input-native", "input-opencv", "input-jscam","output-wgpu", "output-threaded", "serialize"] -docs-nolink = ["opencv/docs-only"] +docs-nolink = ["opencv/docs-only", "nokhwa-core/docs-features"] docs-features = [] test-fail-warning = [] @@ -43,7 +43,7 @@ thiserror = "1.0" paste = "1.0" [dependencies.nokhwa-core] -version = "0.1.0-rc.5" +version = "0.1.0-rc.6" path = "nokhwa-core" [dependencies.serde] @@ -81,17 +81,17 @@ version = "0.8" optional = true [dependencies.nokhwa-bindings-windows] -version = "0.4.0-rc.5" +version = "0.4.0-rc.6" path = "nokhwa-bindings-windows" optional = true [dependencies.nokhwa-bindings-macos] -version = "0.2.0-rc.5" +version = "0.2.0-rc.6" path = "nokhwa-bindings-macos" optional = true [dependencies.nokhwa-bindings-linux] -version = "0.1.0-rc.5" +version = "0.1.0-rc.6" path = "nokhwa-bindings-linux" optional = true diff --git a/nokhwa-bindings-linux/Cargo.toml b/nokhwa-bindings-linux/Cargo.toml index 7f52f2b..be00c45 100644 --- a/nokhwa-bindings-linux/Cargo.toml +++ b/nokhwa-bindings-linux/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nokhwa-bindings-linux" -version = "0.1.0-rc.5" +version = "0.1.0-rc.6" edition = "2021" license = "Apache-2.0" repository = "https://github.com/l1npengtul/nokhwa" @@ -11,7 +11,7 @@ keywords = ["v4l", "v4l2", "linux", "capture", "webcam"] [dependencies] [dependencies.nokhwa-core] -version = "0.1.0-rc.5" +version = "0.1.0-rc.6" path = "../nokhwa-core" [target.'cfg(target_os="linux")'.dependencies] diff --git a/nokhwa-bindings-macos/Cargo.toml b/nokhwa-bindings-macos/Cargo.toml index c350a55..e644018 100644 --- a/nokhwa-bindings-macos/Cargo.toml +++ b/nokhwa-bindings-macos/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nokhwa-bindings-macos" -version = "0.2.0-rc.5" +version = "0.2.0-rc.6" edition = "2021" authors = ["l1npengtul"] license = "Apache-2.0" @@ -13,7 +13,7 @@ keywords = ["avfoundation", "macos", "capture", "webcam"] [dependencies.nokhwa-core] -version = "0.1.0-rc.5" +version = "0.1.0-rc.6" path = "../nokhwa-core" [target.'cfg(any(target_os="macos",target_os="ios"))'.dependencies] diff --git a/nokhwa-bindings-windows/Cargo.toml b/nokhwa-bindings-windows/Cargo.toml index f389e93..066931c 100644 --- a/nokhwa-bindings-windows/Cargo.toml +++ b/nokhwa-bindings-windows/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nokhwa-bindings-windows" -version = "0.4.0-rc.5" +version = "0.4.0-rc.6" authors = ["l1npengtul"] edition = "2021" license = "Apache-2.0" @@ -13,7 +13,7 @@ keywords = ["media-foundation", "windows", "capture", "webcam"] [dependencies] [dependencies.nokhwa-core] -version = "0.1.0-rc.5" +version = "0.1.0-rc.6" path = "../nokhwa-core" [target.'cfg(target_os="windows")'.dependencies.windows] diff --git a/nokhwa-core/Cargo.toml b/nokhwa-core/Cargo.toml index ddcfc79..011e5ba 100644 --- a/nokhwa-core/Cargo.toml +++ b/nokhwa-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nokhwa-core" -version = "0.1.0-rc.5" +version = "0.1.0-rc.6" authors = ["l1npengtul "] edition = "2021" description = "Core type definitions for nokhwa" diff --git a/nokhwa-core/src/buffer.rs b/nokhwa-core/src/buffer.rs index c6cc7c5..fdc8486 100644 --- a/nokhwa-core/src/buffer.rs +++ b/nokhwa-core/src/buffer.rs @@ -104,7 +104,7 @@ impl Buffer { } /// Decodes a image with allocation using the provided [`FormatDecoder`] into a [`Mat`](https://docs.rs/opencv/latest/opencv/core/struct.Mat.html). /// - /// Note that this does a clone when creating the buffer, to decouple the lifetime of the internal data to the temporary Buffer. If you want to avoid this, please see [`decode_as_opencv_mat`](Self::decode_as_opencv_mat). + /// Note that this does a clone when creating the buffer, to decouple the lifetime of the internal data to the temporary Buffer. If you want to avoid this, please see [`decode_opencv_mat`](Self::decode_opencv_mat). /// # Errors /// Will error when the decoding fails, or `OpenCV` failed to create/copy the [`Mat`](https://docs.rs/opencv/latest/opencv/core/struct.Mat.html). /// # Safety @@ -113,7 +113,10 @@ impl Buffer { /// Most notably, the `data` **must** stay in scope for the duration of the [`Mat`](https://docs.rs/opencv/latest/opencv/core/struct.Mat.html) or bad, ***bad*** things happen. #[cfg(feature = "opencv-mat")] #[cfg_attr(feature = "docs-features", doc(cfg(feature = "opencv-mat")))] - pub fn decode_opencv_mat(&self) -> Result { + #[allow(clippy::cast_possible_wrap)] + pub fn decode_opencv_mat( + &mut self, + ) -> Result { use image::Pixel; use opencv::core::{Mat, Mat_AUTO_STEP, CV_8UC1, CV_8UC2, CV_8UC3, CV_8UC4}; @@ -137,7 +140,7 @@ impl Buffer { self.resolution.height_y as i32, self.resolution.width_x as i32, array_type, - data.as_ref().as_mut_ptr().cast(), + self.buffer.as_ref().as_ptr().cast_mut().cast(), Mat_AUTO_STEP, ) .map_err(|why| NokhwaError::ProcessFrameError { diff --git a/nokhwa-core/src/types.rs b/nokhwa-core/src/types.rs index e0797b9..9a0f5d3 100644 --- a/nokhwa-core/src/types.rs +++ b/nokhwa-core/src/types.rs @@ -1383,11 +1383,9 @@ pub enum ApiBackend { Auto, AVFoundation, Video4Linux, - #[deprecated] UniversalVideoClass, MediaFoundation, OpenCv, - #[deprecated] GStreamer, Network, Browser,