From 8bfbbcac11a61e83f3d0785f68c17e401366627a Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Thu, 9 May 2019 13:15:17 +0200 Subject: [PATCH 1/2] Allow sending `SimpleCapParams` across threads --- .gitignore | 1 + .travis.yml | 8 ++++++++ Cargo.toml | 6 +++--- build.rs | 4 ++-- src/lib.rs | 6 ++++-- 5 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index e97934c..1d5c1aa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build/ escapi.opensdf escapi.sdf /target/* +Cargo.lock diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..798dd31 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: rust +rust: + - stable + - beta + - nightly +os: + - windows + diff --git a/Cargo.toml b/Cargo.toml index 85c2f89..7cc827b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "escapi" -version = "3.1.0" +version = "3.1.1" authors = [ "Daniel Abramov ", "Oliver Schneider ", @@ -16,7 +16,7 @@ kernel32-sys = "0.2.2" libc = "0.2.10" [dev-dependencies] -image = "0.13" +image = "0.21.1" [build-dependencies] -gcc = "0.3" +cc = "1.0" diff --git a/build.rs b/build.rs index 6e7ee51..8b3ecb3 100644 --- a/build.rs +++ b/build.rs @@ -1,9 +1,9 @@ -extern crate gcc; +extern crate cc; fn main() { let path = std::env::current_dir().expect("Could not get the current dir"); - gcc::Config::new() + cc::Build::new() .cpp(true) .pic(true) .include(path.join("escapi_dll")) diff --git a/src/lib.rs b/src/lib.rs index 2d6b530..543f7a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,8 @@ struct SimpleCapParams { height: libc::c_uint, } +unsafe impl Send for SimpleCapParams {} + pub fn num_devices() -> usize { unsafe { countCaptureDevices() as usize } } @@ -43,7 +45,7 @@ pub fn init(index: usize, wdt: u32, hgt: u32, desired_fps: u64) -> Result, + buf: Box<[libc::c_int]>, params: Box, desired_fps: u64, } @@ -66,7 +68,7 @@ impl Device { } pub fn name(&self) -> String { let mut v = vec![0u8; 100]; - unsafe { getCaptureDeviceName(self.device_idx, v.as_mut_ptr() as *mut i8, v.len() as i32) }; + unsafe { getCaptureDeviceName(self.device_idx, v.as_mut_ptr() as *mut i8, v.len() as libc::c_int) }; let null = v.iter().position(|&c| c == 0).expect("null termination character"); v.truncate(null); String::from_utf8(v).expect("device name contains invalid utf8 characters") From 6e0839fec2b5478a52c272ce38db4c8c570a95e1 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 10 May 2019 15:49:08 +0200 Subject: [PATCH 2/2] Breaking changes need major bump --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7cc827b..72ce878 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "escapi" -version = "3.1.1" +version = "4.0.0" authors = [ "Daniel Abramov ", "Oliver Schneider ",